Skip to content

Commit f662994

Browse files
committed
Release 0.7.0
1 parent f51b7f4 commit f662994

File tree

15 files changed

+93
-40
lines changed

15 files changed

+93
-40
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ the project!
2323
To test Ox, use the following dependency, using either [sbt](https://www.scala-sbt.org):
2424

2525
```scala
26-
"com.softwaremill.ox" %% "core" % "0.6.1"
26+
"com.softwaremill.ox" %% "core" % "0.7.0"
2727
```
2828

2929
Or [scala-cli](https://scala-cli.virtuslab.org):
3030

3131
```scala
32-
//> using dep "com.softwaremill.ox::core:0.6.1"
32+
//> using dep "com.softwaremill.ox::core:0.7.0"
3333
```
3434

3535
Documentation is available at [https://ox.softwaremill.com](https://ox.softwaremill.com), ScalaDocs can be browsed at [https://javadoc.io](https://www.javadoc.io/doc/com.softwaremill.ox).

generated-doc/out/basics/error-handling.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,17 @@ assert(v1.orThrow == 10)
207207
val v2: Either[Exception, Int] = Left(new RuntimeException("boom!"))
208208
v2.orThrow // throws RuntimeException("boom!")
209209
```
210+
211+
## Mapping errors
212+
213+
When an `Either` is used to represent errors, these can be mapped by using `.left.map`. This can be used to entirely
214+
transform the error type, or eliminate some errors in case e.g. a union type is used. For example:
215+
216+
```scala
217+
val e: Either[IllegalArgumentException | String, String] = ???
218+
219+
val e2: Either[String, String] = e.left.map {
220+
case e: IllegalArgumentException => s"Illegal argument: ${e.getMessage}"
221+
case other: String => other
222+
}
223+
```

generated-doc/out/index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Safe direct-style concurrency and resiliency for Scala on the JVM. Requires JDK 21 & Scala 3.
44

5-
To start using Ox, add the `com.softwaremill.ox::core:0.6.1` [dependency](info/dependency.md) to your project.
5+
To start using Ox, add the `com.softwaremill.ox::core:0.7.0` [dependency](info/dependency.md) to your project.
66
Then, take a look at the tour of Ox, or follow one of the topics listed in the menu to get to know Ox's API!
77

88
In addition to this documentation, ScalaDocs can be browsed at [https://javadoc.io](https://www.javadoc.io/doc/com.softwaremill.ox).
@@ -22,6 +22,7 @@ In addition to this documentation, ScalaDocs can be browsed at [https://javadoc.
2222
info/community-support
2323
info/dependency
2424
info/scope
25+
info/ai
2526
2627
.. toctree::
2728
:maxdepth: 2

generated-doc/out/info/ai.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Using Ox with AI tools
2+
3+
If you are using AI coding assistants or agents, they will only be as useful, as much they know about Ox. Since Ox's documentation (especially the latest features) might not be in the LLMs training set, it might be useful to let the models know about Ox's capabilities and the preferred way that Ox should be used.
4+
5+
Since this is an evolving field, there's no one standard yet, and there are several options to explore. Below you can find a short summary.
6+
7+
## Cursor documentation indexing
8+
9+
If you are using [Cursor](https://www.cursor.com), you might try the [built-in documentation indexing](https://docs.cursor.com/guides/advanced/working-with-documentation) feature. Select `@Docs` -> `Add New Doc` in the editor, or go to `Cursor` -> `Settings` -> `Cursor Settings` -> `Indexing & Docs` -> `Add docs`. In the address field, enter [https://ox.softwaremill.com/latest/](https://ox.softwaremill.com/latest/). After a while, the Ox documentation should be indexed.
10+
11+
Information is scarce on how this actually works, but by analogy with code indexing, this seems to store embeddings of documentation pages on Cursor's servers, which are then used for relevant user queries. Or using AI-terminology, it's a [RAG system](https://cloud.google.com/use-cases/retrieval-augmented-generation?hl=en).
12+
13+
You can then use `@Docs Ox` to hint to Cursor to use Ox's documentation.
14+
15+
## Cursor rules
16+
17+
[Rules](https://docs.cursor.com/context/rules) provide guidance to the LLMs, either by adding the content of the rule as context for each request, by having the models request the content of a rule, or by explicitly mentioning it in the prompt.
18+
19+
Rules might be project-scoped or tied to the user. Project rules are stored in a `.cursor/rules` directory. Ox contains a set of rules, which might guide LLMs when working with Ox-based applications. To include them in your project, simply fetch the current rules into your `.cursor/rules/` directory:
20+
21+
```
22+
git clone --depth=1 --filter=blob:none --sparse https://github.com/softwaremill/ox.git && cd ox && git sparse-checkout set cursor-rules && mkdir -p ../.cursor/rules && cp cursor-rules/*.mdc ../.cursor/rules && cd .. && rm -rf ox
23+
```
24+
25+
Some of the rules are automatically applied to the context (to let the model know about basic capabilities), but most are agent-requested, which exposes only the rule descriptions to the context. If needed, the agent can fetch the entire rule content, to explore a subject in more depth.
26+
27+
## Context7
28+
29+
[Context7](https://github.com/upstash/context7) is an open-source MCP (Model Context Protocol) server which aims to provide up-to-date documentation for AI coding assistants. You can use the managed, global MCP server, or run your own.
30+
31+
Ox's documentation is [indexed on the global server](https://context7.com/softwaremill/ox). To reference it in a prompt, be sure to add `use context7`.
32+
33+
## llms.txt
34+
35+
Ox currently does not server a [llms.txt](https://llmstxt.org) file, as it is currently unclear if there are any tools using this. However, if support for this format becomes more widespread, we'll automate generation of this file as well.

generated-doc/out/info/dependency.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ To use ox core in your project, add:
44

55
```scala
66
// sbt dependency
7-
"com.softwaremill.ox" %% "core" % "0.6.1"
7+
"com.softwaremill.ox" %% "core" % "0.7.0"
88

99
// scala-cli dependency
10-
//> using dep com.softwaremill.ox::core:0.6.1
10+
//> using dep com.softwaremill.ox::core:0.7.0
1111
```
1212

1313
Ox core depends only on the Java [jox](https://github.com/softwaremill/jox) project, where channels are implemented. There are no other direct or transitive dependencies.

generated-doc/out/integrations/cron4s.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "cron" % "0.6.1"
6+
"com.softwaremill.ox" %% "cron" % "0.7.0"
77
```
88

99
This module allows to run schedules based on cron expressions from [cron4s](https://github.com/alonsodomin/cron4s).
@@ -62,6 +62,6 @@ repeatWithErrorMode(UnionMode[String])(RepeatConfig(CronSchedule.fromCronExpr(cr
6262

6363
// repeat with retry inside
6464
repeat(RepeatConfig(CronSchedule.fromCronExpr(cronExpr))) {
65-
retry(Schedule.exponentialBackoff(100.millis).maxRepeats(3))(directOperation)
65+
retry(Schedule.exponentialBackoff(100.millis).maxRetries(3))(directOperation)
6666
}
6767
```

generated-doc/out/integrations/kafka.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "kafka" % "0.6.1"
6+
"com.softwaremill.ox" %% "kafka" % "0.7.0"
77
```
88

99
`Flow`s which read from a Kafka topic, mapping stages and drains which publish to Kafka topics are available through

generated-doc/out/integrations/mdc-logback.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "mdc-logback" % "0.6.1"
6+
"com.softwaremill.ox" %% "mdc-logback" % "0.7.0"
77
```
88

99
Ox provides support for setting inheritable MDC (mapped diagnostic context) values, when using the [Logback](https://logback.qos.ch)

generated-doc/out/integrations/otel-context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Dependency:
44

55
```scala
6-
"com.softwaremill.ox" %% "otel-context" % "0.6.1"
6+
"com.softwaremill.ox" %% "otel-context" % "0.7.0"
77
```
88

99
When using the default OpenTelemetry context-propagation mechanisms, which rely on thread-local storage, the context

generated-doc/out/scheduling/repeat.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ def eitherOperation: Either[String, Int] = ???
5353
def unionOperation: String | Int = ???
5454

5555
// various operation definitions - same syntax
56-
repeat(Schedule.immediate.maxRepeats(3))(directOperation)
57-
repeatEither(Schedule.immediate.maxRepeats(3))(eitherOperation)
56+
repeat(Schedule.immediate.maxAttempts(3))(directOperation)
57+
repeatEither(Schedule.immediate.maxAttempts(3))(eitherOperation)
5858

5959
// various schedules
60-
repeat(Schedule.fixedInterval(100.millis).maxRepeats(3))(directOperation)
61-
repeat(Schedule.fixedInterval(100.millis).maxRepeats(3).withInitialDelay(50.millis))(
60+
repeat(Schedule.fixedInterval(100.millis).maxAttempts(3))(directOperation)
61+
repeat(Schedule.fixedInterval(100.millis).maxAttempts(3).withInitialDelay(50.millis))(
6262
directOperation)
6363

6464
// infinite repeats with a custom strategy
@@ -67,11 +67,11 @@ repeat(RepeatConfig(Schedule.fixedInterval(100.millis))
6767
.copy(shouldContinueOnResult = customStopStrategy))(directOperation)
6868

6969
// custom error mode
70-
repeatWithErrorMode(UnionMode[String])(Schedule.fixedInterval(100.millis).maxRepeats(3))(
70+
repeatWithErrorMode(UnionMode[String])(Schedule.fixedInterval(100.millis).maxAttempts(3))(
7171
unionOperation)
7272

7373
// repeat with retry inside
74-
repeat(Schedule.fixedInterval(100.millis).maxRepeats(3)) {
75-
retry(Schedule.exponentialBackoff(100.millis).maxRepeats(3))(directOperation)
74+
repeat(Schedule.fixedInterval(100.millis).maxAttempts(3)) {
75+
retry(Schedule.exponentialBackoff(100.millis).maxAttempts(3))(directOperation)
7676
}
7777
```

0 commit comments

Comments
 (0)