Skip to content

feat(worldedit): add nexus-worldedit module -- WE/FAWE facade + SchematicService - #10

Merged
BadgersMC merged 7 commits into
BadgersMC:mainfrom
Hermes-Enthusia:feat/nexus-worldedit
May 31, 2026
Merged

BadgersMC merged 7 commits into
BadgersMC:mainfrom
Hermes-Enthusia:feat/nexus-worldedit

Conversation

@Hermes-Enthusia

@Hermes-Enthusia Hermes-Enthusia commented May 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add nexus-worldedit -- a new Nexus module that wraps WorldEdit and FastAsyncWorldEdit behind a single facade API.

What's in this module

SchematicService (interface)

  • capture(regionId, world, outputFile): Result -- copy a region to a schematic file
  • restore(regionId, world, sourceFile, async): Result -- paste a schematic back to a region (async by default)
  • Sealed Result type: Success / Failure(cause)

WorldEditAdapter (object)

  • Auto-detects FAWE at runtime via class-loading; falls back to vanilla WE
  • saveSchematic(clipboard, file) -- writes any WE clipboard to .schem
  • loadSchematic(file) -- reads .schem back into a WE clipboard
  • Both WE and FAWE are compileOnly deps -- zero transitive jar bloat

Dependencies

Dep Scope Version
worldedit-bukkit compileOnly 7.3.0
FastAsyncWorldEdit-Bukkit compileOnly 2.11.0
paper-api compileOnly 1.21.11

Why this module

  • EnthusiaMarket needs schematic capture/restore for stall reset (TDD-270/271)
  • Consumers depend only on nexus-worldedit, never on WE/FAWE directly
  • WE/FAWE are server-provided; compileOnly keeps shadow jars clean

Features

  • nexus-worldedit: add SchematicService interface to capture and restore regions to/from schematic files with a sealed Result type (Success / Failure)
  • nexus-worldedit: add WorldEditAdapter facade that auto-detects FastAsyncWorldEdit at runtime and falls back to vanilla WorldEdit (isFawePresent)
  • nexus-worldedit: provide saveSchematic and loadSchematic helpers to serialize/deserialize WorldEdit Clipboard to .schem files; declare WE/FAWE and Paper as compileOnly dependencies to avoid bundling

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 30, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@BadgersMC, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 58 minutes and 38 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 1bd6aa54-629c-4c7d-92e9-5be0440a8268

📥 Commits

Reviewing files that changed from the base of the PR and between 031a7cd and dd86f87.

📒 Files selected for processing (11)
  • .github/workflows/publish.yml
  • build.gradle.kts
  • nexus-core/src/main/kotlin/net/badgersmc/nexus/config/ConfigLoader.kt
  • nexus-core/src/main/kotlin/net/badgersmc/nexus/config/ConfigManager.kt
  • nexus-core/src/main/kotlin/net/badgersmc/nexus/core/NexusContext.kt
  • nexus-i18n/src/test/kotlin/net/badgersmc/nexus/i18n/TestLangHost.kt
  • nexus-paper/src/main/kotlin/net/badgersmc/nexus/paper/commands/PaperCommandScanner.kt
  • nexus-paper/src/test/kotlin/net/badgersmc/nexus/paper/commands/PaperCommandScannerTest.kt
  • nexus-permissions/src/main/kotlin/net/badgersmc/nexus/permissions/PaperPluginYmlMerger.kt
  • nexus-persistence/src/main/kotlin/net/badgersmc/nexus/persistence/MigrationRunner.kt
  • nexus-resources/src/main/kotlin/net/badgersmc/nexus/resources/ResourceExtractor.kt

Walkthrough

Adds a nexus-worldedit subproject with build/config, a SchematicService interface (capture/restore with sealed Result), WorldEditAdapter for schematic I/O, and CI changes: Detekt plugin/config and a CI job wired into the publish workflow.

Changes

WorldEdit integration

Layer / File(s) Summary
Module configuration and dependencies
settings.gradle.kts, nexus-worldedit/build.gradle.kts
Module registered in settings; subproject build config adds Kotlin/JVM plugins, repositories (Paper/EngineHub/FAWE), dependencies, test wiring, JVM toolchain 21, and Maven publication metadata.
SchematicService contract
nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/SchematicService.kt
New interface declares capture(regionId, world, outputFile) and restore(regionId, world, sourceFile, async = true) returning sealed Result (Success/Failure).
WorldEditAdapter clipboard integration
nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/WorldEditAdapter.kt
Singleton facade detects FAWE presence; saveSchematic/loadSchematic resolve ClipboardFormats from filenames (save falls back to "schem"), create parent dirs, and perform stream-backed clipboard write/read, failing fast on unknown formats.

