diff --git a/.changeset/gentle-mails-sip.md b/.changeset/gentle-mails-sip.md new file mode 100644 index 0000000000..61a768da9d --- /dev/null +++ b/.changeset/gentle-mails-sip.md @@ -0,0 +1,5 @@ +--- +"trigger.dev": patch +--- + +fix: unintended project initialization at absolute path `/trigger` during project initialization diff --git a/packages/cli-v3/DEVELOPMENT.md b/packages/cli-v3/DEVELOPMENT.md index 5f30cbb40a..254da81379 100644 --- a/packages/cli-v3/DEVELOPMENT.md +++ b/packages/cli-v3/DEVELOPMENT.md @@ -7,11 +7,11 @@ cd packages/cli-v3 pnpm run dev ``` -2. In the job-catalog folder you can use the CLI +2. Test the local CLI using the job-catalogs located in the `/references` directory ```sh pnpm i -pnpm exec trigger-v3-cli +pnpm exec trigger ``` --- diff --git a/packages/cli-v3/src/commands/init.ts b/packages/cli-v3/src/commands/init.ts index c5c7ba5a5d..32e1ff017e 100644 --- a/packages/cli-v3/src/commands/init.ts +++ b/packages/cli-v3/src/commands/init.ts @@ -229,7 +229,10 @@ async function createTriggerDir( throw new OutroCommandError(); } - const triggerDir = resolve(process.cwd(), location); + // Ensure that the path is always relative by stripping leading '/' if present + const relativeLocation = location.replace(/^\//, ""); + + const triggerDir = resolve(process.cwd(), relativeLocation); logger.debug({ triggerDir });