diff --git a/cli/src/commands/router/commands/plugin/commands/init.ts b/cli/src/commands/router/commands/plugin/commands/init.ts index 0a7f75868c..7a64763e12 100644 --- a/cli/src/commands/router/commands/plugin/commands/init.ts +++ b/cli/src/commands/router/commands/plugin/commands/init.ts @@ -26,7 +26,9 @@ export default (opts: BaseCommandOptions) => { const cwd = process.cwd(); const projectDir = resolve(cwd, options.directory, options.project); - const pluginDir = resolve(cwd, projectDir, name); + + const pluginDir = options.project ? resolve(cwd, projectDir, 'plugins', name) : resolve(cwd, projectDir, name); + const originalPluginName = name; name = upperFirst(camelCase(name)); @@ -97,6 +99,7 @@ export default (opts: BaseCommandOptions) => { // Create a project directory structure await mkdir(projectDir, { recursive: true }); + await mkdir(resolve(projectDir, 'plugins'), { recursive: true }); // Write router config to the project root await writeFile(resolve(projectDir, 'config.yaml'), ProjectTemplates.routerConfig); diff --git a/cli/src/commands/router/commands/plugin/templates/plugin.ts b/cli/src/commands/router/commands/plugin/templates/plugin.ts index 2d987191f6..5cd556161c 100644 --- a/cli/src/commands/router/commands/plugin/templates/plugin.ts +++ b/cli/src/commands/router/commands/plugin/templates/plugin.ts @@ -10,7 +10,7 @@ go 1.24.1 require ( github.com/stretchr/testify v1.10.0 - github.com/wundergraph/cosmo/router-plugin v0.0.0-20250519204649-84818397f974 // v0.1.0 + github.com/wundergraph/cosmo/router-plugin v0.0.0-20250824152218-8eebc34c4995 // v0.4.1 google.golang.org/grpc v1.68.1 google.golang.org/protobuf v1.36.5 ) @@ -55,7 +55,7 @@ func main() { s.RegisterService(&service.{serviceName}_ServiceDesc, &{serviceName}{ nextID: 1, }) - }) + }, routerplugin.WithTracing()) if err != nil { log.Fatalf("failed to create router plugin: %v", err)