CI and static analysis

Layer / File(s) Summary
GitHub Actions: CI / Publish workflow
.github/workflows/publish.yml
Workflow renamed and extended: triggers on push/PR/main/manual and on tag pushes; adds ci job (Detekt, Semgrep, Trivy) and gates publish job to run for tag refs after ci.
Root build: Detekt plugin and wiring
build.gradle.kts
Adds io.gitlab.arturbosch.detekt plugin (apply false) and configures Detekt across subprojects, pointing to config/detekt/detekt.yml and making check depend on detekt where present.
Detekt ruleset and reports
config/detekt/detekt.yml
New detailed Detekt configuration with global options, enabled processors/reports, and targeted rule activation/configuration across complexity, coroutines, exceptions, naming, performance, potential-bugs, and style rule groups.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • BadgersMC/Nexus#4: Overlaps on changes to the publish workflow and CI/publish setup.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title accurately summarizes the core addition: a new nexus-worldedit module with a facade (WorldEditAdapter) and domain interface (SchematicService) for schematic operations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codacy-production

codacy-production Bot commented May 30, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 4 high · 1 medium · 2 minor

Alerts:
⚠ 7 issues (≤ 0 issues of at least minor severity)

Results:
7 new issues

Category Results
Security 4 high
CodeStyle 1 minor
Complexity 1 medium
1 minor

View in Codacy

🟢 Metrics -25 complexity · -1 duplication

Metric Results
Complexity -25
Duplication -1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@BadgersMC
BadgersMC marked this pull request as ready for review May 30, 2026 12:29
@BadgersMC

