Skip to content

Multi-Module Project

DUUMBI supports multi-module projects where each module has its own graph and can import functions from other modules.

Start with a project:

Terminal window
duumbi init myapp
cd myapp

Create a new module:

Terminal window
duumbi add "create a module called 'math_ops' with functions: abs(x: i64) -> i64, max(a: i64, b: i64) -> i64"

This creates .duumbi/graph/math_ops.jsonld alongside your main.jsonld.

Each module is a separate .jsonld file in .duumbi/graph/:

.duumbi/
graph/
main.jsonld # Entry point
math_ops.jsonld # Your math module
config.toml

Reference functions from other modules using their full ID:

Terminal window
duumbi add "modify main to call math_ops/abs(-7) and print the result"

The AI generates a Call op with the cross-module reference duumbi:math_ops/abs.

DUUMBI includes standard library modules, available as @duumbi/stdlib-math:

config.toml
[dependencies]
"@duumbi/stdlib-math" = "1.0"

Install dependencies:

Terminal window
duumbi deps install

Use stdlib functions in your program:

Terminal window
duumbi add "call stdlib-math/max(10, 20) and print the result"

duumbi build automatically compiles all modules and links them:

Terminal window
duumbi build
./output

The compiler resolves cross-module references following the priority chain:

  1. Workspace.duumbi/graph/ (your own modules)
  2. Vendor.duumbi/vendor/ (pinned copies)
  3. Cache.duumbi/cache/ (downloaded from registry)
Terminal window
# Add a dependency
duumbi deps add @duumbi/stdlib-math
# List dependencies
duumbi deps list
# Show dependency tree
duumbi deps tree
# Audit lockfile integrity
duumbi deps audit