Skip to content

Commit d7ae72c

Browse files
CLI - Fix welcome msg
CLI - Fix welcome msg
2 parents c1f2b3f + bb917a2 commit d7ae72c

File tree

4 files changed

+12
-16
lines changed

4 files changed

+12
-16
lines changed

.changeset/thirty-kings-tickle.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@kilocode/cli": patch
3+
---
4+
5+
Fix Wellcome Message regression

cli/src/ui/utils/welcomeMessage.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { CliMessage, WelcomeMessageOptions } from "../../types/cli.js"
22
import type { ValidationResult } from "../../config/validation.js"
33
import { getConfigPath } from "../../config/persistence.js"
4-
5-
// Counter to ensure unique IDs even when created in the same millisecond
6-
let messageCounter = 0
4+
import { generateMessage } from "./messages.js"
75

86
/**
97
* Converts validation errors into user-friendly instructions
@@ -42,14 +40,11 @@ export function createConfigErrorInstructions(validation: ValidationResult): str
4240
* @returns A CliMessage of type "welcome"
4341
*/
4442
export function createWelcomeMessage(options?: WelcomeMessageOptions): CliMessage {
45-
const timestamp = Date.now()
46-
const id = `welcome-${timestamp}-${messageCounter++}`
47-
4843
return {
49-
id,
44+
...generateMessage(),
5045
type: "welcome",
5146
content: "", // Content is rendered by WelcomeMessageContent component
52-
ts: 0, // Welcome message should show at the top
47+
ts: 1, // Welcome message should show at the top
5348
metadata: {
5449
welcomeOptions: options,
5550
},

cli/src/utils/auto-update.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import packageJson from "package-json"
22
import { Package } from "../constants/package.js"
33
import { CliMessage } from "../types/cli.js"
44
import semver from "semver"
5+
import { generateMessage } from "../ui/utils/messages.js"
56

67
type AutoUpdateStatus = {
78
name: string
@@ -31,11 +32,8 @@ export const getAutoUpdateStatus = async () => {
3132
}
3233

3334
export const generateUpdateAvailableMessage = (status: AutoUpdateStatus): CliMessage => {
34-
const timestamp = Date.now()
35-
3635
return {
37-
id: `update-notification-${timestamp}`,
38-
ts: timestamp,
36+
...generateMessage(),
3937
type: "system",
4038
content: `## A new version of Kilo CLI is available!
4139
You are using v${status.currentVersion}, the latest version is v${status.latestVersion}.

cli/src/utils/notifications.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { getKiloUrlFromToken } from "@roo-code/types"
22
import { logs } from "../services/logs.js"
33
import type { KilocodeNotification } from "../state/atoms/notifications.js"
44
import type { ProviderConfig } from "../config/types.js"
5+
import { generateMessage } from "../ui/utils/messages.js"
56

67
/**
78
* Response from the Kilocode notifications API
@@ -72,17 +73,14 @@ export function supportsNotifications(provider: ProviderConfig): boolean {
7273
* @returns A CLI message object
7374
*/
7475
export function generateNotificationMessage(notification: KilocodeNotification) {
75-
const timestamp = Date.now()
76-
7776
let content = `## ${notification.title}\n\n${notification.message}`
7877

7978
if (notification.action) {
8079
content += `\n\n[${notification.action.actionText}](${notification.action.actionURL})`
8180
}
8281

8382
return {
84-
id: `notification-${notification.id}-${timestamp}`,
85-
ts: timestamp,
83+
...generateMessage(),
8684
type: "system" as const,
8785
content,
8886
}

0 commit comments

Comments
 (0)