Skip to content

Commit 8f9e372

Browse files
ai refactor to graphql schema
1 parent 0f18be4 commit 8f9e372

53 files changed

Lines changed: 542 additions & 280 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# AGENTS
2+
3+
This repo is a multi-module Gradle project (Kotlin/JVM and Kotlin/JS) that
4+
includes a web client and a server.
5+
6+
## Quick commands
7+
- `./gradlew test`
8+
- `./gradlew build`
9+
- `./gradlew :module:task` (run module-specific tasks as needed)
10+
11+
## Layout
12+
- `client/` frontend (Kotlin/JS, Vite config in `client/vite.config.mjs`)
13+
- `server/` backend services
14+
- `libraries/` shared modules
15+
- `cli/`, `sdk/`, `e2e/`, `scripts/`, `deploy/` supporting tooling
16+
17+
## Notes for agents
18+
- Use the Gradle wrapper (`./gradlew`) for builds and tests.
19+
- Keep changes small and consistent with existing patterns.

build.gradle.kts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ tagger {
4545
}
4646

4747
tasks {
48+
val testDistributionServer = providers.gradleProperty("develocity.testDistribution.server")
49+
.orElse(providers.gradleProperty("gradle.enterprise.testDistribution.server"))
50+
.orElse(providers.systemProperty("develocity.testDistribution.server"))
51+
.orElse(providers.systemProperty("gradle.enterprise.testDistribution.server"))
52+
.orElse("")
53+
54+
matching { it.name == "testDistributionWebSocketCheck" }.configureEach {
55+
if (testDistributionServer.get().isBlank()) {
56+
enabled = false
57+
}
58+
}
59+
4860
named<ComposeUp>("composeUp") {
4961
mustRunAfter("caddyComposeUp", "libraries:repository:dynamo:composeUp")
5062
dependsOn(":server:buildImage")

client/build.gradle.kts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,18 @@ tasks {
132132
val cdnLookupFile = cdnLookupConfiguration.resolve().first()
133133
arguments = listOf("--no-warnings", cdnLookupFile.absolutePath) + settings.fieldNames().asSequence().toList()
134134
outputFile = file(cdnBuildOutput)
135+
outputs.upToDateWhen { cdnBuildOutput.get().asFile.length() > 0L }
135136
outputs.cacheIf { true }
136137
}
138+
val sanitizeCdnJson by registering {
139+
dependsOn(lookupCdnUrls)
140+
doLast {
141+
val cdnFile = cdnBuildOutput.get().asFile
142+
if (!cdnFile.exists() || cdnFile.length() == 0L) {
143+
throw GradleException("cdn.json was not generated. Run :client:lookupCdnUrls and verify cdn-lookup output.")
144+
}
145+
}
146+
}
137147
val projectResultPath = rootProject.layout.buildDirectory
138148
.file("test-output/${project.path}/results".replace(":", "/"))
139149
val copyCdnJsonToResultDirectory by registering(Copy::class) {
@@ -151,7 +161,8 @@ tasks {
151161
compileProductionExecutableKotlinJs {}
152162

153163
jsBrowserProductionVite {
154-
dependsOn(lookupCdnUrls, copyCdnSettings, jsProcessResources)
164+
notCompatibleWithConfigurationCache("Kotlin Vite tasks use lazy Node.js runtime access.")
165+
dependsOn(sanitizeCdnJson, copyCdnSettings, jsProcessResources)
155166
mustRunAfter("components:jsNodeTest")
156167
inputs.file(cdnBuildOutput)
157168
inputs.file(project.layout.projectDirectory.file("vite.config.mjs"))
@@ -164,6 +175,9 @@ tasks {
164175
outputs.file(outputDirectory.file("client-ktor.js"))
165176
outputs.cacheIf { true }
166177
}
178+
named("jsBrowserProductionVitePrepare") {
179+
notCompatibleWithConfigurationCache("Kotlin Vite tasks use lazy Node.js runtime access.")
180+
}
167181
named("jsBrowserDevelopmentRun") {
168182
dependsOn(lookupCdnUrls, jsProcessResources)
169183
}

client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/ContributionPopUpMenu.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.zegreatrob.coupling.client.components
22

3-
import com.zegreatrob.coupling.action.player.SavePlayerCommand
3+
import com.zegreatrob.coupling.action.party.SavePartyCommand
44
import com.zegreatrob.coupling.client.components.contributor.ContributorMenu
55
import com.zegreatrob.coupling.model.party.PartyId
66
import com.zegreatrob.coupling.model.player.Player
@@ -34,7 +34,7 @@ external interface ContributionPopUpMenuProps : Props {
3434
@Suppress("INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING")
3535
var partyId: PartyId
3636
var players: List<Player>
37-
var dispatchFunc: DispatchFunc<SavePlayerCommand.Dispatcher>
37+
var dispatchFunc: DispatchFunc<SavePartyCommand.Dispatcher>
3838
var children: ((ReferenceElement, Player) -> Unit) -> ReactNode
3939
}
4040

client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/contribution/ContributionListContent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.zegreatrob.coupling.client.components.contribution
22

3-
import com.zegreatrob.coupling.action.player.SavePlayerCommand
3+
import com.zegreatrob.coupling.action.party.SavePartyCommand
44
import com.zegreatrob.coupling.client.components.ContributionPopUpMenu
55
import com.zegreatrob.coupling.client.components.DispatchFunc
66
import com.zegreatrob.coupling.client.components.graphing.ContributionWindow
@@ -38,7 +38,7 @@ external interface ContributionListContentProps : Props {
3838
var window: ContributionWindow
3939
var setWindow: (ContributionWindow) -> Unit
4040
var players: List<Player>
41-
var dispatchFunc: DispatchFunc<SavePlayerCommand.Dispatcher>
41+
var dispatchFunc: DispatchFunc<SavePartyCommand.Dispatcher>
4242
}
4343

4444
@ReactFunc

client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/contribution/ContributionOverviewContent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package com.zegreatrob.coupling.client.components.contribution
22

3-
import com.zegreatrob.coupling.action.player.SavePlayerCommand
3+
import com.zegreatrob.coupling.action.party.SavePartyCommand
44
import com.zegreatrob.coupling.client.components.ContributionPopUpMenu
55
import com.zegreatrob.coupling.client.components.DispatchFunc
66
import com.zegreatrob.coupling.model.Contribution
@@ -23,7 +23,7 @@ external interface ContributionOverviewContentProps : Props {
2323
var party: PartyDetails
2424
var contributions: List<Contribution>
2525
var players: List<Player>
26-
var dispatchFunc: DispatchFunc<SavePlayerCommand.Dispatcher>
26+
var dispatchFunc: DispatchFunc<SavePartyCommand.Dispatcher>
2727
}
2828

2929
@ReactFunc

client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/contributor/ContributorMenu.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.zegreatrob.coupling.client.components.contributor
22

3-
import com.zegreatrob.coupling.action.player.SavePlayerCommand
4-
import com.zegreatrob.coupling.action.player.fire
3+
import com.zegreatrob.coupling.action.party.SavePartyCommand
4+
import com.zegreatrob.coupling.action.party.fire
55
import com.zegreatrob.coupling.client.components.CouplingButton
66
import com.zegreatrob.coupling.client.components.DispatchFunc
77
import com.zegreatrob.coupling.client.components.Paths.playerConfigPath
@@ -27,7 +27,7 @@ external interface ContributorMenuProps : Props {
2727

2828
@Suppress("INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING")
2929
var partyId: PartyId
30-
var dispatchFunc: DispatchFunc<SavePlayerCommand.Dispatcher>
30+
var dispatchFunc: DispatchFunc<SavePartyCommand.Dispatcher>
3131
}
3232

3333
@ReactFunc
@@ -36,12 +36,12 @@ val ContributorMenu by nfc<ContributorMenuProps> { props ->
3636
val navigate = useNavigate()
3737

3838
val createPlayer = dispatchFunc {
39-
fire(SavePlayerCommand(partyId, contributor))
39+
fire(SavePartyCommand(partyId = partyId, players = listOf(contributor)))
4040
}
4141
val addEmailToExistingPlayer = { player: Player ->
4242
fun(_: MouseEvent<HTMLButtonElement, *>) {
4343
val updatedPlayer = player.copy(additionalEmails = player.additionalEmails + contributor.email)
44-
dispatchFunc { fire(SavePlayerCommand(partyId, updatedPlayer)) }()
44+
dispatchFunc { fire(SavePartyCommand(partyId = partyId, players = listOf(updatedPlayer))) }()
4545
}
4646
}
4747

client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/pin/PinConfig.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.zegreatrob.coupling.client.components.pin
22

3+
import com.zegreatrob.coupling.action.party.SavePartyCommand
4+
import com.zegreatrob.coupling.action.party.fire
35
import com.zegreatrob.coupling.action.pin.DeletePinCommand
4-
import com.zegreatrob.coupling.action.pin.SavePinCommand
56
import com.zegreatrob.coupling.action.pin.fire
67
import com.zegreatrob.coupling.client.components.DispatchFunc
78
import com.zegreatrob.coupling.client.components.Paths.pinListPath
@@ -24,7 +25,7 @@ import react.router.dom.usePrompt
2425
import react.useState
2526
import kotlin.js.Json
2627

27-
external interface PinConfigProps<D> : Props where D : DeletePinCommand.Dispatcher, D : SavePinCommand.Dispatcher {
28+
external interface PinConfigProps<D> : Props where D : DeletePinCommand.Dispatcher, D : SavePartyCommand.Dispatcher {
2829
var party: PartyDetails
2930
var boost: Boost?
3031
var pin: Pin
@@ -41,7 +42,7 @@ val PinConfig by nfc<PinConfigProps<*>> { props ->
4142
val updatedPin = values.fromJsonDynamic<GqlPinSnapshot>().toModel()
4243
val (redirectUrl, setRedirectUrl) = useState<String?>(null)
4344
val onSubmit = dispatchFunc {
44-
fire(SavePinCommand(party.id, updatedPin))
45+
fire(SavePartyCommand(partyId = party.id, pins = listOf(updatedPin)))
4546
reload()
4647
}
4748
val onRemove = if (!pinList.contains(pin)) {

client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/player/PlayerConfig.kt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package com.zegreatrob.coupling.client.components.player
22

3+
import com.zegreatrob.coupling.action.party.SavePartyCommand
4+
import com.zegreatrob.coupling.action.party.fire
35
import com.zegreatrob.coupling.action.player.DeletePlayerCommand
4-
import com.zegreatrob.coupling.action.player.SavePlayerCommand
56
import com.zegreatrob.coupling.action.player.fire
67
import com.zegreatrob.coupling.client.components.DispatchFunc
78
import com.zegreatrob.coupling.client.components.Paths.currentPairsPath
@@ -26,7 +27,7 @@ import react.useState
2627
import kotlin.js.Json
2728

2829
external interface PlayerConfigProps<P> : Props
29-
where P : SavePlayerCommand.Dispatcher, P : DeletePlayerCommand.Dispatcher {
30+
where P : SavePartyCommand.Dispatcher, P : DeletePlayerCommand.Dispatcher {
3031
var party: PartyDetails
3132
var boost: Boost?
3233
var player: Player
@@ -51,10 +52,12 @@ val PlayerConfig by nfc<PlayerConfigProps<*>> { props ->
5152
)
5253
val onSubmit = dispatchFunc {
5354
fire(
54-
SavePlayerCommand(
55+
SavePartyCommand(
5556
partyId = party.id,
56-
player = updatedPlayer.copy(
57-
additionalEmails = updatedPlayer.additionalEmails.filterNot(String::isBlank).toSet(),
57+
players = listOf(
58+
updatedPlayer.copy(
59+
additionalEmails = updatedPlayer.additionalEmails.filterNot(String::isBlank).toSet(),
60+
),
5861
),
5962
),
6063
)

client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/player/UpdatingPlayerList.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.zegreatrob.coupling.client.components.player
22

33
import com.zegreatrob.coupling.action.VoidResult
4-
import com.zegreatrob.coupling.action.player.SavePlayerCommand
4+
import com.zegreatrob.coupling.action.party.SavePartyCommand
55
import com.zegreatrob.coupling.client.components.DispatchFunc
66
import com.zegreatrob.coupling.model.player.Player
77
import com.zegreatrob.minreact.ReactFunc
@@ -13,7 +13,7 @@ import react.Props
1313
import react.ReactNode
1414
import react.useState
1515

16-
external interface UpdatingPlayerListProps<D> : Props where D : SavePlayerCommand.Dispatcher {
16+
external interface UpdatingPlayerListProps<D> : Props where D : SavePartyCommand.Dispatcher {
1717
var players: List<Player>
1818
var dispatchFunc: DispatchFunc<D>
1919
var children: (List<Player>, DispatchFunc<D>) -> ReactNode
@@ -62,8 +62,8 @@ private class SecretCannon(
6262
) {
6363
val unwrappedAction = action.unwrap()
6464
@Suppress("USELESS_IS_CHECK")
65-
if (unwrappedAction is SavePlayerCommand && result == VoidResult.Accepted) {
66-
addPlayer(unwrappedAction.player)
65+
if (unwrappedAction is SavePartyCommand && result == VoidResult.Accepted) {
66+
unwrappedAction.players.forEach(addPlayer)
6767
}
6868
}
6969
}

0 commit comments

Comments
 (0)