Thank you for your interest in contributing to Duso! This document explains how the project is organized and where to make different types of changes.
We welcome your contributions! Before you open a PR, please:
Duso is organized around two core audiences: Go developers embedding Duso and script writers using the CLI.
cmd/duso/ - CLI application (entry point)
pkg/
├── script/ - Core language (lexer, parser, evaluator, builtins)
├── runtime/ - Runtime orchestration (HTTP, datastore, concurrency)
├── cli/ - CLI-specific functions (file I/O, Claude, module resolution)
├── anthropic/ - Claude API client (internal)
└── markdown/ - Markdown rendering (internal)
go-embedding/ - Go embedding examples (not embedded in binary)
examples/
├── core/ - Language feature examples (work everywhere)
└── cli/ - CLI-specific examples (file I/O, Claude)
docs/
├── embedding/ - Documentation for Go developers
└── cli/ - Documentation for script writers
vscode/ - VSCode syntax highlighting extension
Three-Layer Architecture:
pkg/script/ - Language Core (Embeddable)
pkg/runtime/ - Orchestration Layer (Embeddable)
HTTPServerValue)HTTPClientValue) - Internal, used by fetch()DatastoreValue)pkg/cli/ - CLI Features (CLI-only)
You want to add: Operators, syntax, control flow, new built-in functions
Files to modify:
pkg/script/token.go - Add token type if neededpkg/script/lexer.go - Add tokenization if neededpkg/script/parser.go - Add parsing logicpkg/script/evaluator.go - Add evaluation logicpkg/script/builtins.go - If it's a built-in functiondocs/learning-duso.md - Document the featureexamples/core/ - Add example demonstrating the featureProcess:
pkg/script/examples/core/docs/learning-duso.mdYou want to add: HTTP server enhancements, datastore features, concurrency primitives, goroutine management
Files to modify:
pkg/runtime/ - Implement the core featurepkg/cli/ - Create wrapper function(s) if needed for script usedocs/internals.md - Document the runtime architectureexamples/core/ - Add example (works in embedded and CLI contexts)Process:
pkg/runtime/pkg/cli/ to expose itpkg/cli/register.go (for CLI usage)Examples of runtime features:
pkg/runtime/http_server.go + pkg/cli/http_server.go wrapperpkg/runtime/datastore.go + pkg/cli/datastore.go wrapperpkg/runtime/goroutine_context.go + pkg/cli/run.go and pkg/cli/spawn.go wrappersYou want to add: File I/O enhancements, new Claude API patterns, module resolution improvements
Files to modify:
pkg/cli/ - Implement the featurecmd/duso/main.go - Register if neededdocs/cli/ - Document the featureexamples/cli/ - Add example (CLI-only)Process:
pkg/cli/pkg/cli/register.goexamples/cli/docs/cli/Examples of CLI-only features:
load, save, include)require)claude, conversation)env)You want embedders to: Use a pre-built function in their apps
Files to modify:
pkg/script/builtins.go - Add the functiondocs/embedding/CUSTOM_FUNCTIONS.md - Document patternsdocs/learning-duso.md - If it's a core built-inProcess:
pkg/script/builtins.goYou want to: Share a Duso module that gets included in Duso binary distributions
What you provide: Pure Duso code - no Go required
Files to modify:
duso-<modulename> on GitHub.du files with Apache 2.0 licenseProcess:
Create your module in a separate repository
duso-postgres, duso-helpers, etc.Open an issue on the Duso repository requesting review
Once approved, module is added to contrib/
Your module is frozen in time with each release
For more details: See contrib/README.md
Context: See custom distributions to understand how modules are included in binary distributions.
Files to modify:
docs/learning-duso.md - Language syntax and semanticsdocs/embedding/ - Guides for Go developersdocs/cli/ - Guides for script writersREADME.md - Project overviewProcess:
Process:
camelCase for functions/variablessnake_case for Duso language functions/examples/ for user-facing featuresfeature/add-xyz, fix/issue-123Label: feature: language
These go in pkg/script/ and may affect both embedding and CLI.
Example: "Add switch/case syntax"
Label: feature: runtime
These go in pkg/runtime/ and can be used in embedded and CLI contexts.
Example: "Add request caching to fetch()", "Add timeout to datastore operations"
Label: feature: cli
These go in pkg/cli/ and only affect CLI usage.
Example: "Add ability to set environment variables from script", "Improve module resolution for monorepos"
Label: docs
Unclear, missing, or outdated documentation.
Example: "The file I/O guide doesn't explain path resolution"
Label: bug
Something doesn't work as documented.
Provide:
git clone https://github.com/duso-org/duso
cd duso
# For maintainers only: install git hooks for automatic versioning
./git-setup.sh
# Build the CLI
./build.sh
# Run a test script
duso examples/core/basic.du
For maintainers: After cloning, run ./git-setup.sh to install git hooks for automatic versioning based on commit messages (feat:, fix:, major: prefixes).
Symlink for convenience (so you can run duso from anywhere):
ln -s $(pwd)/bin/duso /usr/local/bin/duso
# Run tests
go test ./...
# Run a specific example
duso examples/core/functions.du
# Test with verbose output
duso -v examples/core/basic.du
# Test a Go embedding example
cd go-embedding
go run ./hello-world
pkg/script/ focused on languageBe respectful, inclusive, and constructive. Welcome contributors and help them succeed.
Thank you for contributing to Duso!