Conversation
📝 WalkthroughWalkthroughDocumentation for an experimental embedded Go API ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
dagu-sh-docs | 3981801 | Apr 19 2026, 12:31 PM |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
getting-started/embedded.md (1)
239-239: Consider adding a brief example of worker-level overrides.The text mentions that
WorkerOptions.CoordinatorsandWorkerOptions.TLScan override the engine's distributed settings, but the example on lines 210-214 doesn't demonstrate this. Adding a brief note that workers inherit from engine options by default might improve clarity.📝 Optional clarity improvement
`WorkerOptions.Coordinators` overrides `DistributedOptions.Coordinators` when non-empty. `WorkerOptions.TLS` overrides `DistributedOptions.TLS` when non-zero. `HealthPort` starts the worker health endpoint on that port; `0` disables it. + +Workers inherit the engine's distributed options by default. Override individual fields only when the worker requires different coordinator addresses or TLS settings.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@getting-started/embedded.md` at line 239, Add a short example or sentence showing worker-level overrides: state that workers inherit engine DistributedOptions by default but if WorkerOptions.Coordinators is non-empty it overrides DistributedOptions.Coordinators for that worker, and if WorkerOptions.TLS is non-zero it overrides DistributedOptions.TLS; also clarify that HealthPort starts the worker health endpoint on the given port and 0 disables it. Reference the symbols WorkerOptions.Coordinators, DistributedOptions.Coordinators, WorkerOptions.TLS, DistributedOptions.TLS, and HealthPort when adding the note so readers can find the relevant config fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@getting-started/embedded.md`:
- Around line 15-63: The embedded Go example must be removed or replaced because
the functions dagu.New, engine.RunYAML, run.Wait, and dagu.WithParams do not
exist in the actual dagu package; either delete this example or replace it with
a working pattern (e.g., demonstrate invoking the dagu CLI via os/exec or
calling the server REST/gRPC API) and update the text to explicitly state that a
native embedding API is not yet available (referencing issue `#583`) if you keep
an aspirational sample. Ensure references to dagu.New, engine.RunYAML, run.Wait,
and dagu.WithParams are eliminated or clearly marked as future/placeholder APIs.
---
Nitpick comments:
In `@getting-started/embedded.md`:
- Line 239: Add a short example or sentence showing worker-level overrides:
state that workers inherit engine DistributedOptions by default but if
WorkerOptions.Coordinators is non-empty it overrides
DistributedOptions.Coordinators for that worker, and if WorkerOptions.TLS is
non-zero it overrides DistributedOptions.TLS; also clarify that HealthPort
starts the worker health endpoint on the given port and 0 disables it. Reference
the symbols WorkerOptions.Coordinators, DistributedOptions.Coordinators,
WorkerOptions.TLS, DistributedOptions.TLS, and HealthPort when adding the note
so readers can find the relevant config fields.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d654a994-6128-4607-905c-30b4a5f9150d
📒 Files selected for processing (2)
.vitepress/config.jsgetting-started/embedded.md
| ```go | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "log" | ||
| "time" | ||
|
|
||
| "github.com/dagucloud/dagu" | ||
| ) | ||
|
|
||
| func main() { | ||
| ctx, cancel := context.WithTimeout(context.Background(), time.Minute) | ||
| defer cancel() | ||
|
|
||
| engine, err := dagu.New(ctx, dagu.Options{ | ||
| HomeDir: "/var/lib/myapp/dagu", | ||
| }) | ||
| if err != nil { | ||
| log.Fatal(err) | ||
| } | ||
| defer func() { | ||
| if err := engine.Close(context.Background()); err != nil { | ||
| log.Printf("close Dagu engine: %v", err) | ||
| } | ||
| }() | ||
|
|
||
| run, err := engine.RunYAML(ctx, []byte(` | ||
| name: embedded-local | ||
| params: | ||
| - MESSAGE | ||
| steps: | ||
| - name: hello | ||
| command: echo "${MESSAGE}" | ||
| `), dagu.WithParams(map[string]string{ | ||
| "MESSAGE": "hello from the host app", | ||
| })) | ||
| if err != nil { | ||
| log.Fatal(err) | ||
| } | ||
|
|
||
| status, err := run.Wait(ctx) | ||
| if err != nil { | ||
| log.Fatal(err) | ||
| } | ||
| fmt.Printf("%s finished with %s\n", status.RunID, status.Status) | ||
| } | ||
| ``` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify dagu package API matches documentation examples
# Check if the package exists and extract key API signatures
rg -A 10 'func New\(' --type go
rg -A 5 'func.*RunYAML' --type go
rg -A 5 'func.*WithParams' --type go
rg -A 10 'type Status struct' --type goRepository: dagucloud/docs
Length of output: 653
🏁 Script executed:
#!/bin/bash
# Explore the repository structure to understand what's available
find . -type f -name "*.go" | head -20
git ls-files | head -30
ls -laRepository: dagucloud/docs
Length of output: 2217
🌐 Web query:
dagucloud/dagu package API documentation go
💡 Result:
The dagucloud/dagu package refers to the Go module for Dagu, a lightweight workflow orchestration engine. Its API documentation is available on pkg.go.dev at https://pkg.go.dev/github.com/dagu-org/dagu (latest v1.30.3 as of 2026-01-04). Note that there appear to be multiple related repositories (dagu-org/dagu, dagucloud/dagu, yohamta/dagu), but dagu-org/dagu is the primary active one with the most recent pkg.go.dev page. This page provides standard Go package documentation including: - Module overview, license (GPL-3.0), Go version compatibility (1.25+). - Dependencies list. - README with installation, quick start, features (YAML workflows, Web UI, CLI, distributed execution via gRPC, AI agent, etc.). - Links to full docs at docs.dagu.sh, GitHub examples, and community. Dagu also exposes a REST API (documented at https://docs.dagu.sh/web-ui/api and https://docs.dagu.cloud/reference/api) for HTTP-based interaction (e.g., /api/v1 or /api/v2 endpoints for DAG management, health checks), but this is the server's HTTP API, not the Go package API. No separate Go client SDK is explicitly documented in results; use the core package for embedding or direct use. For programmatic control, interact via the REST API or gRPC (mentioned for distributed mode). Source code at https://github.com/dagucloud/dagu or https://github.com/dagu-org/dagu.
Citations:
- 1: https://pkg.go.dev/github.com/dagu-org/dagu
- 2: https://docs.dagu.sh/web-ui/api
- 3: https://docs.dagu.cloud/reference/api
- 4: https://github.com/dagucloud/dagu
- 5: https://pkg.go.dev/github.com/yohamta/dagu
- 6: https://docs.dagu.cloud/overview/api
🌐 Web query:
site:pkg.go.dev github.com/dagu-org/dagu New RunYAML WithParams
💡 Result:
No explicit documentation or source code snippets for a "RunYAML WithParams" function or method in github.com/dagu-org/dagu were found in the search results. The pkg.go.dev page for github.com/dagu-org/dagu v1.30.3 (most recent, published 2026-01-04) provides general project information, installation, CLI usage like "dagu start hello.yaml", and YAML workflow examples with params in sub-DAG calls (e.g., params: "SOURCE=s3://bucket/data.csv"), but no Go API details matching the query. The official docs are referenced at docs.dagu.sh, but no specific Go library API for RunYAML is detailed in results. The CLI "dagu start <yaml>" likely handles YAML execution, possibly with params via flags or env vars, but no "WithParams" identified. Repository likely at https://github.com/dagu-org/dagu or https://github.com/dagucloud/dagu based on installer scripts.
Citations:
🌐 Web query:
github.com/dagu-org/dagu embedding API Go example
💡 Result:
No public example exists for embedding the Dagu workflow engine API directly in Go code. Dagu (github.com/dagu-org/dagu) is primarily a standalone binary workflow engine using YAML-defined DAGs, with REST API for programmatic control when the server runs (docs.dagu.sh/overview/api). pkg.go.dev shows the module exists but no documented public embedding API or examples. An open GitHub issue (#583) requests adding direct Go execution like dagu.Start("dagName", dagu.Params("key=val")), but it remains unresolved as of latest updates. To use Dagu programmatically, run the binary via exec.Command or interact via its gRPC/REST interfaces in distributed mode. For embedding workflows in Go, consider alternatives like github.com/rhosocial/go-dag.
Citations:
- 1: https://github.com/dagu-org/dagu/blob/main/README.md
- 2: https://docs.dagu.sh/overview/api
- 3: https://pkg.go.dev/github.com/dagu-org/dagu
- 4: Enable Direct Execution of DAGs via Go Code dagu#583
- 5: https://docs.dagu.sh/
🌐 Web query:
site:github.com dagucloud/dagu "func New" "RunYAML"
💡 Result:
No function named "func New" referencing or using "RunYAML" was found in the dagucloud/dagu repository or its documentation across multiple searches targeting Go source code, GitHub files, and official docs. The repository is a Go-based workflow engine (https://github.com/dagucloud/dagu) where workflows are defined in YAML and executed via CLI commands like dagu start hello.yaml or API endpoints that accept inline YAML specs (e.g., POST /api/v2/dag-runs with "spec" field). There is an open issue (#583) proposing a public Go API for direct DAG execution like dagu.Start("dagName"), but it remains unimplemented as of 2026-04-19. Code snippets mentioning YAML parsing exist (e.g., migration to goccy/go-yaml in #913), but no matching "func New" with "RunYAML". Searches for source files like internal/digraph/loader.go surfaced coverage reports but no explicit code with the terms. Official docs at docs.dagu.sh focus on YAML workflows and CLI/API usage, with no embedded Go library API documented.
Citations:
- 1: https://github.com/dagucloud/dagu
- 2: Update dependencies: YAML parser migration and other library upgrades dagu#913
- 3: GHSA-6qr9-g2xw-cw92
- 4: https://github.com/yohamta/dagu
- 5: Enable Direct Execution of DAGs via Go Code dagu#583
- 6: feat: auto-create default base.yaml with comprehensive field reference on first run dagu#1737
- 7: ingest yaml with filename dagu#1630
- 8: https://github.com/dagu-org/dagu/
🌐 Web query:
dagu-org/dagu Go API embedded example "dagu.New"
💡 Result:
No complete, up-to-date embedded Go API example using dagu.New was found in official documentation or pkg.go.dev pages. Dagu (github.com/dagu-org/dagu) is primarily designed as a standalone binary for YAML-based workflow execution via CLI commands like dagu start workflow.yaml, with a web UI and HTTP/gRPC APIs for management. The pkg.go.dev page (v1.30.3) shows the module but no public Go API documentation for direct embedding like dagu.New. An open GitHub issue #583 (dated 2024-06-03, updated 2025-12-06, still open) requests exactly this feature: "Enable Direct Execution of DAGs via Go Code" with proposed API like dagu.Start("someDAG", dagu.Params("FOO=BAR")). This confirms the feature is planned but not implemented as of the latest sources (repo active as of 2026-04). For embedding workflows in Go applications, current alternatives are: - Execute the dagu binary as a subprocess using os/exec (common for CLI tools). - Use the HTTP/gRPC client APIs once server is running (dagu start-all exposes /api/v1). Example subprocess usage: package main import ( "os/exec" ) func main { cmd := exec.Command("dagu", "start", "hello.yaml") err := cmd.Run if err != nil { panic(err) } } Official docs at docs.dagu.sh focus on YAML/CLI/server usage, not programmatic Go embedding. Repo: https://github.com/dagu-org/dagu (3K+ stars, Go primary lang).
Citations:
- 1: https://pkg.go.dev/github.com/dagu-org/dagu
- 2: Enable Direct Execution of DAGs via Go Code dagu#583
- 3: https://github.com/dagucloud/dagu
- 4: https://github.com/dagu-org/dagu/tree/main
Remove or replace this example—the documented API does not exist in the actual dagucloud/dagu package.
The example shows dagu.New(), engine.RunYAML(), run.Wait(), and dagu.WithParams() functions that are not currently implemented in the github.com/dagu-org/dagu package. The package is primarily a CLI tool and server with REST/gRPC APIs, not a Go library for direct programmatic embedding. An open GitHub issue (#583, still unresolved) requests exactly this feature.
Either remove this example, replace it with an actual working approach (e.g., executing the dagu binary via os/exec or using the REST API when the server runs), or clearly mark it as aspirational/future API subject to change.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@getting-started/embedded.md` around lines 15 - 63, The embedded Go example
must be removed or replaced because the functions dagu.New, engine.RunYAML,
run.Wait, and dagu.WithParams do not exist in the actual dagu package; either
delete this example or replace it with a working pattern (e.g., demonstrate
invoking the dagu CLI via os/exec or calling the server REST/gRPC API) and
update the text to explicitly state that a native embedding API is not yet
available (referencing issue `#583`) if you keep an aspirational sample. Ensure
references to dagu.New, engine.RunYAML, run.Wait, and dagu.WithParams are
eliminated or clearly marked as future/placeholder APIs.
Summary
Verification
pnpm buildSummary by CodeRabbit