@makinzm/mille 0.0.10 → 0.0.11
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.
- package/README.md +85 -4
- package/mille.wasm +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,6 +114,16 @@ Generated 'mille.toml'
|
|
|
114
114
|
|
|
115
115
|
The generated config includes `allow` (inferred internal dependencies) and `external_allow` (detected external packages) per layer. After generating, review the config and run `mille check` to see results.
|
|
116
116
|
|
|
117
|
+
**Naming in monorepos**: When multiple sub-projects contain a directory with the same name (e.g. `crawler/src/domain` and `server/src/domain`), `mille init` gives each its own layer with a distinguishing prefix (`crawler_domain`, `server_domain`). Merging is left to you.
|
|
118
|
+
|
|
119
|
+
**Excluded paths**: `mille check` automatically skips `.venv`, `venv`, `node_modules`, `target`, `dist`, `build`, and similar build/dependency directories, so generated `paths` patterns like `apps/**` are safe to use.
|
|
120
|
+
|
|
121
|
+
**Python submodule imports**: `external_allow = ["matplotlib"]` correctly allows both `import matplotlib` and `import matplotlib.pyplot`.
|
|
122
|
+
|
|
123
|
+
**Go projects**: `mille init` reads `go.mod` and generates `[resolve.go] module_name` automatically — internal module imports are classified correctly during `mille check`. External packages appear in `external_allow` with their full import paths (e.g. `"github.com/cilium/ebpf"`, `"fmt"`, `"net/http"`).
|
|
124
|
+
|
|
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
|
+
|
|
117
127
|
### 2. (Or) Create `mille.toml` manually
|
|
118
128
|
|
|
119
129
|
Place `mille.toml` in your project root:
|
|
@@ -274,7 +284,49 @@ external_mode = "opt-out"
|
|
|
274
284
|
external_deny = []
|
|
275
285
|
```
|
|
276
286
|
|
|
277
|
-
### 2.
|
|
287
|
+
### 2. Visualize with `mille analyze`
|
|
288
|
+
|
|
289
|
+
Before enforcing rules, you can inspect the actual dependency graph:
|
|
290
|
+
|
|
291
|
+
```sh
|
|
292
|
+
mille analyze # human-readable terminal output (default)
|
|
293
|
+
mille analyze --format json # machine-readable JSON graph
|
|
294
|
+
mille analyze --format dot # Graphviz DOT (pipe to: dot -Tsvg -o graph.svg)
|
|
295
|
+
mille analyze --format svg # self-contained SVG image (open in a browser)
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
Example SVG output (dark theme, green edges):
|
|
299
|
+
|
|
300
|
+
```sh
|
|
301
|
+
mille analyze --format svg > graph.svg && open graph.svg
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
`mille analyze` always exits `0` — it only visualizes, never enforces rules.
|
|
305
|
+
|
|
306
|
+
### 3. Inspect external dependencies with `mille report external`
|
|
307
|
+
|
|
308
|
+
```sh
|
|
309
|
+
mille report external # human-readable table (default)
|
|
310
|
+
mille report external --format json # machine-readable JSON
|
|
311
|
+
mille report external --output report.json --format json # write to file
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
Shows which external packages each layer actually imports — useful for auditing `external_allow` lists or documenting your dependency footprint.
|
|
315
|
+
|
|
316
|
+
Example output:
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
External Dependencies by Layer
|
|
320
|
+
|
|
321
|
+
domain (none)
|
|
322
|
+
usecase (none)
|
|
323
|
+
infrastructure database/sql
|
|
324
|
+
cmd fmt, os
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
`mille report external` always exits `0` — it only reports, never enforces rules.
|
|
328
|
+
|
|
329
|
+
### 4. Run `mille check`
|
|
278
330
|
|
|
279
331
|
```sh
|
|
280
332
|
mille check
|
|
@@ -288,12 +340,20 @@ mille check --format github-actions # GitHub Actions annotations (::error file=
|
|
|
288
340
|
mille check --format json # machine-readable JSON
|
|
289
341
|
```
|
|
290
342
|
|
|
343
|
+
Fail threshold:
|
|
344
|
+
|
|
345
|
+
```sh
|
|
346
|
+
mille check # exit 1 on error-severity violations only (default)
|
|
347
|
+
mille check --fail-on warning # exit 1 on any violation (error or warning)
|
|
348
|
+
mille check --fail-on error # explicit default — same as no flag
|
|
349
|
+
```
|
|
350
|
+
|
|
291
351
|
Exit codes:
|
|
292
352
|
|
|
293
353
|
| Code | Meaning |
|
|
294
354
|
|---|---|
|
|
295
|
-
| `0` | No violations |
|
|
296
|
-
| `1` | One or more violations
|
|
355
|
+
| `0` | No violations (or only warnings without `--fail-on warning`) |
|
|
356
|
+
| `1` | One or more violations at the configured fail threshold |
|
|
297
357
|
| `3` | Configuration file error |
|
|
298
358
|
|
|
299
359
|
## Configuration Reference
|
|
@@ -348,6 +408,27 @@ test_patterns = ["**/*_test.go", "**/*.spec.ts", "**/*.test.ts"]
|
|
|
348
408
|
- `paths`: Files that should not be analyzed at all (generated code, vendor directories, mocks)
|
|
349
409
|
- `test_patterns`: Test files that intentionally import across layers (e.g., integration tests that import both domain and infrastructure)
|
|
350
410
|
|
|
411
|
+
### `[severity]`
|
|
412
|
+
|
|
413
|
+
Control the severity level of each violation type. Violations can be `"error"`, `"warning"`, or `"info"`.
|
|
414
|
+
|
|
415
|
+
| Key | Default | Description |
|
|
416
|
+
|---|---|---|
|
|
417
|
+
| `dependency_violation` | `"error"` | Layer dependency rule violated |
|
|
418
|
+
| `external_violation` | `"error"` | External library rule violated |
|
|
419
|
+
| `call_pattern_violation` | `"error"` | DI entrypoint method call rule violated |
|
|
420
|
+
| `unknown_import` | `"warning"` | Import that could not be classified |
|
|
421
|
+
|
|
422
|
+
```toml
|
|
423
|
+
[severity]
|
|
424
|
+
dependency_violation = "warning" # treat as warning for gradual adoption
|
|
425
|
+
external_violation = "error"
|
|
426
|
+
call_pattern_violation = "error"
|
|
427
|
+
unknown_import = "warning"
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
Use `--fail-on warning` to exit 1 even for warnings when integrating into CI gradually.
|
|
431
|
+
|
|
351
432
|
### `[resolve.typescript]`
|
|
352
433
|
|
|
353
434
|
| Key | Description |
|
|
@@ -368,7 +449,7 @@ test_patterns = ["**/*_test.go", "**/*.spec.ts", "**/*.test.ts"]
|
|
|
368
449
|
|
|
369
450
|
| Key | Description |
|
|
370
451
|
|---|---|
|
|
371
|
-
| `module_name` | Go module name (matches `go.mod`) |
|
|
452
|
+
| `module_name` | Go module name (matches `go.mod`). `mille init` generates this automatically from `go.mod`. |
|
|
372
453
|
|
|
373
454
|
### `[resolve.python]`
|
|
374
455
|
|
package/mille.wasm
CHANGED
|
Binary file
|