@makinzm/mille 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +77 -7
  2. package/mille.wasm +0 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,11 +18,11 @@ One TOML config. Rust-powered. CI-ready. Supports multiple languages from a sing
18
18
 
19
19
  ## What it checks
20
20
 
21
- | Check | Rust | Go | TypeScript | JavaScript | Python |
22
- |---|:---:|:---:|:---:|:---:|:---:|
23
- | Layer dependency rules (`dependency_mode`) | ✅ | ✅ | ✅ | ✅ | ✅ |
24
- | External library rules (`external_mode`) | ✅ | ✅ | ✅ | ✅ | ✅ |
25
- | DI method call rules (`allow_call_patterns`) | ✅ | ✅ | ✅ | ✅ | ✅ |
21
+ | Check | Rust | Go | TypeScript | JavaScript | Python | Java | Kotlin |
22
+ |---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
23
+ | Layer dependency rules (`dependency_mode`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
24
+ | External library rules (`external_mode`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
25
+ | DI method call rules (`allow_call_patterns`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
26
26
 
27
27
  ## Install
28
28
 
@@ -124,6 +124,22 @@ The generated config includes `allow` (inferred internal dependencies) and `exte
124
124
 
125
125
  **TypeScript/JavaScript subpath imports**: `external_allow = ["vitest"]` correctly allows both `import "vitest"` and `import "vitest/config"`. Scoped packages (`@scope/name/sub`) are matched by `"@scope/name"`.
126
126
 
127
+ **Java/Kotlin projects**: `mille init` uses `package` declarations — not directory depth — to detect layers. This works correctly for Maven's `src/main/java/com/example/myapp/domain/` as well as flat `src/domain/` layouts. `pom.xml` (Maven) and `build.gradle` + `settings.gradle` (Gradle) are read automatically to generate `[resolve.java] module_name`. Layer paths use `**/layer/**` globs so `mille check` matches regardless of the source root depth.
128
+
129
+ ```
130
+ Detected languages: java
131
+ Scanning imports...
132
+
133
+ Inferred layer structure:
134
+ domain ← (no internal dependencies)
135
+ infrastructure → domain
136
+ external: java.util.List
137
+ usecase → domain
138
+ main → domain, infrastructure, usecase
139
+
140
+ Generated 'mille.toml'
141
+ ```
142
+
127
143
  ### 2. (Or) Create `mille.toml` manually
128
144
 
129
145
  Place `mille.toml` in your project root:
@@ -284,6 +300,42 @@ external_mode = "opt-out"
284
300
  external_deny = []
285
301
  ```
286
302
 
303
+ **Java / Kotlin:**
304
+
305
+ ```toml
306
+ [project]
307
+ name = "my-java-app"
308
+ root = "."
309
+ languages = ["java"] # or ["kotlin"] for Kotlin projects
310
+
311
+ [resolve.java]
312
+ module_name = "com.example.myapp"
313
+
314
+ [[layers]]
315
+ name = "domain"
316
+ paths = ["src/domain/**"]
317
+ dependency_mode = "opt-in"
318
+ allow = []
319
+ external_mode = "opt-out"
320
+
321
+ [[layers]]
322
+ name = "usecase"
323
+ paths = ["src/usecase/**"]
324
+ dependency_mode = "opt-in"
325
+ allow = ["domain"]
326
+ external_mode = "opt-out"
327
+
328
+ [[layers]]
329
+ name = "infrastructure"
330
+ paths = ["src/infrastructure/**"]
331
+ dependency_mode = "opt-in"
332
+ allow = ["domain"]
333
+ external_mode = "opt-in"
334
+ external_allow = ["java.util.List", "java.util.Map"]
335
+ ```
336
+
337
+ > `module_name` is the base package of your project (e.g. `com.example.myapp`). Imports starting with this prefix are classified as **Internal** and matched against layer globs. All other imports (including `java.util.*` stdlib) are classified as **External** and subject to `external_allow` / `external_deny` rules.
338
+
287
339
  ### 2. Visualize with `mille analyze`
288
340
 
289
341
  Before enforcing rules, you can inspect the actual dependency graph:
@@ -364,7 +416,7 @@ Exit codes:
364
416
  |---|---|
365
417
  | `name` | Project name |
366
418
  | `root` | Root directory for analysis |
367
- | `languages` | Languages to check: `"rust"`, `"go"`, `"typescript"`, `"javascript"`, `"python"` |
419
+ | `languages` | Languages to check: `"rust"`, `"go"`, `"typescript"`, `"javascript"`, `"python"`, `"java"`, `"kotlin"` |
368
420
 
369
421
  ### `[[layers]]`
370
422
 
@@ -466,6 +518,24 @@ Use `--fail-on warning` to exit 1 even for warnings when integrating into CI gra
466
518
  | `import domain.entity` (matches `package_names`) | Internal |
467
519
  | `import os`, `import sqlalchemy` | External |
468
520
 
521
+ ### `[resolve.java]`
522
+
523
+ | Key | Description |
524
+ |---|---|
525
+ | `module_name` | Base package of your project (e.g. `com.example.myapp`). Imports starting with this prefix are classified as Internal. Generated automatically by `mille init`. |
526
+ | `pom_xml` | Path to `pom.xml` (relative to `mille.toml`). `groupId.artifactId` is used as `module_name` when `module_name` is not set. |
527
+ | `build_gradle` | Path to `build.gradle` (relative to `mille.toml`). `group` + `rootProject.name` from `settings.gradle` is used as `module_name` when `module_name` is not set. |
528
+
529
+ **How Java imports are classified:**
530
+
531
+ | Import | Classification |
532
+ |---|---|
533
+ | `import com.example.myapp.domain.User` (starts with `module_name`) | Internal |
534
+ | `import static com.example.myapp.util.Helper.method` | Internal |
535
+ | `import java.util.List`, `import org.springframework.*` | External |
536
+
537
+ > Both regular and static imports are supported. Wildcard imports (`import java.util.*`) are not yet extracted by the parser.
538
+
469
539
  ## How it Works
470
540
 
471
541
  mille uses [tree-sitter](https://tree-sitter.github.io/) for AST-based import extraction — no regex heuristics.
@@ -476,7 +546,7 @@ mille.toml
476
546
 
477
547
  Layer definitions
478
548
 
479
- Source files (*.rs, *.go, *.py, *.ts, *.js, ...)
549
+ Source files (*.rs, *.go, *.py, *.ts, *.js, *.java, ...)
480
550
  │ tree-sitter parse
481
551
 
482
552
  RawImport list
package/mille.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makinzm/mille",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "Architecture Checker — Rust-based multi-language architecture linter",
5
5
  "main": "index.js",
6
6
  "bin": {