Copy link
Copy Markdown
Owner

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@nexus-worldedit/build.gradle.kts`:
- Line 18: The Paper API dependency in build.gradle.kts is targeting the wrong
snapshot version; change the compileOnly dependency declaration that references
io.papermc.paper:paper-api (the compileOnly(...) line) to use
1.21.1-R0.1-SNAPSHOT if the PR intends to target 1.21.1, or alternatively update
the PR description/objective to state 1.21.11 if you intend to keep
1.21.11-R0.1-SNAPSHOT so the declared version and PR objective match.

In
`@nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/SchematicService.kt`:
- Around line 11-12: The interface SchematicService currently takes a
regionId:String for capture and restore but provides no way to resolve that ID
to WorldEdit BlockVector3 coordinates; update the contract so implementers can
obtain region bounds: either (A) add a dependency parameter to the interface
(e.g., a RegionResolver or RegionRegistry) and change the signatures of
capture/restore to accept that resolver or require the resolver via constructor,
documenting the expected regionId format and lookup behavior, or (B) replace
regionId:String with explicit coordinate parameters (min: BlockVector3, max:
BlockVector3) or provide overloaded methods capture(regionId:String,
world:World, outputFile:File, resolver:RegionResolver) and
capture(min:BlockVector3, max:BlockVector3, world:World, outputFile:File) (and
equivalent restore overloads) so callers can supply concrete BlockVector3
bounds; ensure Result-returning methods are updated to reference these new
parameters and document the resolution contract if keeping regionId.

In
`@nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/WorldEditAdapter.kt`:
- Around line 20-26: The lazy property isFawePresent in WorldEditAdapter.kt is
computed but never used; either remove the property or make its intent explicit:
if it’s meant for external callers keep it public and add KDoc explaining its
purpose (e.g., "True if FastAsyncWorldEdit is loaded; exposed for plugins to
check FAWE presence") or mark it internal/private or add a TODO comment for
planned FAWE-specific behavior; update or remove the property accordingly so no
unused symbol remains.
- Line 36: In WorldEditAdapter, replace the unchecked call to
file.parentFile?.mkdirs() with an explicit check: call file.parentFile?.let { if
(!it.exists() && !it.mkdirs()) throw IOException("Failed to create parent
directory for ${file.name} at ${it.path}") } (or log and rethrow) before calling
file.outputStream(); this ensures mkdirs() failures are detected and surfaces a
clear error instead of letting file.outputStream() fail later.
- Line 18: The private val log declared in WorldEditAdapter
(Logger.getLogger(WorldEditAdapter::class.java.name)) is unused; remove this
unused property or start using it in methods that need logging. Locate the 'log'
field in the WorldEditAdapter class and either delete the declaration or replace
usages where debugging/info/error messages are appropriate (e.g., inside
functions that handle WorldEdit events or adapter initialization) by calling
log.info/log.warning/log.severe as needed to surface runtime details.
- Around line 5-9: Remove the unused imports from WorldEditAdapter.kt: delete
the unused BlockVector3, Plugin, and Logger import statements so only actually
referenced imports remain (e.g., keep org.bukkit.World and java.io.File if
used); update the import block accordingly to eliminate unused imports and run a
quick build/lint to confirm no remaining unused symbols.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 86a577e6-6bdb-4a52-8d44-ea4025027002

📥 Commits

Reviewing files that changed from the base of the PR and between 0697f66 and fe2c061.

📒 Files selected for processing (4)
  • nexus-worldedit/build.gradle.kts
  • nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/SchematicService.kt
  • nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/WorldEditAdapter.kt
  • settings.gradle.kts


dependencies {
api(project(":nexus-core"))
compileOnly("io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check available Paper API versions for 1.21.x in the PaperMC repository
curl -s 'https://repo.papermc.io/service/rest/v1/search?repository=maven-public&group=io.papermc.paper&name=paper-api&maven.baseVersion=1.21.1' | jq -r '.items[].version' | head -10

Repository: BadgersMC/Nexus

Length of output: 182


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== nexus-worldedit/build.gradle.kts (around line 18) =="
nl -ba nexus-worldedit/build.gradle.kts | sed -n '1,60p'

echo
echo "== PaperMC repo search: baseVersion=1.21.1 (raw first 500 chars) =="
URL='https://repo.papermc.io/service/rest/v1/search?repository=maven-public&group=io.papermc.paper&name=paper-api&maven.baseVersion=1.21.1'
curl -sS "$URL" | head -c 500; echo

echo
echo "== PaperMC repo search: baseVersion=1.21.11 (raw first 500 chars) =="
URL2='https://repo.papermc.io/service/rest/v1/search?repository=maven-public&group=io.papermc.paper&name=paper-api&maven.baseVersion=1.21.11'
curl -sS "$URL2" | head -c 500; echo

echo
echo "== PaperMC repo search: baseVersion=1.21.11-R0.1-SNAPSHOT (raw first 500 chars) =="
URL3='https://repo.papermc.io/service/rest/v1/search?repository=maven-public&group=io.papermc.paper&name=paper-api&maven.baseVersion=1.21.11-R0.1-SNAPSHOT'
curl -sS "$URL3" | head -c 500; echo

Repository: BadgersMC/Nexus

Length of output: 176


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== nexus-worldedit/build.gradle.kts (with line numbers, first 60 lines) =="
awk '{printf "%d:%s\n", NR, $0}' nexus-worldedit/build.gradle.kts | sed -n '1,60p'

echo
echo "== PaperMC repo search: baseVersion=1.21.1 (raw first 500 chars) =="
URL='https://repo.papermc.io/service/rest/v1/search?repository=maven-public&group=io.papermc.paper&name=paper-api&maven.baseVersion=1.21.1'
curl -sS "$URL" | head -c 500; echo

echo
echo "== PaperMC repo search: baseVersion=1.21.11 (raw first 500 chars) =="
URL2='https://repo.papermc.io/service/rest/v1/search?repository=maven-public&group=io.papermc.paper&name=paper-api&maven.baseVersion=1.21.11'
curl -sS "$URL2" | head -c 500; echo

echo
echo "== PaperMC repo search: baseVersion=1.21.11-R0.1-SNAPSHOT (raw first 500 chars) =="
URL3='https://repo.papermc.io/service/rest/v1/search?repository=maven-public&group=io.papermc.paper&name=paper-api&maven.baseVersion=1.21.11-R0.1-SNAPSHOT'
curl -sS "$URL3" | head -c 500; echo

Repository: BadgersMC/Nexus

Length of output: 1539


🌐 Web query:

PaperMC repo.papermc.io service rest v1 search repository=maven-public group=io.papermc.paper name=paper-api how to query versions parameters maven.baseVersion

💡 Result:

Use PaperMC’s downloads service API (not the Maven repo “search” endpoint) to query available project versions and build IDs. 1) List all supported Minecraft versions (“versions”) for a PaperMC project Call: https://papermc.io/api/v1/paper This returns JSON with a versions array (examples in docs include 1.13.2, 1.13.1, 1.13-pre7, etc.) [1]. 2) Get build IDs for a specific Minecraft version Call: https://papermc.io/api/v1/paper/{minecraftVersion} The docs state the project-version URL returns all build IDs targeting that Minecraft version, and that the “build ids” are integers in v1 [1]. Example form: https://papermc.io/api/v1/paper/1.13.2 3) Use “latest” to avoid choosing a version/build manually The docs say you can use the static keyword latest in place of a specific build to get the latest build for that specific release of Minecraft, e.g.: https://papermc.io/api/v1/paper/{minecraftVersion}/latest/download [1]. 4) Maven coordinates in your build (“maven.baseVersion”) For Maven/Gradle dependency notation, PaperMC’s docs show using the paper-api artifact with a version pattern such as: compileOnly("io.papermc.paper:paper-api:26.1.2.build.+") [2]. However, the docs do not define a parameter named “maven.baseVersion”, and the PaperMC downloads API provides Minecraft-version selection and build download URLs directly rather than a “maven.baseVersion” parameter [1]. So, if your goal is “how do I query versions parameters maven.baseVersion” for PaperMC, the supported approach is: - query available Minecraft versions via the REST endpoint /api/v1/paper [1] - query builds for one Minecraft version via /api/v1/paper/{version} [1] - then use the resulting build IDs/versions to construct the Maven dependency version string pattern you choose (PaperMC shows using a wildcard build selector like.build.+) [2]. If you tell me what build system/plugin you’re using that mentions “maven.baseVersion” (e.g., a specific Paper plugin toolchain or Gradle/Maven helper), I can map the API response fields to exactly what that parameter expects.

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== PaperMC API /api/v1/paper =="
curl -sS 'https://papermc.io/api/v1/paper' | head -c 500; echo

echo
echo "== PaperMC API /api/v1/paper/1.21.1 =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.1' | head -c 2000; echo

echo
echo "== PaperMC API /api/v1/paper/1.21.11 =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.11' | head -c 2000; echo

echo
echo "== PaperMC API /api/v1/paper/1.21.1/latest =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.1/latest' | head -c 2000; echo

Repository: BadgersMC/Nexus

Length of output: 6300


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== /api/v1/paper (first 500 chars) =="
curl -sS 'https://papermc.io/api/v1/paper' | head -c 500; echo

echo
echo "== /api/v1/paper/1.21.1 (first 3000 chars) =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.1' | head -c 3000; echo

echo
echo "== /api/v1/paper/1.21.11 (first 3000 chars) =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.11' | head -c 3000; echo

echo
echo "== /api/v1/paper/1.21.1/latest (first 3000 chars) =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.1/latest' | head -c 3000; echo

Repository: BadgersMC/Nexus

Length of output: 6327


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== /api/v1/paper (first 500 chars) =="
curl -sS 'https://papermc.io/api/v1/paper' | head -c 500; echo

echo
echo "== /api/v1/paper/1.21.1 (first 3000 chars) =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.1' | head -c 3000; echo

echo
echo "== /api/v1/paper/1.21.11 (first 3000 chars) =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.11' | head -c 3000; echo

echo
echo "== /api/v1/paper/1.21.1/latest (first 3000 chars) =="
curl -sS 'https://papermc.io/api/v1/paper/1.21.1/latest' | head -c 3000; echo

Repository: BadgersMC/Nexus

Length of output: 6327


🏁 Script executed:

#!/bin/bash
set -euo pipefail

BASE='https://repo.papermc.io/repository/maven-public'
META="$BASE/io/papermc/paper/paper-api/maven-metadata.xml"

echo "== Fetch maven-metadata.xml for io.papermc.paper:paper-api =="
curl -sS "$META" | head -n 40

echo
echo "== Look for versions containing 1.21.11 or 1.21.1 =="
curl -sS "$META" | rg -n "1\.21\.(11|1)([^0-9]|$)" || true

echo
echo "== Exact match search for 1.21.11-R0.1-SNAPSHOT and 1.21.1-R0.1-SNAPSHOT =="
curl -sS "$META" | rg -n "1\.21\.11-R0\.1-SNAPSHOT|1\.21\.1-R0\.1-SNAPSHOT" || true

Repository: BadgersMC/Nexus

Length of output: 2512


nexus-worldedit/build.gradle.kts:18 — Paper API version mismatch (1.21.11 vs PR-stated 1.21.1); both exist, so no resolution failure but you’re targeting a different API snapshot. The Maven metadata for io.papermc.paper:paper-api contains both 1.21.1-R0.1-SNAPSHOT and 1.21.11-R0.1-SNAPSHOT, so 1.21.11-R0.1-SNAPSHOT won’t be missing—but it contradicts the PR objective. Fix by updating the dependency to 1.21.1-R0.1-SNAPSHOT or updating the PR objective to 1.21.11.

🧰 Tools
🪛 GitHub Check: Codacy Static Code Analysis

[warning] 18-18: nexus-worldedit/build.gradle.kts#L18
A gitleaks generic-api-key was detected which attempts to identify hard-coded credentials.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@nexus-worldedit/build.gradle.kts` at line 18, The Paper API dependency in
build.gradle.kts is targeting the wrong snapshot version; change the compileOnly
dependency declaration that references io.papermc.paper:paper-api (the
compileOnly(...) line) to use 1.21.1-R0.1-SNAPSHOT if the PR intends to target
1.21.1, or alternatively update the PR description/objective to state 1.21.11 if
you intend to keep 1.21.11-R0.1-SNAPSHOT so the declared version and PR
objective match.

