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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "persona",
"version": "1.3.7",
"version": "1.3.8",
"description": "CLI tool to switch Claude CLI configurations between different model providers",
"type": "module",
"main": "dist/persona",
Expand Down
20 changes: 20 additions & 0 deletions src/commands/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ export async function editProviderInteractive(providerId: string): Promise<void>

configStore.updateProvider(providerId, updates);

// Re-apply config if editing the active provider
const target = provider.target || 'claude';
const activeProvider = configStore.getActiveProvider(target);
if (activeProvider?.id === providerId) {
const updatedProvider = configStore.getProvider(providerId);
if (updatedProvider) {
configStore.applyProvider(updatedProvider, true);
}
}

console.log(chalk.green(`\nProvider "${answers.name}" updated successfully!`));
}

Expand Down Expand Up @@ -155,5 +165,15 @@ export function editProviderFromArgs(providerId: string, args: {

configStore.updateProvider(providerId, updates);

// Re-apply config if editing the active provider
const target = provider.target || 'claude';
const activeProvider = configStore.getActiveProvider(target);
if (activeProvider?.id === providerId) {
const updatedProvider = configStore.getProvider(providerId);
if (updatedProvider) {
configStore.applyProvider(updatedProvider, true);
}
}

console.log(chalk.green(`\nProvider "${provider.name}" updated successfully!`));
}
9 changes: 9 additions & 0 deletions src/tui/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ export function TuiApp({ renderer }: TuiAppProps) {
if (apiKey) updates.apiKey = apiKey

updateProvider(provider.id, updates)

// Re-apply config if editing the active provider
if (activeProvider?.id === provider.id) {
const updatedProvider = configStore.getProvider(provider.id)
if (updatedProvider) {
configStore.applyProvider(updatedProvider, true)
}
}

setListContainerKey(k => k + 1)
setDetailContent({ type: "message", message: `✓ Provider "${name}" updated successfully!` })
updateStatus("Provider updated")
Expand Down
7 changes: 6 additions & 1 deletion src/tui/components/ProviderList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import type { SelectOption } from "@opentui/core"
import type { SelectOption, SelectKeyBinding } from "@opentui/core"
import type { ThemeColors } from "../../utils/theme"

const kpenterBindings: SelectKeyBinding[] = [
{ name: "kpenter", action: "select-current" }
]

interface ProviderListProps {
options: SelectOption[]
selectedIndex: number
Expand Down Expand Up @@ -52,6 +56,7 @@ export function ProviderList({
showDescription={true}
showScrollIndicator={true}
wrapSelection={false}
keyBindings={kpenterBindings}
/>
</box>
)
Expand Down
2 changes: 1 addition & 1 deletion src/tui/components/dialogs/ConfirmDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function ConfirmDialog({ title, message, onClose }: ConfirmDialogProps) {
useKeyboard((key) => {
if (key.name === "left" || key.name === "right") {
setSelectedButton((prev) => (prev === 0 ? 1 : 0))
} else if (key.name === "return") {
} else if (key.name === "return" || key.name === "kpenter") {
onClose(selectedButton === 0)
} else if (key.name === "escape") {
onClose(null)
Expand Down
2 changes: 1 addition & 1 deletion src/tui/components/dialogs/InputDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function InputDialog({ title, message, defaultValue = "", required = fals
const handleKey = useCallback((key: any) => {
if (key.name === "escape") {
onClose(null)
} else if (key.name === "return") {
} else if (key.name === "return" || key.name === "kpenter") {
const trimmed = value.trim()
if (!required || trimmed !== "") {
onClose(value)
Expand Down
6 changes: 6 additions & 0 deletions src/tui/components/dialogs/ListDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { useState } from "react"
import { useRenderer, useKeyboard } from "@opentui/react"
import type { SelectKeyBinding } from "@opentui/core"
import { getThemeColors, layout } from "../../../utils/theme"

const kpenterBindings: SelectKeyBinding[] = [
{ name: "kpenter", action: "select-current" }
]

interface ListDialogProps {
title: string
choices: { name: string; value: string }[]
Expand Down Expand Up @@ -90,6 +95,7 @@ export function ListDialog({ title, choices, onClose }: ListDialogProps) {
selectedTextColor={colors.selectedText}
showDescription={false}
focused={true}
keyBindings={kpenterBindings}
zIndex={202}
/>
<text
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = "1.3.7"
export const VERSION = "1.3.8"
Loading