diff --git a/.changeset/three-rooms-retire.md b/.changeset/three-rooms-retire.md new file mode 100644 index 00000000..058e9aef --- /dev/null +++ b/.changeset/three-rooms-retire.md @@ -0,0 +1,5 @@ +--- +"@macalinao/coda": patch +--- + +Add coda idl command for printing the underlying codama IDL diff --git a/packages/coda/src/bin/cli.ts b/packages/coda/src/bin/cli.ts index 4b544c06..6b301ee9 100644 --- a/packages/coda/src/bin/cli.ts +++ b/packages/coda/src/bin/cli.ts @@ -130,4 +130,23 @@ program } }); +program + .command("idl") + .description("Print the Codama IDL to stdout") + .option( + "-c, --config ", + "Path to coda.config.mjs file", + "./coda.config.mjs", + ) + .action(async (options: { config: string }) => { + try { + const { codama } = await processIdls(options); + const root = codama.getRoot(); + console.log(JSON.stringify(root, null, 2)); + } catch (error) { + console.error("Error printing IDL:", error); + process.exit(1); + } + }); + program.parse();