- Remove unused imports (BlockVector3, Plugin, Logger) from WorldEditAdapter
- Remove unused log field from WorldEditAdapter
- Add KDoc to isFawePresent explaining it is a public API for consumers
- Check mkdirs() return value and fail fast with a clear message
- Add KDoc to SchematicService explaining regionId resolution contract (WG RegionContainer)
- Keep paper-api at 1.21.11-R0.1-SNAPSHOT (correct server target; CR comment was wrong)
- Root build.gradle.kts: detekt 1.23.8 via subprojects block
- config/detekt/detekt.yml: shared rule config, thresholds tuned for plugin code
- publish.yml: add ci job with detekt + semgrep + trivy; publish needs ci
@BadgersMC

Copy link
Copy Markdown
Owner

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented May 30, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/publish.yml:
- Around line 3-10: Add a concurrency block to the workflow to cancel superseded
branch/PR runs: insert a concurrency mapping with group set to the workflow+ref
(e.g., group: ${{ github.workflow }}-${{ github.ref }}) and set
cancel-in-progress to only true for pull_request events (e.g.,
cancel-in-progress: ${{ github.event_name == 'pull_request' }}), ensuring tag
refs (publish runs) are not canceled; place this block at the top-level of the
publish.yml workflow alongside the existing on: section.
- Around line 12-14: The workflow currently grants packages: write at the
top-level permissions which gives all jobs (including ci) unnecessary write
access; modify .github/workflows/publish.yml to keep permissions: contents: read
at the top level and remove packages: write there, then add a permissions block
inside the publish job (the job named "publish") that includes packages: write
(and contents: read if needed) so only the publish job has write access to
GitHub Packages.
- Around line 45-55: Replace the mutable Trivy action reference and fix the
gating flags: change uses: aquasecurity/trivy-action@master to a pinned release
tag or commit SHA (pin to a specific version) and decide whether this scan
should block publishing — if it should enforce failures remove
continue-on-error: true and keep exit-code: '1'; if it should be advisory, keep
continue-on-error: true and remove exit-code: '1'. Ensure you update the Trivy
step that contains scan-type, scan-ref, format, exit-code, severity,
ignore-unfixed to reflect this choice.
- Around line 19-21: The CI job's if condition excludes tag pushes so when a
v*.*.* tag is pushed the ci job is skipped and publish (which has needs: ci) is
also skipped; update the ci job's if expression (the existing "if:
(github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) ||
github.event_name == 'pull_request'") to include tag pushes (for example change
to "if: github.event_name == 'push' || github.event_name == 'pull_request'") so
ci runs on tag pushes too, or alternatively add an explicit branch to allow
refs/tags/* (e.g. include startsWith(github.ref, 'refs/tags/')) so the ci job
runs and publish.needs: ci will be satisfied.

In `@build.gradle.kts`:
- Around line 52-63: Remove the redundant wiring that manually makes the detekt
task depend on check (the tasks.matching { it.name == "detekt" } ... block)
because the detekt plugin already integrates with Gradle's check lifecycle; also
update the misleading comment at the top ("Apply detekt to every subproject that
has Kotlin source") to accurately reflect that you are applying the
"io.gitlab.arturbosch.detekt" plugin unconditionally (or change to only apply
conditionally if you prefer by checking for Kotlin sources/plugins), leaving the
DetektExtension configuration block (config.setFrom, buildUponDefaultConfig,
allRules) intact.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9c8781ed-21a1-44c9-9461-78f8b4a774cc

📥 Commits

Reviewing files that changed from the base of the PR and between 0697f66 and 031a7cd.

📒 Files selected for processing (7)
  • .github/workflows/publish.yml
  • build.gradle.kts
  • config/detekt/detekt.yml
  • nexus-worldedit/build.gradle.kts
  • nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/SchematicService.kt
  • nexus-worldedit/src/main/kotlin/net/badgersmc/nexus/worldedit/WorldEditAdapter.kt
  • settings.gradle.kts

Comment on lines 3 to +10
on:
push:
branches: [main]
tags:
- 'v*.*.*' # v1.11.0, v1.12.0-rc1, etc.
workflow_dispatch: # allow manual publishes from the Actions tab
- 'v*.*.*'
pull_request:
branches: [main]
workflow_dispatch:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

publish.yml:3-10 — no concurrency group; rapid PR pushes pile up redundant CI runs.

Add cancel-in-progress concurrency so superseded PR/branch runs are cancelled, saving runner minutes:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

Keep cancel-in-progress off for tag refs so a publish in flight isn't killed.

🧰 Tools
🪛 zizmor (1.25.2)

[warning] 3-10: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting

(concurrency-limits)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish.yml around lines 3 - 10, Add a concurrency block
to the workflow to cancel superseded branch/PR runs: insert a concurrency
mapping with group set to the workflow+ref (e.g., group: ${{ github.workflow
}}-${{ github.ref }}) and set cancel-in-progress to only true for pull_request
events (e.g., cancel-in-progress: ${{ github.event_name == 'pull_request' }}),
ensuring tag refs (publish runs) are not canceled; place this block at the
top-level of the publish.yml workflow alongside the existing on: section.

Comment on lines 12 to 14
permissions:
contents: read
packages: write # required for maven.pkg.github.com push

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

publish.yml:12-14 — packages: write is workflow-wide; only publish needs it.

The ci job runs on every PR (including forks once enabled) and gets write access to GitHub Packages it never uses. Scope the token down: keep contents: read at the top, grant packages: write only on the publish job.

Proposed fix
 permissions:
   contents: read
-  packages: write     # required for maven.pkg.github.com push

 jobs:
   ci:
     runs-on: ubuntu-latest
     ...

   publish:
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write     # required for maven.pkg.github.com push
     if: startsWith(github.ref, 'refs/tags/v')
     needs: ci
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
permissions:
contents: read
packages: write # required for maven.pkg.github.com push
permissions:
contents: read
jobs:
ci:
runs-on: ubuntu-latest
...
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write # required for maven.pkg.github.com push
if: startsWith(github.ref, 'refs/tags/v')
needs: ci
🧰 Tools
🪛 zizmor (1.25.2)

[error] 14-14: overly broad permissions (excessive-permissions): packages: write is overly broad at the workflow level

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish.yml around lines 12 - 14, The workflow currently
grants packages: write at the top-level permissions which gives all jobs
(including ci) unnecessary write access; modify .github/workflows/publish.yml to
keep permissions: contents: read at the top level and remove packages: write
there, then add a permissions block inside the publish job (the job named
"publish") that includes packages: write (and contents: read if needed) so only
the publish job has write access to GitHub Packages.

Comment on lines +19 to +21
if: >-
(github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) ||
github.event_name == 'pull_request'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

In GitHub Actions, if a job is skipped due to its if condition, is a downstream job that uses needs on it also skipped by default?

💡 Result:

Yes, if a job is skipped, any downstream job that depends on it (via the needs keyword) is also skipped by default [1]. This occurs because GitHub Actions defaults to requiring successful completion of all jobs listed in the needs property [1]. When a prerequisite job is skipped or fails, the default behavior is to skip all dependent jobs in the dependency chain [1]. To override this default behavior and allow a dependent job to run even if a prerequisite job was skipped, you must include a conditional expression in the downstream job's if property [1]. A common approach is to use the always status check function, often combined with a check on the result of the required job, such as: if: ${{ always && (needs.job_name.result == 'success' || needs.job_name.result == 'skipped') }} By explicitly adding this condition, you instruct the GitHub Actions runner to evaluate the job's execution requirements differently than the default success-only criteria [1].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE=".github/workflows/publish.yml"
if [ ! -f "$FILE" ]; then
  echo "Missing $FILE"
  exit 1
fi
nl -ba "$FILE" | sed -n '1,200p'

Repository: BadgersMC/Nexus

Length of output: 102


🏁 Script executed:

#!/bin/bash
set -euo pipefail
FILE=".github/workflows/publish.yml"
[ -f "$FILE" ] || { echo "Missing $FILE"; exit 1; }
cat -n "$FILE" | sed -n '1,160p'

Repository: BadgersMC/Nexus

Length of output: 5109


.github/workflows/publish.yml:19-21 — Tag pushes skip ci, so publish (needs: ci) is skipped and nothing is published.

On v*.*.* tag pushes, ci’s if evaluates false (it excludes refs/tags/*), so ci is skipped; with publish.needs: ci, GitHub Actions skips publish by default even though publish.if is true.

Proposed fix
   ci:
     runs-on: ubuntu-latest
     if: >-
-      (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) ||
-      github.event_name == 'pull_request'
+      github.event_name == 'push' ||
+      github.event_name == 'pull_request'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if: >-
(github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) ||
github.event_name == 'pull_request'
ci:
runs-on: ubuntu-latest
if: >-
github.event_name == 'push' ||
github.event_name == 'pull_request'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish.yml around lines 19 - 21, The CI job's if
condition excludes tag pushes so when a v*.*.* tag is pushed the ci job is
skipped and publish (which has needs: ci) is also skipped; update the ci job's
if expression (the existing "if: (github.event_name == 'push' &&
!startsWith(github.ref, 'refs/tags/')) || github.event_name == 'pull_request'")
to include tag pushes (for example change to "if: github.event_name == 'push' ||
github.event_name == 'pull_request'") so ci runs on tag pushes too, or
alternatively add an explicit branch to allow refs/tags/* (e.g. include
startsWith(github.ref, 'refs/tags/')) so the ci job runs and publish.needs: ci
will be satisfied.

Comment thread .github/workflows/publish.yml Resolved
Comment thread build.gradle.kts Resolved
BadgersMC and others added 3 commits May 30, 2026 18:15
- pin aquasecurity/trivy-action to 0.28.0 (was @master, mutable)
- resolve Trivy gating contradiction: drop exit-code so it is
  advisory-only, consistent with Semgrep
- remove redundant detekt->check wiring (plugin wires it by default)
  and fix the misleading subproject comment

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
PR BadgersMC#10 introduced detekt to CI, which surfaced 22 latent violations in
modules unrelated to the worldedit work. Fix them so the CI detekt gate
passes (behavior preserved; all module tests green):

- nexus-core: drop redundant printStackTrace calls (ConfigManager),
  remove unused logger (NexusContext), extract value conversion out of
  loadFromMap to cut cyclomatic complexity (ConfigLoader)
- nexus-i18n: rename StubJavaPlugin.kt -> TestLangHost.kt to match the
  declared class (MatchingDeclarationName)
- nexus-paper: suppress fixture-only warnings on TestCommand; extract
  buildParameter from processClass to satisfy ThrowsCount
- nexus-permissions: replace jump-heavy loop with firstOrNull
- nexus-persistence: split discover() into scanJars/scanExplodedDirs and
  move SQL splitting into a StatementSplitter state machine
- nexus-resources: convert jar/exploded-dir extraction loops to sequence
  pipelines

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The previous pin @0.28.0 failed to resolve — aquasecurity/trivy-action
tags carry a leading v.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@BadgersMC
BadgersMC merged commit 82cfd4c into BadgersMC:main May 31, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants