Skip to content

Commit fab035e

Browse files
authored
feat: add 5 new TOML filters (ollama, nx, gradle, spring-boot, jira) (#635)
* feat: add 5 new TOML built-in filters (ollama, nx, gradle, spring-boot, jira) New filters for commands not covered by Rust modules: - ollama: strip ANSI spinners, keep final text response (#624) - nx: strip Nx monorepo noise, keep build results (#444) - gradle/gradlew: strip UP-TO-DATE tasks, keep build summary (#147) - spring-boot: strip banner and verbose logs, keep startup/errors (#147) - jira: strip blanks, truncate wide columns (#524) All 5 filters pass inline tests via rtk verify (123/123). Updated builtin filter count: 47 -> 52. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * feat: add 5 more TOML filters (turbo, mise, just, task, yadm) New filters for task runners and git wrapper: - turbo: strip cache/Tasks/Duration noise, keep task output (#531) - mise: strip install/download progress, keep task results (#607) - just: strip blanks and recipe headers, keep output (#607) - task: strip task headers and up-to-date lines, keep results (#607) - yadm: strip hint lines, compact git-like output (#567) All verified with fake binaries through catch-all TOML engine. 137/137 TOML tests pass, 934 Rust tests pass. Updated builtin filter count: 52 -> 57. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> --------- Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
1 parent 91b96bf commit fab035e

11 files changed

Lines changed: 270 additions & 5 deletions

File tree

‎src/filters/gradle.toml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[filters.gradle]
2+
description = "Compact Gradle build output — strip progress, keep tasks and errors"
3+
match_command = "^(gradle|gradlew|\\./)gradlew?\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^> Configuring project",
8+
"^> Resolving dependencies",
9+
"^> Transform ",
10+
"^Download(ing)?\\s+http",
11+
"^\\s*<-+>\\s*$",
12+
"^> Task :.*UP-TO-DATE$",
13+
"^> Task :.*NO-SOURCE$",
14+
"^> Task :.*FROM-CACHE$",
15+
"^Starting a Gradle Daemon",
16+
"^Daemon will be stopped",
17+
]
18+
truncate_lines_at = 150
19+
max_lines = 50
20+
on_empty = "gradle: ok"
21+
22+
[[tests.gradle]]
23+
name = "strips UP-TO-DATE tasks, keeps build result"
24+
input = "> Configuring project :app\n> Task :app:compileJava UP-TO-DATE\n> Task :app:compileKotlin UP-TO-DATE\n> Task :app:test\n\n3 tests completed, 1 failed\n\nBUILD FAILED in 12s"
25+
expected = "> Task :app:test\n3 tests completed, 1 failed\nBUILD FAILED in 12s"
26+
27+
[[tests.gradle]]
28+
name = "clean build preserved"
29+
input = "BUILD SUCCESSFUL in 8s\n7 actionable tasks: 7 executed"
30+
expected = "BUILD SUCCESSFUL in 8s\n7 actionable tasks: 7 executed"
31+
32+
[[tests.gradle]]
33+
name = "empty after stripping"
34+
input = "> Configuring project :app\n"
35+
expected = "gradle: ok"

‎src/filters/jira.toml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[filters.jira]
2+
description = "Compact Jira CLI output — strip verbose metadata, keep essentials"
3+
match_command = "^jira\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^\\s*--",
8+
]
9+
truncate_lines_at = 120
10+
max_lines = 40
11+
12+
[[tests.jira]]
13+
name = "strips blank lines from issue list"
14+
input = "TYPE\tKEY\tSUMMARY\tSTATUS\n\nStory\tPROJ-123\tAdd login feature\tIn Progress\n\nBug\tPROJ-456\tFix crash on startup\tOpen"
15+
expected = "TYPE\tKEY\tSUMMARY\tSTATUS\nStory\tPROJ-123\tAdd login feature\tIn Progress\nBug\tPROJ-456\tFix crash on startup\tOpen"
16+
17+
[[tests.jira]]
18+
name = "single issue view"
19+
input = "KEY: PROJ-123\nSummary: Add login feature\nStatus: In Progress\nAssignee: john@example.com"
20+
expected = "KEY: PROJ-123\nSummary: Add login feature\nStatus: In Progress\nAssignee: john@example.com"

‎src/filters/just.toml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[filters.just]
2+
description = "Compact just task runner output — strip recipe headers, keep command output"
3+
match_command = "^just\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^\\s*Available recipes:",
8+
"^\\s*just --list",
9+
]
10+
truncate_lines_at = 150
11+
max_lines = 50
12+
13+
[[tests.just]]
14+
name = "preserves command output"
15+
input = "cargo test\n\ntest result: ok. 42 passed; 0 failed\n"
16+
expected = "cargo test\ntest result: ok. 42 passed; 0 failed"
17+
18+
[[tests.just]]
19+
name = "preserves error output"
20+
input = "error: Compilation failed\nsrc/main.rs:10: expected `;`"
21+
expected = "error: Compilation failed\nsrc/main.rs:10: expected `;`"
22+
23+
[[tests.just]]
24+
name = "empty input"
25+
input = ""
26+
expected = ""

