diff --git a/daggie/src/daggie/prompts/system_prompt.md b/daggie/src/daggie/prompts/system_prompt.md index 4a3223c..a9ff68f 100644 --- a/daggie/src/daggie/prompts/system_prompt.md +++ b/daggie/src/daggie/prompts/system_prompt.md @@ -33,6 +33,27 @@ My module description here. """My module description here.""" ``` +### Type Naming (Avoiding Redundancy on Daggerverse) +Dagger automatically prefixes secondary type names with the module name on daggerverse.dev. Only the **main class** keeps its name as-is. To avoid redundant names like `GcpCloudRunCloudRunService`, use short, unprefixed names for secondary types: + +```python +# Module: gcp-cloud-run + +# GOOD — appears as "GcpCloudRunService" on daggerverse +@object_type +class Service: + ... + +# BAD — appears as "GcpCloudRunCloudRunService" on daggerverse +@object_type +class CloudRunService: + ... +``` + +The same rule applies across all SDKs (Go structs, TypeScript classes). The main class name should match the module (e.g., `GcpCloudRun` for `gcp-cloud-run`), but secondary types should use short domain names (e.g., `RunService`, `RunJob`, `Chart`). + +**WARNING:** Some short names like `Service`, `Container`, `Directory`, `File`, `Secret` are reserved by Dagger core (`daggercore`). Using them causes `type "X" is already defined by module "daggercore"` errors. Add a domain prefix to avoid collisions (e.g., `RunService` instead of `Service`). + ### Key Concepts - **Functions** — exported methods on the main class, exposed as CLI commands - **Container API** — `dag.container().from_()`, `.with_exec()`, `.with_mounted_directory()`, `.with_env_variable()` diff --git a/gcp-cloud-run/src/gcp_cloud_run/main.py b/gcp-cloud-run/src/gcp_cloud_run/main.py index 3d9ef21..350d7c9 100644 --- a/gcp-cloud-run/src/gcp_cloud_run/main.py +++ b/gcp-cloud-run/src/gcp_cloud_run/main.py @@ -143,7 +143,7 @@ def _validate_positive_int(value: int, field: str) -> int: @object_type -class CloudRunService: +class RunService: """Cloud Run service operations.""" @function @@ -282,7 +282,7 @@ async def get_logs( @object_type -class CloudRunJob: +class RunJob: """Cloud Run job operations.""" @function @@ -402,11 +402,11 @@ class GcpCloudRun: """Google Cloud Run deployment utilities.""" @function - def service(self) -> CloudRunService: + def service(self) -> RunService: """Access Cloud Run service operations.""" - return CloudRunService() + return RunService() @function - def job(self) -> CloudRunJob: + def job(self) -> RunJob: """Access Cloud Run job operations.""" - return CloudRunJob() + return RunJob()