Skip to content

fix(cli,build): init . sanitization + render-worker rebuild trigger#32

Merged
robinbraemer merged 1 commit into
mainfrom
fix/init-sanitization-cargo-rebuild
Apr 28, 2026
Merged

fix(cli,build): init . sanitization + render-worker rebuild trigger#32
robinbraemer merged 1 commit into
mainfrom
fix/init-sanitization-cargo-rebuild

Conversation

@robinbraemer

Copy link
Copy Markdown
Member

Closes spike-1 #4 + #5.

  • akua init . now derives the package name from the canonicalized CWD basename and sanitizes (lowercase, non-[a-z0-9_-]_, strip leading -). Pre-fix it wrote name = "." and the next render failed with E_MANIFEST_PARSE.
  • crates/akua-cli/build.rs watches akua-render-worker/src and akua-core/src and warns when sources are newer than the staged worker .wasm — the long-standing CLAUDE.md gotcha.

Test plan

  • 5 unit tests in main.rs (sanitize variants + derive matrix)
  • 2 integration tests in cli_integration.rs (init . end-to-end)
  • All 22 existing CLI integration tests still green

Closes spike-1 issues #4 and #5.

#4 — `akua init .` no longer writes `name = "."` to akua.toml. The
CLI dispatcher now routes `.` / `./` / path-like / non-identifier
args through a sanitizer that derives a valid package name from
the canonicalized basename (lowercase, non-`[a-z0-9_-]` → `_`,
strip leading hyphens). Bare-identifier args keep the original
behavior. Path-like args get path target + sanitized basename name.

#5 — touching files under `crates/akua-render-worker/src` or
`crates/akua-core/src` now re-runs `crates/akua-cli/build.rs`
(via additional `cargo:rerun-if-changed=` directives). The script
also walks both trees for `.rs` files newer than the staged
worker `.wasm` and emits a `cargo:warning=` naming the offender,
so contributors see a clear "run task build:render-worker first"
without having to remember the gotcha.

Tests:
- 5 unit tests in main.rs covering sanitize_package_name +
  derive_init_target_and_name across the 4 input shapes.
- 2 integration tests in cli_integration.rs covering `init .`
  end-to-end (record correct name, sanitize Capitals.With.Dots).
- All 22 prior cli_integration tests still green.

CLAUDE.md gotcha note replaced with the new behavior.
@robinbraemer robinbraemer merged commit 23e0d72 into main Apr 28, 2026
2 checks passed
@robinbraemer robinbraemer deleted the fix/init-sanitization-cargo-rebuild branch April 28, 2026 11:07
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.

1 participant