‎src/filters/mise.toml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[filters.mise]
2+
description = "Compact mise task runner output — strip status lines, keep task results"
3+
match_command = "^mise\\s+(run|exec|install|upgrade)\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^mise\\s+(trust|install|upgrade).*✓",
8+
"^mise\\s+Installing\\s",
9+
"^mise\\s+Downloading\\s",
10+
"^mise\\s+Extracting\\s",
11+
"^mise\\s+\\w+@[\\d.]+ installed",
12+
]
13+
truncate_lines_at = 150
14+
max_lines = 50
15+
on_empty = "mise: ok"
16+
17+
[[tests.mise]]
18+
name = "strips install noise, keeps task output"
19+
input = "mise Installing node@20.0.0\nmise Downloading node@20.0.0\nmise Extracting node@20.0.0\nmise node@20.0.0 installed\n\nlint check passed\n2 warnings found"
20+
expected = "lint check passed\n2 warnings found"
21+
22+
[[tests.mise]]
23+
name = "preserves error output"
24+
input = "mise run lint\nError: biome check failed\nsrc/index.ts:5 — unused variable"
25+
expected = "mise run lint\nError: biome check failed\nsrc/index.ts:5 — unused variable"
26+
27+
[[tests.mise]]
28+
name = "empty after stripping"
29+
input = "mise trust ~/dev/.mise.toml ✓\nmise install node@20 ✓\n"
30+
expected = "mise: ok"

‎src/filters/nx.toml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[filters.nx]
2+
description = "Compact Nx monorepo output — strip task graph noise, keep results"
3+
match_command = "^(pnpm\\s+)?nx\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^\\s*>\\s*NX\\s+Running target",
8+
"^\\s*>\\s*NX\\s+Nx read the output",
9+
"^\\s*>\\s*NX\\s+View logs",
10+
"^———————",
11+
"^—————————",
12+
"^\\s+Nx \\(powered by",
13+
]
14+
truncate_lines_at = 150
15+
max_lines = 60
16+
17+
[[tests.nx]]
18+
name = "strips Nx noise, keeps build output"
19+
input = "\n > NX Running target build for project myapp\n\n———————————————————————————————————————\nCompiled successfully.\nOutput: dist/apps/myapp\n\n > NX View logs at /tmp/.nx/runs/abc123\n\n Nx (powered by computation caching)\n"
20+
expected = "Compiled successfully.\nOutput: dist/apps/myapp"
21+
22+
[[tests.nx]]
23+
name = "preserves error output"
24+
input = "ERROR: Cannot find module '@myapp/shared'\n\n > NX Running target build for project myapp\n\nFailed at step: build"
25+
expected = "ERROR: Cannot find module '@myapp/shared'\nFailed at step: build"

‎src/filters/ollama.toml‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[filters.ollama]
2+
description = "Strip ANSI spinners and cursor control from ollama output, keep final text"
3+
match_command = "^ollama\\s+run\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^[⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏\\s]*$",
7+
"^\\s*$",
8+
]
9+
10+
[[tests.ollama]]
11+
name = "strips spinner lines, keeps response"
12+
input = "⠋ \n⠙ \n⠹ \nHello! How can I help you today?"
13+
expected = "Hello! How can I help you today?"
14+
15+
[[tests.ollama]]
16+
name = "preserves multi-line response"
17+
input = "⠋ \n⠙ \nLine one of the response.\nLine two of the response."
18+
expected = "Line one of the response.\nLine two of the response."
19+
20+
[[tests.ollama]]
21+
name = "empty input"
22+
input = ""
23+
expected = ""

‎src/filters/spring-boot.toml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[filters.spring-boot]
2+
description = "Compact Spring Boot output — strip banner and verbose startup logs, keep key events"
3+
match_command = "^(mvn\\s+spring-boot:run|java\\s+-jar.*\\.jar|gradle\\s+.*bootRun)"
4+
strip_ansi = true
5+
keep_lines_matching = [
6+
"Started\\s.*\\sin\\s",
7+
"Tomcat started on port",
8+
"ERROR",
9+
"WARN",
10+
"Exception",
11+
"Caused by:",
12+
"Application run failed",
13+
"BUILD\\s",
14+
"Tests run:",
15+
"FAILURE",
16+
"listening on port",
17+
]
18+
max_lines = 30
19+
20+
[[tests.spring-boot]]
21+
name = "keeps startup summary and errors"
22+
input = " . ____ _ \n /\\\\ / ___'_ __ _ _(_)_ __ \n( ( )\\___ | '_ | '_| | '_ \\ \n \\/ ___)| |_)| | | | | || )\n ' |____| .__|_| |_|_| |_\\__|\n :: Spring Boot :: (v3.2.0)\n2024-01-01 INFO Initializing Spring\n2024-01-01 INFO Bean 'dataSource' created\n2024-01-01 INFO Tomcat started on port 8080\n2024-01-01 INFO Started MyApp in 3.2 seconds"
23+
expected = "2024-01-01 INFO Tomcat started on port 8080\n2024-01-01 INFO Started MyApp in 3.2 seconds"
24+
25+
[[tests.spring-boot]]
26+
name = "preserves errors"
27+
input = " :: Spring Boot :: (v3.2.0)\n2024-01-01 INFO Initializing Spring\n2024-01-01 ERROR Application run failed\nCaused by: java.lang.NullPointerException"
28+
expected = "2024-01-01 ERROR Application run failed\nCaused by: java.lang.NullPointerException"

‎src/filters/task.toml‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[filters.task]
2+
description = "Compact go-task output — strip task headers, keep command results"
3+
match_command = "^task\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^task: \\[.*\\] ",
8+
"^task: Task .* is up to date",
9+
]
10+
truncate_lines_at = 150
11+
max_lines = 50
12+
on_empty = "task: ok"
13+
14+
[[tests.task]]
15+
name = "strips task headers, keeps output"
16+
input = "task: [build] go build ./...\n\ntask: [test] go test ./...\nok myapp 0.5s\n\ntask: Task \"lint\" is up to date"
17+
expected = "ok myapp 0.5s"
18+
19+
[[tests.task]]
20+
name = "preserves error output"
21+
input = "task: [build] go build ./...\n./main.go:10: undefined: foo\ntask: Failed to run task \"build\": exit status 1"
22+
expected = "./main.go:10: undefined: foo\ntask: Failed to run task \"build\": exit status 1"
23+
24+
[[tests.task]]
25+
name = "all up to date"
26+
input = "task: Task \"build\" is up to date\ntask: Task \"lint\" is up to date\n"
27+
expected = "task: ok"

‎src/filters/turbo.toml‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[filters.turbo]
2+
description = "Compact Turborepo output — strip cache status noise, keep task results"
3+
match_command = "^turbo\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^\\s*cache (hit|miss|bypass)",
8+
"^\\s*\\d+ packages in scope",
9+
"^\\s*Tasks:\\s+\\d+",
10+
"^\\s*Duration:\\s+",
11+
"^\\s*Remote caching (enabled|disabled)",
12+
]
13+
truncate_lines_at = 150
14+
max_lines = 50
15+
on_empty = "turbo: ok"
16+
17+
[[tests.turbo]]
18+
name = "strips cache noise, keeps task output"
19+
input = " cache hit, replaying logs abc123\n cache miss, executing abc456\n\n3 packages in scope\n\n> myapp:build\n\nCompiled successfully.\n\nTasks: 2 successful, 2 total (1 cached)\nDuration: 3.2s"
20+
expected = "> myapp:build\nCompiled successfully."
21+
22+
[[tests.turbo]]
23+
name = "preserves error output"
24+
input = "> myapp:lint\n\nError: src/index.ts(5,1): error TS2304\n\nTasks: 0 successful, 1 total\nDuration: 1.1s"
25+
expected = "> myapp:lint\nError: src/index.ts(5,1): error TS2304"
26+
27+
[[tests.turbo]]
28+
name = "empty after stripping"
29+
input = " cache hit, replaying logs abc\n\n"
30+
expected = "turbo: ok"

‎src/filters/yadm.toml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[filters.yadm]
2+
description = "Compact yadm (git wrapper) output — same filtering as git"
3+
match_command = "^yadm\\b"
4+
strip_ansi = true
5+
strip_lines_matching = [
6+
"^\\s*$",
7+
"^\\s*\\(use \"git ",
8+
"^\\s*\\(use \"yadm ",
9+
]
10+
truncate_lines_at = 120
11+
max_lines = 40
12+
13+
[[tests.yadm]]
14+
name = "strips hint lines"
15+
input = "On branch main\nYour branch is up to date with 'origin/main'.\n\n (use \"yadm add\" to update what will be committed)\n\nChanges not staged for commit:\n modified: .bashrc"
16+
expected = "On branch main\nYour branch is up to date with 'origin/main'.\nChanges not staged for commit:\n modified: .bashrc"
17+
18+
[[tests.yadm]]
19+
name = "short output preserved"
20+
input = "Already up to date."
21+
expected = "Already up to date."

0 commit comments

Comments
 (0)