diff --git a/apps/dashboard/src/components/agents/agent-code-setup-section.tsx b/apps/dashboard/src/components/agents/agent-code-setup-section.tsx index 0729ac925a8..9c5fdccd2ae 100644 --- a/apps/dashboard/src/components/agents/agent-code-setup-section.tsx +++ b/apps/dashboard/src/components/agents/agent-code-setup-section.tsx @@ -15,6 +15,9 @@ import { deriveStepStatus } from './setup-guide-step-utils'; const CLI_DEFAULT_API_URL = 'https://api.novu.co'; const BRIDGE_POLL_INTERVAL_MS = 2000; +// TODO: change to 'latest' when agents are GA and IS_CONVERSATIONAL_AGENTS_ENABLED flag is removed +const CLI_PACKAGE_TAG = 'rc'; + function maskSecretKey(key: string): string { return `nv-${'•'.repeat(16)}${key.slice(-4)}`; } @@ -31,7 +34,7 @@ function buildInitCommand({ masked: boolean; }): string { const key = masked ? maskSecretKey(secretKey) : secretKey; - const parts = [`npx novu@latest init -t agent`, `--agent-identifier ${agentIdentifier}`, `-s ${key}`]; + const parts = [`npx novu@${CLI_PACKAGE_TAG} init -t agent`, `--agent-identifier ${agentIdentifier}`, `-s ${key}`]; if (apiUrl) { parts.push(`-a ${apiUrl}`); @@ -49,7 +52,7 @@ function buildInitCopyCommand({ secretKey: string; apiUrl: string | null; }): string { - const parts = [`npx novu@latest init -t agent`, `--agent-identifier ${agentIdentifier}`, `-s ${secretKey}`]; + const parts = [`npx novu@${CLI_PACKAGE_TAG} init -t agent`, `--agent-identifier ${agentIdentifier}`, `-s ${secretKey}`]; if (apiUrl) { parts.push(`-a ${apiUrl}`); @@ -262,8 +265,8 @@ export function AgentCodeSetupSection({ agent, stepOffset, isProviderComplete }: } rightContent={ } /> diff --git a/packages/framework/package.json b/packages/framework/package.json index ab51fd9fd22..ad33479c85b 100644 --- a/packages/framework/package.json +++ b/packages/framework/package.json @@ -1,6 +1,6 @@ { "name": "@novu/framework", - "version": "2.10.0", + "version": "2.10.1-alpha.1", "description": "The Code-First Notifications Workflow SDK.", "main": "./dist/cjs/index.cjs", "types": "./dist/cjs/index.d.cts", diff --git a/packages/novu/package.json b/packages/novu/package.json index 31a2da98398..97a2788a6d1 100644 --- a/packages/novu/package.json +++ b/packages/novu/package.json @@ -1,6 +1,6 @@ { "name": "novu", - "version": "2.8.0", + "version": "2.8.1-rc.2", "description": "Novu CLI. Run Novu Studio and sync workflows with Novu Cloud", "main": "src/index.js", "publishConfig": { diff --git a/packages/novu/src/commands/init/templates/index.ts b/packages/novu/src/commands/init/templates/index.ts index 8218b89d7ff..45c15d87318 100644 --- a/packages/novu/src/commands/init/templates/index.ts +++ b/packages/novu/src/commands/init/templates/index.ts @@ -1,5 +1,6 @@ import { Sema } from 'async-sema'; import { async as glob } from 'fast-glob'; +import { readFileSync } from 'fs'; import fs from 'fs/promises'; import os from 'os'; import path from 'path'; @@ -8,6 +9,22 @@ import { copy } from '../helpers/copy'; import { install } from '../helpers/install'; import { GetTemplateFileArgs, InstallTemplateArgs, TemplateTypeEnum } from './types'; + +function resolveFrameworkVersion(): string { + const distIndex = __dirname.lastIndexOf(`${path.sep}dist${path.sep}`); + if (distIndex === -1) return 'latest'; + + const pkgRoot = __dirname.slice(0, distIndex); + try { + const pkg = JSON.parse(readFileSync(path.join(pkgRoot, 'package.json'), 'utf8')); + const ver = pkg.dependencies?.['@novu/framework']; + if (!ver || ver.startsWith('workspace:')) return 'latest'; + + return ver; + } catch { + return 'latest'; + } +} /** * Get the file path for a given file in a template, e.g. "next.config.js". */ @@ -194,7 +211,7 @@ export const installTemplate = async ({ react: '^19', 'react-dom': '^19', next: version, - '@novu/framework': 'latest', + '@novu/framework': resolveFrameworkVersion(), }; if (!isAgentTemplate) {