From 71bd4ade64a0633418aa1ee2084f2ca54e6aec50 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Tue, 5 Dec 2023 15:34:19 +0200 Subject: [PATCH 01/24] :heavy_plus_sign: add scalafix plugin --- project/plugins.sbt | 1 + 1 file changed, 1 insertion(+) create mode 100644 project/plugins.sbt diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..00d82eb --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") From 239b5656ad4f99f579b42253e5e7094dcbdff7f8 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 08:17:34 +0200 Subject: [PATCH 02/24] =?UTF-8?q?=F0=9F=94=A7=20Enabled=20semanticDb=20for?= =?UTF-8?q?=20scalafix.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index e3d71e7..b7008fd 100644 --- a/build.sbt +++ b/build.sbt @@ -1,4 +1,5 @@ -scalaVersion := "3.3.1" +scalaVersion := "3.3.1" +semanticdbEnabled := true scalacOptions ++= Seq("-Xmax-inlines", "50") From 6582f4c5ae3bb7ef3a6868dc9ef650eb81270377 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 08:20:54 +0200 Subject: [PATCH 03/24] =?UTF-8?q?=F0=9F=94=A7=20removedUnused=20not=20supp?= =?UTF-8?q?orted=20in=20Scala=203.3.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .scalafix.conf | 1 + 1 file changed, 1 insertion(+) create mode 100644 .scalafix.conf diff --git a/.scalafix.conf b/.scalafix.conf new file mode 100644 index 0000000..665c9a2 --- /dev/null +++ b/.scalafix.conf @@ -0,0 +1 @@ +OrganizeImports.removeUnused = false From 40a18741bf6f81e4c875ca0e36bd2922bb50d476 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 08:21:26 +0200 Subject: [PATCH 04/24] =?UTF-8?q?=F0=9F=8E=A8=20Ran=20OrganizeImports=20vi?= =?UTF-8?q?a=20Scalafix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xyz/didx/ConversationPollingHandler.scala | 41 +++++++++---------- src/main/scala/xyz/didx/DawnPatrol.scala | 19 ++++----- src/main/scala/xyz/didx/SignalBot.scala | 16 ++++---- src/main/scala/xyz/didx/ai/AiHandler.scala | 15 +++---- .../didx/ai/embedding/EmbeddingHandler.scala | 16 ++++---- .../ai/handler/ConfirmOnboardingResult.scala | 7 ++-- .../xyz/didx/ai/handler/Onboarding.scala | 7 ++-- .../xyz/didx/ai/handler/Opportunities.scala | 21 ++++++---- .../scala/xyz/didx/ai/model/Opportunity.scala | 5 ++- .../xyz/didx/ai/openai/OpenAIAgent.scala | 2 +- .../didx/ai/openai/OpenAIMessageCodec.scala | 2 +- .../scala/xyz/didx/config/ConfigReaders.scala | 15 ++++--- .../xyz/didx/connection/RedisStorage.scala | 7 +--- .../scala/xyz/didx/didcomm/DIDCodec.scala | 18 ++++---- src/main/scala/xyz/didx/didcomm/DIDDoc.scala | 6 +-- .../didx/messages/SignalMessageCodec.scala | 6 +-- .../scala/xyz/didx/passkit/PasskitAgent.scala | 19 ++++++--- .../xyz/didx/registry/RegistryClient.scala | 8 ++-- .../xyz/didx/registry/RegistryResponse.scala | 4 +- .../didx/registry/RegistryResponseCodec.scala | 10 +++-- 20 files changed, 128 insertions(+), 116 deletions(-) diff --git a/src/main/scala/xyz/didx/ConversationPollingHandler.scala b/src/main/scala/xyz/didx/ConversationPollingHandler.scala index d7e2cea..ccf8ef7 100644 --- a/src/main/scala/xyz/didx/ConversationPollingHandler.scala +++ b/src/main/scala/xyz/didx/ConversationPollingHandler.scala @@ -1,38 +1,37 @@ package xyz.didx -import scala.collection.mutable -//import io.circe._ +import cats.data.EitherT +import cats.effect.FiberIO +import cats.effect.IO +import cats.effect.Ref +import cats.effect.kernel.Resource +import cats.implicits.* +import cats.syntax.traverse.* import io.circe.parser.* import io.circe.syntax.* import org.typelevel.log4cats.Logger import org.typelevel.log4cats.slf4j.Slf4jLogger import sttp.client3.SttpBackend +import xyz.didx.ai.AiHandler +import xyz.didx.ai.model.ChatState import xyz.didx.config.ConfigReaders.* -import xyz.didx.logging.LogWriter.* +import xyz.didx.connection.RedisStorage +import xyz.didx.didcomm.Service +import xyz.didx.didcomm.ServiceEndpointNodes import xyz.didx.didcomm.* +import xyz.didx.logging.LogWriter.* +import xyz.didx.messages.* +import xyz.didx.openai.OpenAIAgent +import xyz.didx.passkit.PasskitAgent +import xyz.didx.registry.RegistryClient +import xyz.didx.registry.* +import xyz.didx.signal.SignalBot import java.net.URI -import xyz.didx.signal.SignalBot -import cats.effect.kernel.Resource -import xyz.didx.connection.RedisStorage -import xyz.didx.messages.* -import cats.data.EitherT -import cats.effect.IO -import cats.implicits.* -import cats.syntax.traverse.* +import scala.collection.mutable import SignalMessageCodec.memberDecoder -import xyz.didx.registry.* import RegistryResponseCodec.encodeRegistryRequest -import xyz.didx.didcomm.Service -import xyz.didx.didcomm.ServiceEndpointNodes -import xyz.didx.registry.RegistryClient -import xyz.didx.openai.OpenAIAgent -import xyz.didx.passkit.PasskitAgent -import xyz.didx.ai.AiHandler -import xyz.didx.ai.model.ChatState -import cats.effect.Ref -import cats.effect.FiberIO class ConversationPollingHandler(using logger: Logger[IO]): val appConf = getConf(using logger) diff --git a/src/main/scala/xyz/didx/DawnPatrol.scala b/src/main/scala/xyz/didx/DawnPatrol.scala index 06cc888..68a8a89 100644 --- a/src/main/scala/xyz/didx/DawnPatrol.scala +++ b/src/main/scala/xyz/didx/DawnPatrol.scala @@ -1,19 +1,18 @@ package xyz.didx -import cats.effect.* -import cats.effect.IOApp -import org.typelevel.log4cats.Logger -import org.typelevel.log4cats.slf4j.Slf4jLogger import cats.effect.IO +import cats.effect.IOApp +import cats.effect.* import cats.effect.std.Dispatcher import fs2.Stream - -import scala.concurrent.duration.* - -import xyz.didx.ConversationPollingHandler -import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend +import org.typelevel.log4cats.Logger +import org.typelevel.log4cats.slf4j.Slf4jLogger import sttp.client3.SttpBackend -import xyz.didx.config.ConfigReaders.getConf +import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend +import xyz.didx.ConversationPollingHandler import xyz.didx.ai.handler.Opportunities +import xyz.didx.config.ConfigReaders.getConf + +import scala.concurrent.duration.* object DawnPatrol extends IOApp.Simple: // override protected def blockedThreadDetectionEnabled = true diff --git a/src/main/scala/xyz/didx/SignalBot.scala b/src/main/scala/xyz/didx/SignalBot.scala index 45199b6..4f12041 100644 --- a/src/main/scala/xyz/didx/SignalBot.scala +++ b/src/main/scala/xyz/didx/SignalBot.scala @@ -1,15 +1,11 @@ package xyz.didx.signal import cats.data.EitherT +import cats.effect.FiberIO import cats.effect.IO +import cats.effect.Ref import cats.implicits.* -import xyz.didx.messages.SignalMessage -import xyz.didx.messages.SignalMessageCodec.signalMessageDecoder -import xyz.didx.messages.SignalMessageCodec.signalSendMessage -import xyz.didx.messages.SignalSendMessage -import xyz.didx.messages.SignalSimpleMessage import fs2.Stream -//import io.circe.* import io.circe.parser.* import io.circe.syntax.* import org.typelevel.log4cats.Logger @@ -19,9 +15,13 @@ import pureconfig.generic.derivation.default.* import sttp.client3.* import sttp.client3.circe.* import sttp.model.* +import xyz.didx.messages.SignalMessage +import xyz.didx.messages.SignalMessageCodec.signalMessageDecoder +import xyz.didx.messages.SignalMessageCodec.signalSendMessage +import xyz.didx.messages.SignalSendMessage +import xyz.didx.messages.SignalSimpleMessage + import scala.concurrent.duration._ -import cats.effect.Ref -import cats.effect.FiberIO case class SignalConfig( signalUrl: String, diff --git a/src/main/scala/xyz/didx/ai/AiHandler.scala b/src/main/scala/xyz/didx/ai/AiHandler.scala index 87499f1..42bacb7 100644 --- a/src/main/scala/xyz/didx/ai/AiHandler.scala +++ b/src/main/scala/xyz/didx/ai/AiHandler.scala @@ -1,15 +1,16 @@ package xyz.didx.ai -import scala.collection.mutable -import xyz.didx.ai.model.ChatState -import xyz.didx.ai.handler.OnboardingHandler -import xyz.didx.ai.handler.ConfirmOnboardingHandler +import cats.effect.IO import dev.langchain4j.data.segment.TextSegment -import xyz.didx.ai.embedding.EmbeddingHandler import dev.langchain4j.store.embedding.EmbeddingMatch -import xyz.didx.ai.model.OnboardingResult +import xyz.didx.ai.embedding.EmbeddingHandler +import xyz.didx.ai.handler.ConfirmOnboardingHandler +import xyz.didx.ai.handler.OnboardingHandler +import xyz.didx.ai.model.ChatState import xyz.didx.ai.model.ConfirmedOnboardingResult -import cats.effect.IO +import xyz.didx.ai.model.OnboardingResult + +import scala.collection.mutable import scala.util.Try object AiHandler { diff --git a/src/main/scala/xyz/didx/ai/embedding/EmbeddingHandler.scala b/src/main/scala/xyz/didx/ai/embedding/EmbeddingHandler.scala index ce0c43b..7b7b7e8 100644 --- a/src/main/scala/xyz/didx/ai/embedding/EmbeddingHandler.scala +++ b/src/main/scala/xyz/didx/ai/embedding/EmbeddingHandler.scala @@ -1,18 +1,18 @@ package xyz.didx.ai.embedding -import scala.collection.JavaConverters._ +import dev.langchain4j.data.document.Metadata import dev.langchain4j.data.embedding.Embedding import dev.langchain4j.data.segment.TextSegment -import dev.langchain4j.store.embedding.{EmbeddingMatch, EmbeddingStore} -import dev.langchain4j.store.embedding.inmemory.InMemoryEmbeddingStore -import dev.langchain4j.model.huggingface.HuggingFaceEmbeddingModel; - import dev.langchain4j.model.embedding.EmbeddingModel -import dev.langchain4j.data.segment.TextSegment -import dev.langchain4j.data.document.Metadata +import dev.langchain4j.model.huggingface.HuggingFaceEmbeddingModel +import dev.langchain4j.model.output.Response +import dev.langchain4j.store.embedding.EmbeddingMatch +import dev.langchain4j.store.embedding.EmbeddingStore +import dev.langchain4j.store.embedding.inmemory.InMemoryEmbeddingStore import xyz.didx.ai.model.Opportunity + import java.time.Duration -import dev.langchain4j.model.output.Response +import scala.collection.JavaConverters._ object EmbeddingHandler { private val embeddingModel: EmbeddingModel = HuggingFaceEmbeddingModel diff --git a/src/main/scala/xyz/didx/ai/handler/ConfirmOnboardingResult.scala b/src/main/scala/xyz/didx/ai/handler/ConfirmOnboardingResult.scala index 6551b93..f96ea4d 100644 --- a/src/main/scala/xyz/didx/ai/handler/ConfirmOnboardingResult.scala +++ b/src/main/scala/xyz/didx/ai/handler/ConfirmOnboardingResult.scala @@ -1,13 +1,14 @@ package xyz.didx.ai.handler -import scala.collection.mutable -import com.xebia.functional.xef.prompt.PromptBuilder import com.xebia.functional.xef.prompt.Prompt +import com.xebia.functional.xef.prompt.PromptBuilder import com.xebia.functional.xef.scala.conversation.* import com.xebia.functional.xef.store.ConversationId +import xyz.didx.ai.model.AgentScript import xyz.didx.ai.model.ConfirmedOnboardingResult import xyz.didx.ai.model.OnboardingResult -import xyz.didx.ai.model.AgentScript + +import scala.collection.mutable object ConfirmOnboardingHandler { def getConfirmation( diff --git a/src/main/scala/xyz/didx/ai/handler/Onboarding.scala b/src/main/scala/xyz/didx/ai/handler/Onboarding.scala index 1cb6948..2710b79 100644 --- a/src/main/scala/xyz/didx/ai/handler/Onboarding.scala +++ b/src/main/scala/xyz/didx/ai/handler/Onboarding.scala @@ -1,12 +1,13 @@ package xyz.didx.ai.handler -import scala.collection.mutable -import com.xebia.functional.xef.prompt.PromptBuilder import com.xebia.functional.xef.prompt.Prompt +import com.xebia.functional.xef.prompt.PromptBuilder import com.xebia.functional.xef.scala.conversation.* import com.xebia.functional.xef.store.ConversationId -import xyz.didx.ai.model.OnboardingResult import xyz.didx.ai.model.AgentScript +import xyz.didx.ai.model.OnboardingResult + +import scala.collection.mutable import scala.util.Random object OnboardingHandler { diff --git a/src/main/scala/xyz/didx/ai/handler/Opportunities.scala b/src/main/scala/xyz/didx/ai/handler/Opportunities.scala index a4da0ab..fa80bc1 100644 --- a/src/main/scala/xyz/didx/ai/handler/Opportunities.scala +++ b/src/main/scala/xyz/didx/ai/handler/Opportunities.scala @@ -1,19 +1,22 @@ package xyz.didx.ai.handler -import java.util.Base64 -import java.io.{ByteArrayInputStream, ByteArrayOutputStream} -import java.util.zip.{GZIPInputStream, GZIPOutputStream} -import sttp.client4.* import cats.data.EitherT import cats.effect.IO +import io.circe +import io.circe.generic.auto._ +import io.circe.parser.decode +import sttp.client4.* import ujson.Value.Value +import xyz.didx.ai.embedding.EmbeddingHandler +import xyz.didx.ai.model.Opportunity + +import java.io.ByteArrayInputStream +import java.io.ByteArrayOutputStream +import java.util.Base64 +import java.util.zip.GZIPInputStream +import java.util.zip.GZIPOutputStream import scala.util.Try import scala.util.chaining.scalaUtilChainingOps -import io.circe.parser.decode -import io.circe.generic.auto._ -import xyz.didx.ai.model.Opportunity -import io.circe -import xyz.didx.ai.embedding.EmbeddingHandler object Opportunities { diff --git a/src/main/scala/xyz/didx/ai/model/Opportunity.scala b/src/main/scala/xyz/didx/ai/model/Opportunity.scala index 339b0b4..f2856fe 100644 --- a/src/main/scala/xyz/didx/ai/model/Opportunity.scala +++ b/src/main/scala/xyz/didx/ai/model/Opportunity.scala @@ -1,6 +1,9 @@ package xyz.didx.ai.model -import io.circe.{Decoder, DecodingFailure, HCursor} +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.HCursor + import java.time.LocalDateTime import java.time.format.DateTimeFormatter import java.time.format.DateTimeParseException diff --git a/src/main/scala/xyz/didx/ai/openai/OpenAIAgent.scala b/src/main/scala/xyz/didx/ai/openai/OpenAIAgent.scala index 3c1ca82..df73dd4 100644 --- a/src/main/scala/xyz/didx/ai/openai/OpenAIAgent.scala +++ b/src/main/scala/xyz/didx/ai/openai/OpenAIAgent.scala @@ -5,7 +5,6 @@ import cats.effect.IO import cats.effect.Sync import cats.implicits._ import cats.implicits._ -import xyz.didx.messages.SignalSimpleMessage import io.circe.* import io.circe.syntax.* import org.typelevel.log4cats.Logger @@ -14,6 +13,7 @@ import pureconfig.* import pureconfig.generic.derivation.default.* import sttp.client3.* import sttp.client3.circe.* +import xyz.didx.messages.SignalSimpleMessage case class APIConf(apiKey: String, orgId: String) derives ConfigReader: override def toString: String = diff --git a/src/main/scala/xyz/didx/ai/openai/OpenAIMessageCodec.scala b/src/main/scala/xyz/didx/ai/openai/OpenAIMessageCodec.scala index 0ee6046..761153a 100644 --- a/src/main/scala/xyz/didx/ai/openai/OpenAIMessageCodec.scala +++ b/src/main/scala/xyz/didx/ai/openai/OpenAIMessageCodec.scala @@ -3,8 +3,8 @@ package xyz.didx.openai import cats.* import cats.syntax.all.* import io.circe.Decoder.Result -import io.circe.syntax.* import io.circe.* +import io.circe.syntax.* object OpenAIMessageCodec { given openAIResponseDecoder: Decoder[OpenAIResponse] = diff --git a/src/main/scala/xyz/didx/config/ConfigReaders.scala b/src/main/scala/xyz/didx/config/ConfigReaders.scala index 815e6e1..d30e442 100644 --- a/src/main/scala/xyz/didx/config/ConfigReaders.scala +++ b/src/main/scala/xyz/didx/config/ConfigReaders.scala @@ -1,16 +1,19 @@ package xyz.didx.config -import java.net.URL -import java.net.URI -import pureconfig.ConfigReader -import pureconfig.ConfigSource -import pureconfig.generic.derivation.default.* import cats.data.EitherT import cats.effect.IO import org.typelevel.log4cats.Logger import org.typelevel.log4cats.slf4j.Slf4jLogger +import pureconfig.ConfigReader +import pureconfig.ConfigSource +import pureconfig.generic.derivation.default.* import sttp.client3.ResponseException -import xyz.didx.logging.LogWriter.{err, info, logNonEmptyList} +import xyz.didx.logging.LogWriter.err +import xyz.didx.logging.LogWriter.info +import xyz.didx.logging.LogWriter.logNonEmptyList + +import java.net.URI +import java.net.URL object ConfigReaders: diff --git a/src/main/scala/xyz/didx/connection/RedisStorage.scala b/src/main/scala/xyz/didx/connection/RedisStorage.scala index 7f26ed8..414cce3 100644 --- a/src/main/scala/xyz/didx/connection/RedisStorage.scala +++ b/src/main/scala/xyz/didx/connection/RedisStorage.scala @@ -1,16 +1,13 @@ package xyz.didx.connection -import dev.profunktor.redis4cats.Redis -import cats.effect.kernel.Resource import cats.effect.IO -import dev.profunktor.redis4cats.RedisCommands -import io.circe.syntax.* import cats.effect._ +import cats.effect.kernel.Resource import cats.implicits._ import dev.profunktor.redis4cats.Redis import dev.profunktor.redis4cats.RedisCommands - import dev.profunktor.redis4cats.effect.Log.Stdout._ +import io.circe.syntax.* import xyz.didx.didcomm.DIDTypes.* import scala.concurrent.duration.FiniteDuration diff --git a/src/main/scala/xyz/didx/didcomm/DIDCodec.scala b/src/main/scala/xyz/didx/didcomm/DIDCodec.scala index a86262a..f0b3b56 100644 --- a/src/main/scala/xyz/didx/didcomm/DIDCodec.scala +++ b/src/main/scala/xyz/didx/didcomm/DIDCodec.scala @@ -3,18 +3,16 @@ import cats.* import cats.syntax.all.* import io.circe.Decoder.Result import io.circe.* +import xyz.didx.didcomm.DIDDoc +import xyz.didx.didcomm.Service +import xyz.didx.didcomm.ServiceEndpoint +import xyz.didx.didcomm.ServiceEndpointDIDCommService +import xyz.didx.didcomm.ServiceEndpointDIDURL +import xyz.didx.didcomm.ServiceEndpointNodes +import xyz.didx.didcomm.ServiceEndpointURI +import xyz.didx.didcomm.VerificationMethod import java.net.URI -import xyz.didx.didcomm.{ - ServiceEndpointURI, - ServiceEndpointDIDURL, - Service, - ServiceEndpoint, - ServiceEndpointDIDCommService, - ServiceEndpointNodes, - VerificationMethod, - DIDDoc -} //import xyz.didx.didcomm.VerificationMethodType //import summon.{Decoder => _, _} diff --git a/src/main/scala/xyz/didx/didcomm/DIDDoc.scala b/src/main/scala/xyz/didx/didcomm/DIDDoc.scala index 8605120..ebfe4ff 100644 --- a/src/main/scala/xyz/didx/didcomm/DIDDoc.scala +++ b/src/main/scala/xyz/didx/didcomm/DIDDoc.scala @@ -5,12 +5,10 @@ package xyz.didx.didcomm import io.circe.* import io.circe.syntax._ - -//import foundation.identity.did.VerificationRelationships -import java.net.URI -//import xyz.didx.didcomm.VerificationMethodType import xyz.didx.didcomm.DIDCodec import xyz.didx.didcomm.VerificationMethodType + +import java.net.URI import scala.util.matching.Regex //import foundation.identity.did.VerificationMethod diff --git a/src/main/scala/xyz/didx/messages/SignalMessageCodec.scala b/src/main/scala/xyz/didx/messages/SignalMessageCodec.scala index 21afb0c..79aa360 100644 --- a/src/main/scala/xyz/didx/messages/SignalMessageCodec.scala +++ b/src/main/scala/xyz/didx/messages/SignalMessageCodec.scala @@ -2,15 +2,15 @@ package xyz.didx.messages import cats.Applicative.ops.toAllApplicativeOps import cats.* -import xyz.didx.messages.Member -import xyz.didx.messages.SignalMessage -import xyz.didx.messages.SignalSendMessage import io.circe.Decoder import io.circe.Decoder.Result import io.circe.Encoder import io.circe.Json import io.circe.* import io.circe.syntax._ +import xyz.didx.messages.Member +import xyz.didx.messages.SignalMessage +import xyz.didx.messages.SignalSendMessage object SignalMessageCodec: given memberDecoder: Decoder[Member] = new Decoder[Member]: diff --git a/src/main/scala/xyz/didx/passkit/PasskitAgent.scala b/src/main/scala/xyz/didx/passkit/PasskitAgent.scala index 57f55ad..ba6865d 100644 --- a/src/main/scala/xyz/didx/passkit/PasskitAgent.scala +++ b/src/main/scala/xyz/didx/passkit/PasskitAgent.scala @@ -1,12 +1,20 @@ package xyz.didx.passkit import cats.data.EitherT -import cats.effect.{IO, Resource} -import de.brendamour.jpasskit.{PKBarcode, PKField, PKPass} -import de.brendamour.jpasskit.enums.{PKBarcodeFormat, PKPassType} +import cats.effect.IO +import cats.effect.Resource +import de.brendamour.jpasskit.PKBarcode +import de.brendamour.jpasskit.PKField +import de.brendamour.jpasskit.PKPass +import de.brendamour.jpasskit.enums.PKBarcodeFormat +import de.brendamour.jpasskit.enums.PKPassType import de.brendamour.jpasskit.passes.PKGenericPass -import de.brendamour.jpasskit.signing.{PKFileBasedSigningUtil, PKPassTemplateFolder, PKSigningInformationUtil} -import pureconfig.{ConfigReader, ConfigSource} +import de.brendamour.jpasskit.signing.PKFileBasedSigningUtil +import de.brendamour.jpasskit.signing.PKPassTemplateFolder +import de.brendamour.jpasskit.signing.PKSigningInformationUtil +import org.typelevel.log4cats.Logger +import pureconfig.ConfigReader +import pureconfig.ConfigSource import pureconfig.generic.derivation.default.* import java.awt.Color @@ -14,7 +22,6 @@ import java.io.* import java.net.URL import java.nio.charset.Charset import scala.jdk.CollectionConverters.* -import org.typelevel.log4cats.Logger import scala.util.Try case class PasskitConfig( diff --git a/src/main/scala/xyz/didx/registry/RegistryClient.scala b/src/main/scala/xyz/didx/registry/RegistryClient.scala index 4ad4829..5ff392d 100644 --- a/src/main/scala/xyz/didx/registry/RegistryClient.scala +++ b/src/main/scala/xyz/didx/registry/RegistryClient.scala @@ -3,16 +3,16 @@ package xyz.didx.registry import cats.data.EitherT import cats.effect.IO import cats.implicits.* -import xyz.didx.registry.RegistryResponse -import xyz.didx.registry.RegistryResponseCodec.registryResponseDecoder import io.circe.* import io.circe.parser.* import io.circe.syntax.* +import org.typelevel.log4cats.Logger +import org.typelevel.log4cats.slf4j.Slf4jLogger import sttp.client3.* import sttp.client3.circe.* import sttp.model.* -import org.typelevel.log4cats.Logger -import org.typelevel.log4cats.slf4j.Slf4jLogger +import xyz.didx.registry.RegistryResponse +import xyz.didx.registry.RegistryResponseCodec.registryResponseDecoder final case class RegistryClient(registryUrl: String, apiKey: String): given logger: Logger[IO] = Slf4jLogger.getLogger[IO] diff --git a/src/main/scala/xyz/didx/registry/RegistryResponse.scala b/src/main/scala/xyz/didx/registry/RegistryResponse.scala index a7eef73..a3e9080 100644 --- a/src/main/scala/xyz/didx/registry/RegistryResponse.scala +++ b/src/main/scala/xyz/didx/registry/RegistryResponse.scala @@ -3,10 +3,10 @@ package xyz.didx.registry import cats.* import cats.data.OptionT import cats.syntax.all.* -import xyz.didx.didcomm.DIDDoc import io.circe.Decoder.Result -import io.circe.syntax.* import io.circe.* +import io.circe.syntax.* +import xyz.didx.didcomm.DIDDoc /* { diff --git a/src/main/scala/xyz/didx/registry/RegistryResponseCodec.scala b/src/main/scala/xyz/didx/registry/RegistryResponseCodec.scala index 0efee05..d107ee7 100644 --- a/src/main/scala/xyz/didx/registry/RegistryResponseCodec.scala +++ b/src/main/scala/xyz/didx/registry/RegistryResponseCodec.scala @@ -1,13 +1,15 @@ package xyz.didx.registry +import cats.* +import cats.syntax.all.* +import io.circe.Decoder +import io.circe.Encoder +import io.circe.Json import io.circe.* -import io.circe.{Decoder, Json, Encoder} import io.circe.syntax.* -import cats.syntax.all.* -import cats.* import io.circe.syntax._ -import xyz.didx.didcomm.DIDCodec.encodeDIDDoc import xyz.didx.didcomm.DIDCodec +import xyz.didx.didcomm.DIDCodec.encodeDIDDoc object RegistryResponseCodec: import io.circe.generic.auto.* From 74ac936a643c289be6a82e3a03f9677d73d1cd5e Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 09:17:47 +0200 Subject: [PATCH 05/24] =?UTF-8?q?=F0=9F=93=9D=20Added=20instructions=20for?= =?UTF-8?q?=20scalafix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index f82a60d..2501724 100644 --- a/README.md +++ b/README.md @@ -62,3 +62,7 @@ docker run -it --rm \ -e OPENAI_TOKEN='oai_key' \ ghcr.io/didx-xyz/dawn-patrol ``` + +## Scalafix + +To organise imports, while in sbt run: scalafix OrganizeImports From 6dd90de92cc770b2f9451fcd1a4f6ad1894d92d9 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 11:08:18 +0200 Subject: [PATCH 06/24] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Remove=20unused=20im?= =?UTF-8?q?ports=20in=20some=20files.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/xyz/didx/ConversationPollingHandler.scala | 8 -------- src/main/scala/xyz/didx/DawnPatrol.scala | 2 -- src/main/scala/xyz/didx/SignalBot.scala | 3 --- src/main/scala/xyz/didx/ai/AiHandler.scala | 1 - 4 files changed, 14 deletions(-) diff --git a/src/main/scala/xyz/didx/ConversationPollingHandler.scala b/src/main/scala/xyz/didx/ConversationPollingHandler.scala index ccf8ef7..3f24c6f 100644 --- a/src/main/scala/xyz/didx/ConversationPollingHandler.scala +++ b/src/main/scala/xyz/didx/ConversationPollingHandler.scala @@ -4,26 +4,18 @@ import cats.data.EitherT import cats.effect.FiberIO import cats.effect.IO import cats.effect.Ref -import cats.effect.kernel.Resource import cats.implicits.* -import cats.syntax.traverse.* import io.circe.parser.* import io.circe.syntax.* import org.typelevel.log4cats.Logger -import org.typelevel.log4cats.slf4j.Slf4jLogger import sttp.client3.SttpBackend import xyz.didx.ai.AiHandler import xyz.didx.ai.model.ChatState import xyz.didx.config.ConfigReaders.* -import xyz.didx.connection.RedisStorage -import xyz.didx.didcomm.Service -import xyz.didx.didcomm.ServiceEndpointNodes import xyz.didx.didcomm.* import xyz.didx.logging.LogWriter.* import xyz.didx.messages.* -import xyz.didx.openai.OpenAIAgent import xyz.didx.passkit.PasskitAgent -import xyz.didx.registry.RegistryClient import xyz.didx.registry.* import xyz.didx.signal.SignalBot diff --git a/src/main/scala/xyz/didx/DawnPatrol.scala b/src/main/scala/xyz/didx/DawnPatrol.scala index 68a8a89..5a9e38b 100644 --- a/src/main/scala/xyz/didx/DawnPatrol.scala +++ b/src/main/scala/xyz/didx/DawnPatrol.scala @@ -1,14 +1,12 @@ package xyz.didx import cats.effect.IO import cats.effect.IOApp -import cats.effect.* import cats.effect.std.Dispatcher import fs2.Stream import org.typelevel.log4cats.Logger import org.typelevel.log4cats.slf4j.Slf4jLogger import sttp.client3.SttpBackend import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend -import xyz.didx.ConversationPollingHandler import xyz.didx.ai.handler.Opportunities import xyz.didx.config.ConfigReaders.getConf diff --git a/src/main/scala/xyz/didx/SignalBot.scala b/src/main/scala/xyz/didx/SignalBot.scala index 4f12041..5fd9ee4 100644 --- a/src/main/scala/xyz/didx/SignalBot.scala +++ b/src/main/scala/xyz/didx/SignalBot.scala @@ -6,10 +6,7 @@ import cats.effect.IO import cats.effect.Ref import cats.implicits.* import fs2.Stream -import io.circe.parser.* import io.circe.syntax.* -import org.typelevel.log4cats.Logger -import org.typelevel.log4cats.slf4j.Slf4jLogger import pureconfig.* import pureconfig.generic.derivation.default.* import sttp.client3.* diff --git a/src/main/scala/xyz/didx/ai/AiHandler.scala b/src/main/scala/xyz/didx/ai/AiHandler.scala index 42bacb7..c4002b0 100644 --- a/src/main/scala/xyz/didx/ai/AiHandler.scala +++ b/src/main/scala/xyz/didx/ai/AiHandler.scala @@ -7,7 +7,6 @@ import xyz.didx.ai.embedding.EmbeddingHandler import xyz.didx.ai.handler.ConfirmOnboardingHandler import xyz.didx.ai.handler.OnboardingHandler import xyz.didx.ai.model.ChatState -import xyz.didx.ai.model.ConfirmedOnboardingResult import xyz.didx.ai.model.OnboardingResult import scala.collection.mutable From 14db3272f3b08bf473a5107266dc9af1460faf52 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 11:32:44 +0200 Subject: [PATCH 07/24] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactored=20build.s?= =?UTF-8?q?bt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sbt | 79 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/build.sbt b/build.sbt index b7008fd..c190232 100644 --- a/build.sbt +++ b/build.sbt @@ -1,38 +1,49 @@ -scalaVersion := "3.3.1" -semanticdbEnabled := true +scalaVersion := "3.3.1" -scalacOptions ++= Seq("-Xmax-inlines", "50") +lazy val root = (project in file(".")) + .settings( + settings, + libraryDependencies ++= Seq( + "io.circe" %% "circe-core" % circeVersion, + "io.circe" %% "circe-parser" % circeVersion, + "io.circe" %% "circe-generic" % circeVersion, + "com.github.pureconfig" %% "pureconfig-core" % pureconfigVersion, + "com.github.pureconfig" %% "pureconfig-cats-effect" % pureconfigVersion, + "dev.profunktor" %% "redis4cats-effects" % redis4CatsVersion, + "dev.profunktor" %% "redis4cats-log4cats" % redis4CatsVersion, + "com.softwaremill.sttp.client4" %% "core" % "4.0.0-M6", + "com.softwaremill.sttp.client3" %% "core" % sttpClient3Version, + "com.softwaremill.sttp.client3" %% "circe" % sttpClient3Version, + "com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % sttpClient3Version, + "de.brendamour" % "jpasskit" % "0.3.3", + "com.outr" %% "scribe" % "3.12.2", + "com.lihaoyi" %% "upickle" % "3.1.3", + "dev.langchain4j" % "langchain4j" % langchain4jVersion, + "dev.langchain4j" % "langchain4j-hugging-face" % langchain4jVersion, + "com.xebia" %% "xef-scala" % xefVersion, + "com.xebia" % "xef-pdf" % xefVersion, + "com.xebia" % "xef-reasoning-jvm" % xefVersion, + "com.xebia" % "xef-openai" % xefVersion, + "ch.qos.logback" % "logback-classic" % "1.4.11", + "org.apache.logging.log4j" % "log4j-core" % "2.21.1", + "org.typelevel" %% "log4cats-slf4j" % "2.6.0", + "co.fs2" %% "fs2-core" % "3.9.3" + ) + ) -val circeVersion = "0.14.6" -val pureconfigVersion = "0.17.4" -val redis4CatsVersion = "1.5.2" -val sttpClient3Version = "3.9.1" -val langchain4jVersion = "0.23.0" -val xefVersion = "0.0.3" +lazy val circeVersion = "0.14.6" +lazy val pureconfigVersion = "0.17.4" +lazy val redis4CatsVersion = "1.5.2" +lazy val sttpClient3Version = "3.9.1" +lazy val langchain4jVersion = "0.23.0" +lazy val xefVersion = "0.0.3" -libraryDependencies ++= Seq( - "io.circe" %% "circe-core" % circeVersion, - "io.circe" %% "circe-parser" % circeVersion, - "io.circe" %% "circe-generic" % circeVersion, - "com.github.pureconfig" %% "pureconfig-core" % pureconfigVersion, - "com.github.pureconfig" %% "pureconfig-cats-effect" % pureconfigVersion, - "dev.profunktor" %% "redis4cats-effects" % redis4CatsVersion, - "dev.profunktor" %% "redis4cats-log4cats" % redis4CatsVersion, - "com.softwaremill.sttp.client4" %% "core" % "4.0.0-M6", - "com.softwaremill.sttp.client3" %% "core" % sttpClient3Version, - "com.softwaremill.sttp.client3" %% "circe" % sttpClient3Version, - "com.softwaremill.sttp.client3" %% "async-http-client-backend-cats" % sttpClient3Version, - "de.brendamour" % "jpasskit" % "0.3.3", - "com.outr" %% "scribe" % "3.12.2", - "com.lihaoyi" %% "upickle" % "3.1.3", - "dev.langchain4j" % "langchain4j" % langchain4jVersion, - "dev.langchain4j" % "langchain4j-hugging-face" % langchain4jVersion, - "com.xebia" %% "xef-scala" % xefVersion, - "com.xebia" % "xef-pdf" % xefVersion, - "com.xebia" % "xef-reasoning-jvm" % xefVersion, - "com.xebia" % "xef-openai" % xefVersion, - "ch.qos.logback" % "logback-classic" % "1.4.11", - "org.apache.logging.log4j" % "log4j-core" % "2.21.1", - "org.typelevel" %% "log4cats-slf4j" % "2.6.0", - "co.fs2" %% "fs2-core" % "3.9.3" +lazy val compilerOptions = Seq("-Xmax-inlines", "50") + +lazy val commonSettings = Seq( + scalacOptions ++= compilerOptions ) + +lazy val scalafixSettings = Seq(semanticdbEnabled := true) + +lazy val settings = commonSettings ++ scalafixSettings From 2afe40615abb543579a6baaf83b108f6723957d0 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 11:58:08 +0200 Subject: [PATCH 08/24] =?UTF-8?q?=F0=9F=91=B7=20Added=20more=20settings=20?= =?UTF-8?q?to=20build.sbt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sbt | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/build.sbt b/build.sbt index c190232..5214e13 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,12 @@ scalaVersion := "3.3.1" +lazy val circeVersion = "0.14.6" +lazy val pureconfigVersion = "0.17.4" +lazy val redis4CatsVersion = "1.5.2" +lazy val sttpClient3Version = "3.9.1" +lazy val langchain4jVersion = "0.23.0" +lazy val xefVersion = "0.0.3" + lazy val root = (project in file(".")) .settings( settings, @@ -31,14 +38,18 @@ lazy val root = (project in file(".")) ) ) -lazy val circeVersion = "0.14.6" -lazy val pureconfigVersion = "0.17.4" -lazy val redis4CatsVersion = "1.5.2" -lazy val sttpClient3Version = "3.9.1" -lazy val langchain4jVersion = "0.23.0" -lazy val xefVersion = "0.0.3" - -lazy val compilerOptions = Seq("-Xmax-inlines", "50") +// Settings +lazy val compilerOptions = Seq( + "-Xmax-inlines", + "50", + "-unchecked", // Enable additional warnings where generated code depends on assumptions. + "-feature", // Emit warning and location for usages of features that should be imported explicitly. + "-language:existentials", // Existential types (besides wildcard types) can be written and inferred + "-language:higherKinds", // Allow higher-kinded types + "-language:implicitConversions", // Allow definition of implicit functions called views + "-language:postfixOps", // Allow postfix operator notation, such as 1 to 10 toList (not recommended) + "-deprecation" +) lazy val commonSettings = Seq( scalacOptions ++= compilerOptions From 49c07fbcb71c5bd0580d8be5367d802fefe7efb3 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:08:27 +0200 Subject: [PATCH 09/24] =?UTF-8?q?=F0=9F=91=B7=20Run=20organiseImports=20ch?= =?UTF-8?q?eck=20in=20github=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86f6dbf..2b0eb08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,12 @@ jobs: - uses: actions/checkout@v4 - uses: coursier/cache-action@v6 - uses: VirtusLab/scala-cli-setup@v1 + - uses: actions/setup-java@v3 with: jvm: 21 - run: scala-cli fmt --check . - run: scala-cli --power test . + - run: sbt scalafix OrganiseImports build: name: Build and push Docker From 9379b45b0a7c44a109f5ac7b59d0cb33ff17dc48 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:12:39 +0200 Subject: [PATCH 10/24] =?UTF-8?q?=F0=9F=91=B7=20Added=20distribution=20val?= =?UTF-8?q?ue=20for=20java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b0eb08..8f50b3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: - uses: VirtusLab/scala-cli-setup@v1 - uses: actions/setup-java@v3 with: + distribution: 'adopt' jvm: 21 - run: scala-cli fmt --check . - run: scala-cli --power test . From c2d3b545bc7de7389108e4b31722f5494bdc82bd Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:26:25 +0200 Subject: [PATCH 11/24] =?UTF-8?q?=F0=9F=91=B7=20Added=20zulu=20java=20dist?= =?UTF-8?q?robution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f50b3d..542f274 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: - uses: VirtusLab/scala-cli-setup@v1 - uses: actions/setup-java@v3 with: - distribution: 'adopt' + distribution: 'zulu' jvm: 21 - run: scala-cli fmt --check . - run: scala-cli --power test . From 3a33a9f13ff27d60441624fa7937c16cebaa887a Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:29:44 +0200 Subject: [PATCH 12/24] =?UTF-8?q?=F0=9F=91=B7=20Replaced=20jvm=20with=20ja?= =?UTF-8?q?va-version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 542f274..7385dfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'zulu' - jvm: 21 + java-version: 21 - run: scala-cli fmt --check . - run: scala-cli --power test . - run: sbt scalafix OrganiseImports From 158a9a4a2485bb7b9a0cb8e0bf7642fc8676625e Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:38:17 +0200 Subject: [PATCH 13/24] =?UTF-8?q?=F0=9F=91=B7=20Fixed=20scalafix=20rule=20?= =?UTF-8?q?for=20the=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7385dfb..3cfa27f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: java-version: 21 - run: scala-cli fmt --check . - run: scala-cli --power test . - - run: sbt scalafix OrganiseImports + - run: sbt "scalafix OrganizeImports" build: name: Build and push Docker From c138cd39ed295482c8790e8a835dad4c620d41e6 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:42:39 +0200 Subject: [PATCH 14/24] =?UTF-8?q?=F0=9F=A7=AA=20Ensure=20scalafix=20is=20e?= =?UTF-8?q?nforced?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/xyz/didx/DawnPatrol.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/scala/xyz/didx/DawnPatrol.scala b/src/main/scala/xyz/didx/DawnPatrol.scala index 5a9e38b..34cc0aa 100644 --- a/src/main/scala/xyz/didx/DawnPatrol.scala +++ b/src/main/scala/xyz/didx/DawnPatrol.scala @@ -2,13 +2,14 @@ package xyz.didx import cats.effect.IO import cats.effect.IOApp import cats.effect.std.Dispatcher +import xyz.didx.config.ConfigReaders.getConf + import fs2.Stream import org.typelevel.log4cats.Logger import org.typelevel.log4cats.slf4j.Slf4jLogger import sttp.client3.SttpBackend import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend import xyz.didx.ai.handler.Opportunities -import xyz.didx.config.ConfigReaders.getConf import scala.concurrent.duration.* From 0330d492e5043e50ebab44f583b9d727f23c473d Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:52:37 +0200 Subject: [PATCH 15/24] =?UTF-8?q?=F0=9F=91=B7=20Add=20--check=20flag=20to?= =?UTF-8?q?=20scalafix=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3cfa27f..e5d1cf2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: java-version: 21 - run: scala-cli fmt --check . - run: scala-cli --power test . - - run: sbt "scalafix OrganizeImports" + - run: sbt "scalafix --check OrganizeImports" build: name: Build and push Docker From f4880c1ae8223a8be48b308130ca1635324f3c39 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 12:55:26 +0200 Subject: [PATCH 16/24] =?UTF-8?q?=F0=9F=91=B7=20Ran=20OrganizeImports=20so?= =?UTF-8?q?=20workfow=20check=20will=20pass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/scala/xyz/didx/DawnPatrol.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/scala/xyz/didx/DawnPatrol.scala b/src/main/scala/xyz/didx/DawnPatrol.scala index 34cc0aa..5a9e38b 100644 --- a/src/main/scala/xyz/didx/DawnPatrol.scala +++ b/src/main/scala/xyz/didx/DawnPatrol.scala @@ -2,14 +2,13 @@ package xyz.didx import cats.effect.IO import cats.effect.IOApp import cats.effect.std.Dispatcher -import xyz.didx.config.ConfigReaders.getConf - import fs2.Stream import org.typelevel.log4cats.Logger import org.typelevel.log4cats.slf4j.Slf4jLogger import sttp.client3.SttpBackend import sttp.client3.asynchttpclient.cats.AsyncHttpClientCatsBackend import xyz.didx.ai.handler.Opportunities +import xyz.didx.config.ConfigReaders.getConf import scala.concurrent.duration.* From e82c395fdf1533e11df0ba3dd4a3911b5d9b44c4 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 14:00:10 +0200 Subject: [PATCH 17/24] =?UTF-8?q?=F0=9F=91=B7=20Try=20to=20switch=20to=20s?= =?UTF-8?q?calafmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5d1cf2..33ed47b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: with: distribution: 'zulu' java-version: 21 - - run: scala-cli fmt --check . + - run: scalafmt --check - run: scala-cli --power test . - run: sbt "scalafix --check OrganizeImports" From 2b88e469952c989a60919ced63422a7e9addb581 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 14:35:26 +0200 Subject: [PATCH 18/24] =?UTF-8?q?=F0=9F=9A=9A=20Moved=20tests=20to=20folde?= =?UTF-8?q?r=20that=20sbt=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/{ => scala/xyz/didx}/DawnSpec.test.scala | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/test/{ => scala/xyz/didx}/DawnSpec.test.scala (100%) diff --git a/src/test/DawnSpec.test.scala b/src/test/scala/xyz/didx/DawnSpec.test.scala similarity index 100% rename from src/test/DawnSpec.test.scala rename to src/test/scala/xyz/didx/DawnSpec.test.scala From 138784ecad07210bf10be931fc0d97288582a7dc Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 14:36:05 +0200 Subject: [PATCH 19/24] =?UTF-8?q?=E2=9E=95=20Added=20test=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sbt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5214e13..5f2e61b 100644 --- a/build.sbt +++ b/build.sbt @@ -34,7 +34,8 @@ lazy val root = (project in file(".")) "ch.qos.logback" % "logback-classic" % "1.4.11", "org.apache.logging.log4j" % "log4j-core" % "2.21.1", "org.typelevel" %% "log4cats-slf4j" % "2.6.0", - "co.fs2" %% "fs2-core" % "3.9.3" + "co.fs2" %% "fs2-core" % "3.9.3", + "org.typelevel" %% "munit-cats-effect" % "2.0.0-M4" % "test" ) ) From c92aff802fe9607de2b391223231961438763a24 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Wed, 6 Dec 2023 14:36:38 +0200 Subject: [PATCH 20/24] =?UTF-8?q?=F0=9F=91=B7=20Switched=20to=20sbt=20for?= =?UTF-8?q?=20running=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33ed47b..c028ada 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,8 +35,8 @@ jobs: with: distribution: 'zulu' java-version: 21 - - run: scalafmt --check - - run: scala-cli --power test . + - run: scala-cli fmt --check . + - run: sbt "test" - run: sbt "scalafix --check OrganizeImports" build: From 774bebba54f3fec1064d8a5da21a7eef34afe3f6 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 7 Dec 2023 15:58:05 +0200 Subject: [PATCH 21/24] :heavy_plus_sign: add scalafmt plugin --- project/plugins.sbt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project/plugins.sbt b/project/plugins.sbt index 00d82eb..c961009 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1 +1,3 @@ +addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") + addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") From 3da0c833a3beebae7f0f92a82fb825fc87c77e21 Mon Sep 17 00:00:00 2001 From: ff137 Date: Thu, 7 Dec 2023 16:00:33 +0200 Subject: [PATCH 22/24] :art: --- src/main/scala/xyz/didx/DawnPatrol.scala | 1 + src/main/scala/xyz/didx/SignalBot.scala | 7 ++++--- .../xyz/didx/ai/openai/OpenAIMessage.scala | 21 +------------------ .../scala/xyz/didx/didcomm/DIDCodec.scala | 4 +--- src/test/scala/xyz/didx/DawnSpec.test.scala | 2 +- 5 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/main/scala/xyz/didx/DawnPatrol.scala b/src/main/scala/xyz/didx/DawnPatrol.scala index 5a9e38b..af2fe1e 100644 --- a/src/main/scala/xyz/didx/DawnPatrol.scala +++ b/src/main/scala/xyz/didx/DawnPatrol.scala @@ -1,4 +1,5 @@ package xyz.didx + import cats.effect.IO import cats.effect.IOApp import cats.effect.std.Dispatcher diff --git a/src/main/scala/xyz/didx/SignalBot.scala b/src/main/scala/xyz/didx/SignalBot.scala index 5fd9ee4..5c066d0 100644 --- a/src/main/scala/xyz/didx/SignalBot.scala +++ b/src/main/scala/xyz/didx/SignalBot.scala @@ -7,11 +7,12 @@ import cats.effect.Ref import cats.implicits.* import fs2.Stream import io.circe.syntax.* -import pureconfig.* +import pureconfig.ConfigReader +import pureconfig.ConfigSource import pureconfig.generic.derivation.default.* import sttp.client3.* -import sttp.client3.circe.* -import sttp.model.* +import sttp.client3.circe.asJson +import sttp.model.StatusCode import xyz.didx.messages.SignalMessage import xyz.didx.messages.SignalMessageCodec.signalMessageDecoder import xyz.didx.messages.SignalMessageCodec.signalSendMessage diff --git a/src/main/scala/xyz/didx/ai/openai/OpenAIMessage.scala b/src/main/scala/xyz/didx/ai/openai/OpenAIMessage.scala index 9f24ad8..3f920cd 100644 --- a/src/main/scala/xyz/didx/ai/openai/OpenAIMessage.scala +++ b/src/main/scala/xyz/didx/ai/openai/OpenAIMessage.scala @@ -1,24 +1,5 @@ package xyz.didx.openai -/* { - "id": "cmpl-6nognZq5jEzrrxtd7hkQ06vQcNOAu", - "object": "text_completion", - "created": 1677330941, - "model": "text-davinci-003", - "choices": [ - { - "text": "\nIt's important to remember to renew your drivers license before it expires. You can usually renew your license online or in person at your local DMV. Make sure to check the expiration date on your license and plan ahead so you don't miss the deadline.", - "index": 0, - "logprobs": null, - "finish_reason": "stop" - } - ], - "usage": { - "prompt_tokens": 9, - "completion_tokens": 51, - "total_tokens": 60 - } -} - */ + final case class OpenAIRequest( model: String = "text-davinci-003", prompt: String, diff --git a/src/main/scala/xyz/didx/didcomm/DIDCodec.scala b/src/main/scala/xyz/didx/didcomm/DIDCodec.scala index f0b3b56..fe6d196 100644 --- a/src/main/scala/xyz/didx/didcomm/DIDCodec.scala +++ b/src/main/scala/xyz/didx/didcomm/DIDCodec.scala @@ -1,4 +1,5 @@ package xyz.didx.didcomm + import cats.* import cats.syntax.all.* import io.circe.Decoder.Result @@ -13,9 +14,6 @@ import xyz.didx.didcomm.ServiceEndpointURI import xyz.didx.didcomm.VerificationMethod import java.net.URI -//import xyz.didx.didcomm.VerificationMethodType - -//import summon.{Decoder => _, _} object DIDCodec: given encodeDIDDoc: Encoder[DIDDoc] = diff --git a/src/test/scala/xyz/didx/DawnSpec.test.scala b/src/test/scala/xyz/didx/DawnSpec.test.scala index 10ce984..9fcb1ea 100644 --- a/src/test/scala/xyz/didx/DawnSpec.test.scala +++ b/src/test/scala/xyz/didx/DawnSpec.test.scala @@ -1,4 +1,5 @@ package xyz.didx + import munit.CatsEffectSuite class DawnSpec extends CatsEffectSuite { @@ -7,5 +8,4 @@ class DawnSpec extends CatsEffectSuite { println(x) assertEquals(1, 1) } - } From 8af60d720ec6dfeba0b2f20982ba49740f48494d Mon Sep 17 00:00:00 2001 From: laderlappen Date: Thu, 7 Dec 2023 16:22:26 +0200 Subject: [PATCH 23/24] =?UTF-8?q?=F0=9F=91=B7=20Try=20workflow=20without?= =?UTF-8?q?=20extra=20java=20setup=20step.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c028ada..3c78c0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,10 +31,8 @@ jobs: - uses: actions/checkout@v4 - uses: coursier/cache-action@v6 - uses: VirtusLab/scala-cli-setup@v1 - - uses: actions/setup-java@v3 with: - distribution: 'zulu' - java-version: 21 + jvm: 21 - run: scala-cli fmt --check . - run: sbt "test" - run: sbt "scalafix --check OrganizeImports" From 72134b26c5c8c73a82942525f50205b00a679270 Mon Sep 17 00:00:00 2001 From: laderlappen Date: Thu, 7 Dec 2023 16:38:49 +0200 Subject: [PATCH 24/24] =?UTF-8?q?=F0=9F=91=B7=20Removed=20quotes=20for=20s?= =?UTF-8?q?bt=20test=20command.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c78c0e..362bb58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: with: jvm: 21 - run: scala-cli fmt --check . - - run: sbt "test" + - run: sbt test - run: sbt "scalafix --check OrganizeImports" build: