Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`;
}
Expand All @@ -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}`);
Expand All @@ -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}`);
Expand Down Expand Up @@ -262,8 +265,8 @@ export function AgentCodeSetupSection({ agent, stepOffset, isProviderComplete }:
}
rightContent={
<TerminalBlock
displayCommand="npx novu@latest dev -p 4000 --no-studio"
copyCommand="npx novu@latest dev -p 4000 --no-studio"
displayCommand={`npx novu@${CLI_PACKAGE_TAG} dev -p 4000 --no-studio`}
copyCommand={`npx novu@${CLI_PACKAGE_TAG} dev -p 4000 --no-studio`}
/>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/framework/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/novu/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
19 changes: 18 additions & 1 deletion packages/novu/src/commands/init/templates/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
/**
* Get the file path for a given file in a template, e.g. "next.config.js".
*/
Expand Down Expand Up @@ -194,7 +211,7 @@ export const installTemplate = async ({
react: '^19',
'react-dom': '^19',
next: version,
'@novu/framework': 'latest',
'@novu/framework': resolveFrameworkVersion(),
};

if (!isAgentTemplate) {
Expand Down
Loading