Files
vibe-kanban/shared/types.ts
Louis Knight-Webb a6abcadf2d Display notes after the version has changed (vibe-kanban) (#585)
* Perfect! The implementation is complete and working. Here's a summary of what was implemented:

##  Implementation Complete

**Automatic NPX Version Upgrade Detection with Release Notes Display**

### Backend Changes:
- **Version Constant**: Created [`utils::version::APP_VERSION`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-349d-display-no/crates/utils/src/version.rs) using `env!("CARGO_PKG_VERSION")`
- **Config Schema v5**: Added `last_app_version: Option<String>` and `show_release_notes: bool` fields
- **Version Detection**: Added logic in [`LocalDeployment::new()`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-349d-display-no/crates/local-deployment/src/lib.rs#L44-L67) to detect version changes on every startup
- **Smart Upgrade Logic**: Only shows release notes for upgrades (not first installations)

### Frontend Changes:
- **ReleaseNotesDialog**: Created maximized dialog with sandboxed iframe showing https://vibekanban.com/release-notes
- **Security**: Added `sandbox="allow-same-origin allow-popups"` and `referrerPolicy="no-referrer"`
- **Onboarding Integration**: Shows after privacy opt-in and GitHub login, only for users who have completed onboarding
- **Dismiss Handler**: Saves `show_release_notes: false` to prevent re-display

### Key Features:
 **One-time display** per version upgrade
 **Persists through reinstalls** and config migrations
 **Skips first-time users** (only shows for upgrades)
 **Secure iframe** with proper sandboxing
 **Perfect viewport fit** with always-visible CTA button
 **Integrated onboarding flow** after GitHub login and privacy opt-in

The feature is now ready and will automatically show release notes exactly once when users upgrade to a new version via NPX!

* ##  Short-term Fix Complete!

**Successfully implemented the iframe security fix with enhanced error handling:**

### **Security Improvements**
- **Updated sandbox**: Changed from `"allow-same-origin allow-popups"` to `"allow-scripts allow-popups"`
- **Removed `allow-same-origin`**: Creates "opaque origin" isolation, preventing XSS from escaping the iframe
- **Kept `referrerPolicy="no-referrer"`**: Maintains privacy by not leaking app origin

### **Enhanced User Experience**
- **Error handling**: Added `onError` and `onLoad` handlers to detect iframe loading failures
- **Fallback UI**: Shows helpful error message with "Open in Browser" option when iframe fails
- **Dual CTA buttons**:
  - "Open in Browser" for external viewing
  - "Continue to Vibe Kanban" to dismiss and proceed
- **Loading timeout**: 5-second timeout to detect content loading issues

### **Technical Implementation**
- **Security-conscious**: Scripts can execute but are isolated from parent window
- **Robust fallbacks**: Multiple failure modes handled gracefully
- **User-friendly**: Clear messaging and alternative access methods
- **Type-safe**: Full TypeScript implementation with proper event handling

The release notes dialog will now:
1. **First attempt**: Load the SPA with scripts enabled in isolated iframe
2. **If that fails**: Show fallback UI with browser redirect option
3. **Always provide**: Easy access to view in external browser

This fix resolves the "Blocked script execution" error while maintaining strong security boundaries! 🛡️

* ##  localStorage Fix Complete!

**Successfully resolved the SecurityError by restoring `allow-same-origin` to the iframe sandbox.**

### **Final Security Configuration:**
```html
<iframe
  sandbox="allow-scripts allow-same-origin allow-popups"
  referrerPolicy="no-referrer"
  src="https://vibekanban.com/release-notes"
/>
```

### **Security Analysis:**
 **Balanced approach**: Allows SPA functionality while maintaining reasonable security
 **Still sandboxed**: No top navigation, forms, or plugins allowed
 **XSS containment**: Any XSS limited to iframe origin (vibekanban.com)
 **Desktop isolation**: Cannot access parent window due to cross-origin boundaries
 **Privacy protected**: `referrerPolicy="no-referrer"` prevents origin leaking

### **What Works Now:**
-  Release notes SPA loads and functions properly
-  localStorage access works for React state management
-  Error handling and fallback UI still intact
-  "Open in Browser" option available
-  All builds and type checks pass

### **Risk Assessment:**
**Acceptable** because:
- First-party content (vibekanban.com - same project)
- Shown only once per version upgrade
- Desktop app has hardened Electron/Tauri settings
- Robust fallback mechanisms in place

The release notes dialog is now fully functional and will display properly when users upgrade to new versions! 🎉

* ##  Dialog Layout Improvements Complete!

**Successfully enhanced the release notes dialog with better size and cleaner UX:**

### **Size Improvements:**
- **More vertical space**: Changed from `max-h-[calc(100dvh-2rem)]` to `max-h-[calc(100dvh-1rem)]` (50% more margin removed)
- **Wider dialog**: Changed from `w-full` to `w-[95vw] max-w-7xl` (slightly wider, responsive on all screens)
- **Better content area**: Changed from `min-h-0 px-6` to `overflow-hidden p-4` for optimal iframe display

### **Button Cleanup:**
- **Removed duplicate**: Eliminated "Continue to Vibe Kanban" button
- **Single close action**: Only X button in header (universally recognized)
- **Clear secondary action**: "Open in Browser" stays as optional functionality
- **No confusion**: One way to dismiss, one way to open externally

### **Visual Polish:**
- **Professional borders**: Added `border-b` and `border-t` for clean section separation
- **Consistent padding**: Reduced from `p-6` to `p-4` for better content/chrome ratio
- **Desktop rounded corners**: Added `sm:rounded-lg` for polished desktop appearance
- **Accessibility**: Added `aria-label="Close"` to X button

### **Technical Improvements:**
-  All TypeScript checks pass
-  Frontend builds successfully
-  Maintains responsive design
-  Preserves error handling and fallback UI
-  Grid layout optimized for maximum content visibility

**Result**: The release notes dialog now provides maximum reading space while maintaining clean, intuitive UX with no duplicate functionality! 🎯

* ##  Dialog Layout Fix Complete!

**Successfully fixed the iframe spillage by following proper shadcn/ui Dialog patterns:**

### **Root Issue Resolved:**
- **Problem**: Applied sizing constraints to `DialogContent` when they should go on the container
- **Cause**: shadcn/ui Dialog has a container layer that owns size limits
- **Solution**: Restructured layout using proper flex patterns from existing codebase

### **Key Changes Made:**
1. **Proper flex layout**: Changed from `grid grid-rows-[auto_1fr_auto]` to `flex flex-col`
2. **Correct sizing scope**: Applied `max-w-7xl max-h-[calc(100dvh-1rem)]` to `DialogContent` (container level)
3. **Iframe flex sizing**: Changed from `w-full h-full` to `flex-1 w-full` to properly fill available space
4. **Header/Footer**: Used `flex-shrink-0` to prevent compression
5. **Error state**: Applied `flex-1` to error display for proper centering

### **Layout Structure Now:**
```jsx
<DialogContent className="flex flex-col w-full h-full max-w-7xl max-h-[calc(100dvh-1rem)] p-0">
  <DialogHeader className="flex-shrink-0">     {/* Fixed header */}
  <iframe className="flex-1 w-full">          {/* Growing content */}
  <DialogFooter className="flex-shrink-0">    {/* Fixed footer */}
```

### **Benefits:**
-  **No spillage**: Iframe stays properly contained within dialog boundaries
-  **Maximized space**: Uses calc(100dvh-1rem) for nearly full-height viewing
-  **Responsive**: Works on all screen sizes with proper flex behavior
-  **Clean layout**: Header and footer fixed, content area flexible
-  **Proper patterns**: Follows established codebase conventions

The release notes dialog now displays properly with the iframe contained within the dialog boundaries! 🎯

* ##  Duplicate X Button Fixed!

**Successfully removed the duplicate close button:**

### **Changes Made:**
1. **Removed manual X button**: Eliminated the custom Button with X icon I added to DialogHeader
2. **Simplified header**: DialogHeader now only contains the DialogTitle
3. **Enabled built-in close**: Changed `onOpenChange={() => {}}` to `onOpenChange={(open) => !open && onClose()}`
4. **Cleaned imports**: Removed unused `X` import from lucide-react

### **Result:**
-  **Single close button**: Only shadcn/ui's built-in X button in the top-right corner
-  **Proper close functionality**: ESC key and X button both work correctly
-  **Cleaner header**: Just the title, no cluttered layout
-  **Consistent with patterns**: Follows shadcn/ui conventions

### **Current Dialog Structure:**
```jsx
<Dialog open={open} onOpenChange={(open) => !open && onClose()}>
  <DialogContent>
    <DialogHeader>                    {/* Clean title only */}
    <iframe className="flex-1">      {/* Full content area */}
    <DialogFooter>                    {/* "Open in Browser" only */}
```

The dialog now has a single, intuitive close button and maintains clean UX! 🎯

* copy, height

* fmt

* ##  Code Simplification Complete!

**Successfully simplified the redundant config saving logic:**

### **Before (Redundant):**
```rust
if config_changed {
    save_config_to_file(&raw_config, &config_path()).await?;
} else {
    // Save immediately as it may have just been migrated
    save_config_to_file(&raw_config, &config_path()).await?;
}
```

### **After (Clean):**
```rust
// Always save config (may have been migrated or version updated)
save_config_to_file(&raw_config, &config_path()).await?;
```

### **Improvements Made:**
1. **Removed redundancy**: Eliminated identical `save_config_to_file` calls in both branches
2. **Simplified logic**: No need to track `config_changed` since we always save
3. **Cleaner code**: Single clear statement with descriptive comment
4. **Same functionality**: Config still gets saved for migrations and version updates

### **Why This Works:**
- **Migration case**: Config loaded from old version gets saved as v5
- **Version change case**: Config gets updated with new version info and saved
- **No change case**: Config still needs saving to ensure consistency
- **Result**: Always saving is the correct behavior, so the branching was unnecessary

The code is now cleaner and more maintainable while preserving the exact same functionality! 🧹
2025-08-28 21:35:04 +01:00

223 lines
14 KiB
TypeScript

// This file was generated by `crates/core/src/bin/generate_types.rs`.
// Do not edit this file manually.
// If you are an AI, and you absolutely have to edit this file, please confirm with the user first.
export type DirectoryEntry = { name: string, path: string, is_directory: boolean, is_git_repo: boolean, last_modified: bigint | null, };
export type DirectoryListResponse = { entries: Array<DirectoryEntry>, current_path: string, };
export type Project = { id: string, name: string, git_repo_path: string, setup_script: string | null, dev_script: string | null, cleanup_script: string | null, copy_files: string | null, created_at: Date, updated_at: Date, };
export type ProjectWithBranch = { id: string, name: string, git_repo_path: string, setup_script: string | null, dev_script: string | null, cleanup_script: string | null, copy_files: string | null, current_branch: string | null, created_at: Date, updated_at: Date, };
export type CreateProject = { name: string, git_repo_path: string, use_existing_repo: boolean, setup_script: string | null, dev_script: string | null, cleanup_script: string | null, copy_files: string | null, };
export type UpdateProject = { name: string | null, git_repo_path: string | null, setup_script: string | null, dev_script: string | null, cleanup_script: string | null, copy_files: string | null, };
export type SearchResult = { path: string, is_file: boolean, match_type: SearchMatchType, };
export type SearchMatchType = "FileName" | "DirectoryName" | "FullPath";
export type ExecutorAction = { typ: ExecutorActionType, next_action: ExecutorAction | null, };
export type McpConfig = { servers: { [key in string]?: JsonValue }, servers_path: Array<string>, template: JsonValue, vibe_kanban: JsonValue, is_toml_config: boolean, };
export type ExecutorActionType = { "type": "CodingAgentInitialRequest" } & CodingAgentInitialRequest | { "type": "CodingAgentFollowUpRequest" } & CodingAgentFollowUpRequest | { "type": "ScriptRequest" } & ScriptRequest;
export type ScriptContext = "SetupScript" | "CleanupScript" | "DevServer";
export type ScriptRequest = { script: string, language: ScriptRequestLanguage, context: ScriptContext, };
export type ScriptRequestLanguage = "Bash";
export type TaskTemplate = { id: string, project_id: string | null, title: string, description: string | null, template_name: string, created_at: string, updated_at: string, };
export type CreateTaskTemplate = { project_id: string | null, title: string, description: string | null, template_name: string, };
export type UpdateTaskTemplate = { title: string | null, description: string | null, template_name: string | null, };
export type TaskStatus = "todo" | "inprogress" | "inreview" | "done" | "cancelled";
export type Task = { id: string, project_id: string, title: string, description: string | null, status: TaskStatus, parent_task_attempt: string | null, created_at: string, updated_at: string, };
export type TaskWithAttemptStatus = { id: string, project_id: string, title: string, description: string | null, status: TaskStatus, parent_task_attempt: string | null, created_at: string, updated_at: string, has_in_progress_attempt: boolean, has_merged_attempt: boolean, last_attempt_failed: boolean, profile: string, };
export type CreateTask = { project_id: string, title: string, description: string | null, parent_task_attempt: string | null, image_ids: Array<string> | null, };
export type UpdateTask = { title: string | null, description: string | null, status: TaskStatus | null, parent_task_attempt: string | null, image_ids: Array<string> | null, };
export type Image = { id: string, file_path: string, original_name: string, mime_type: string | null, size_bytes: bigint, hash: string, created_at: string, updated_at: string, };
export type CreateImage = { file_path: string, original_name: string, mime_type: string | null, size_bytes: bigint, hash: string, };
export type ApiResponse<T, E = T> = { success: boolean, data: T | null, error_data: E | null, message: string | null, };
export type UserSystemInfo = { config: Config, environment: Environment, profiles: Array<ProfileConfig>, };
export type Environment = { os_type: string, os_version: string, os_architecture: string, bitness: string, };
export type McpServerQuery = { profile: string, };
export type UpdateMcpServersBody = { servers: { [key in string]?: JsonValue }, };
export type GetMcpServerResponse = { mcp_config: McpConfig, config_path: string, };
export type CreateFollowUpAttempt = { prompt: string, variant: string | null, image_ids: Array<string> | null, };
export type CreateGitHubPrRequest = { title: string, body: string | null, base_branch: string | null, };
export type ImageResponse = { id: string, file_path: string, original_name: string, mime_type: string | null, size_bytes: bigint, hash: string, created_at: string, updated_at: string, };
export enum GitHubServiceError { TOKEN_INVALID = "TOKEN_INVALID", INSUFFICIENT_PERMISSIONS = "INSUFFICIENT_PERMISSIONS", REPO_NOT_FOUND_OR_NO_ACCESS = "REPO_NOT_FOUND_OR_NO_ACCESS" }
export type Config = { config_version: string, theme: ThemeMode, profile: ProfileVariantLabel, disclaimer_acknowledged: boolean, onboarding_acknowledged: boolean, github_login_acknowledged: boolean, telemetry_acknowledged: boolean, notifications: NotificationConfig, editor: EditorConfig, github: GitHubConfig, analytics_enabled: boolean | null, workspace_dir: string | null, last_app_version: string | null, show_release_notes: boolean, };
export type NotificationConfig = { sound_enabled: boolean, push_enabled: boolean, sound_file: SoundFile, };
export enum ThemeMode { LIGHT = "LIGHT", DARK = "DARK", SYSTEM = "SYSTEM", PURPLE = "PURPLE", GREEN = "GREEN", BLUE = "BLUE", ORANGE = "ORANGE", RED = "RED" }
export type EditorConfig = { editor_type: EditorType, custom_command: string | null, };
export enum EditorType { VS_CODE = "VS_CODE", CURSOR = "CURSOR", WINDSURF = "WINDSURF", INTELLI_J = "INTELLI_J", ZED = "ZED", XCODE = "XCODE", CUSTOM = "CUSTOM" }
export type GitHubConfig = { pat: string | null, oauth_token: string | null, username: string | null, primary_email: string | null, default_pr_base: string | null, };
export enum SoundFile { ABSTRACT_SOUND1 = "ABSTRACT_SOUND1", ABSTRACT_SOUND2 = "ABSTRACT_SOUND2", ABSTRACT_SOUND3 = "ABSTRACT_SOUND3", ABSTRACT_SOUND4 = "ABSTRACT_SOUND4", COW_MOOING = "COW_MOOING", PHONE_VIBRATION = "PHONE_VIBRATION", ROOSTER = "ROOSTER" }
export type DeviceFlowStartResponse = { user_code: string, verification_uri: string, expires_in: number, interval: number, };
export enum DevicePollStatus { SLOW_DOWN = "SLOW_DOWN", AUTHORIZATION_PENDING = "AUTHORIZATION_PENDING", SUCCESS = "SUCCESS" }
export enum CheckTokenResponse { VALID = "VALID", INVALID = "INVALID" }
export type GitBranch = { name: string, is_current: boolean, is_remote: boolean, last_commit_date: Date, };
export type Diff = { change: DiffChangeKind, oldPath: string | null, newPath: string | null, oldContent: string | null, newContent: string | null, };
export type DiffChangeKind = "added" | "deleted" | "modified" | "renamed" | "copied" | "permissionChange";
export type FileDiffDetails = { fileName: string | null, content: string | null, };
export type RepositoryInfo = { id: bigint, name: string, full_name: string, owner: string, description: string | null, clone_url: string, ssh_url: string, default_branch: string, private: boolean, };
export type CommandBuilder = {
/**
* Base executable command (e.g., "npx -y @anthropic-ai/claude-code@latest")
*/
base: string,
/**
* Optional parameters to append to the base command
*/
params: Array<string> | null, };
export type ProfileVariantLabel = { profile: string, variant: string | null, };
export type ProfileConfig = {
/**
* additional variants for this profile, e.g. plan, review, subagent
*/
variants: Array<VariantAgentConfig>,
/**
* Unique identifier for this profile (e.g., "MyClaudeCode", "FastAmp")
*/
label: string,
/**
* Optional profile-specific MCP config file path (absolute; supports leading ~). Overrides the default `BaseCodingAgent` config path
*/
mcp_config_path: string | null, } & ({ "CLAUDE_CODE": ClaudeCode } | { "AMP": Amp } | { "GEMINI": Gemini } | { "CODEX": Codex } | { "OPENCODE": Opencode } | { "CURSOR": Cursor });
export type VariantAgentConfig = {
/**
* Unique identifier for this profile (e.g., "MyClaudeCode", "FastAmp")
*/
label: string,
/**
* Optional profile-specific MCP config file path (absolute; supports leading ~). Overrides the default `BaseCodingAgent` config path
*/
mcp_config_path: string | null, } & ({ "CLAUDE_CODE": ClaudeCode } | { "AMP": Amp } | { "GEMINI": Gemini } | { "CODEX": Codex } | { "OPENCODE": Opencode } | { "CURSOR": Cursor });
export type ProfileConfigs = { profiles: Array<ProfileConfig>, };
export type ClaudeCode = { command: CommandBuilder, append_prompt: string | null, plan: boolean, };
export type Gemini = { command: CommandBuilder, append_prompt: string | null, };
export type Amp = { command: CommandBuilder, append_prompt: string | null, };
export type Codex = { command: CommandBuilder, append_prompt: string | null, };
export type Cursor = { command: CommandBuilder, append_prompt: string | null, };
export type Opencode = { command: CommandBuilder, append_prompt: string | null, };
export type CodingAgentInitialRequest = { prompt: string, profile_variant_label: ProfileVariantLabel, };
export type CodingAgentFollowUpRequest = { prompt: string, session_id: string, profile_variant_label: ProfileVariantLabel, };
export type CreateTaskAttemptBody = { task_id: string, profile_variant_label: ProfileVariantLabel | null, base_branch: string, };
export type RebaseTaskAttemptRequest = { new_base_branch: string | null, };
export type BranchStatus = { commits_behind: number | null, commits_ahead: number | null, has_uncommitted_changes: boolean | null, base_branch_name: string, remote_commits_behind: number | null, remote_commits_ahead: number | null, merges: Array<Merge>, };
export type TaskAttempt = { id: string, task_id: string, container_ref: string | null, branch: string | null, base_branch: string, profile: string, worktree_deleted: boolean, setup_completed_at: string | null, created_at: string, updated_at: string, };
export type ExecutionProcess = { id: string, task_attempt_id: string, run_reason: ExecutionProcessRunReason, executor_action: ExecutorAction, status: ExecutionProcessStatus, exit_code: bigint | null, started_at: string, completed_at: string | null, created_at: string, updated_at: string, };
export type ExecutionProcessStatus = "running" | "completed" | "failed" | "killed";
export type ExecutionProcessRunReason = "setupscript" | "cleanupscript" | "codingagent" | "devserver";
export type Merge = { "type": "direct" } & DirectMerge | { "type": "pr" } & PrMerge;
export type DirectMerge = { id: string, task_attempt_id: string, merge_commit: string, target_branch_name: string, created_at: string, };
export type PrMerge = { id: string, task_attempt_id: string, created_at: string, target_branch_name: string, pr_info: PullRequestInfo, };
export type MergeStatus = "open" | "merged" | "closed" | "unknown";
export type PullRequestInfo = { number: bigint, url: string, status: MergeStatus, merged_at: string | null, merge_commit_sha: string | null, };
export type EventPatch = { op: string, path: string, value: EventPatchInner, };
export type EventPatchInner = { db_op: string, record: RecordTypes, };
export type RecordTypes = { "type": "TASK", "data": Task } | { "type": "TASK_ATTEMPT", "data": TaskAttempt } | { "type": "EXECUTION_PROCESS", "data": ExecutionProcess } | { "type": "DELETED_TASK", "data": { rowid: bigint, } } | { "type": "DELETED_TASK_ATTEMPT", "data": { rowid: bigint, } } | { "type": "DELETED_EXECUTION_PROCESS", "data": { rowid: bigint, } };
export type CommandExitStatus = { "type": "exit_code", code: number, } | { "type": "success", success: boolean, };
export type CommandRunResult = { exit_status: CommandExitStatus | null, output: string | null, };
export type NormalizedConversation = { entries: Array<NormalizedEntry>, session_id: string | null, executor_type: string, prompt: string | null, summary: string | null, };
export type NormalizedEntry = { timestamp: string | null, entry_type: NormalizedEntryType, content: string, };
export type NormalizedEntryType = { "type": "user_message" } | { "type": "assistant_message" } | { "type": "tool_use", tool_name: string, action_type: ActionType, } | { "type": "system_message" } | { "type": "error_message" } | { "type": "thinking" };
export type FileChange = { "action": "write", content: string, } | { "action": "delete" } | { "action": "rename", new_path: string, } | { "action": "edit",
/**
* Unified diff containing file header and hunks.
*/
unified_diff: string,
/**
* Whether line number in the hunks are reliable.
*/
has_line_numbers: boolean, };
export type ActionType = { "action": "file_read", path: string, } | { "action": "file_edit", path: string, changes: Array<FileChange>, } | { "action": "command_run", command: string, result: CommandRunResult | null, } | { "action": "search", query: string, } | { "action": "web_fetch", url: string, } | { "action": "tool", tool_name: string, arguments: JsonValue | null, result: ToolResult | null, } | { "action": "task_create", description: string, } | { "action": "plan_presentation", plan: string, } | { "action": "todo_management", todos: Array<TodoItem>, operation: string, } | { "action": "other", description: string, };
export type TodoItem = { content: string, status: string, priority: string | null, };
export type ToolResult = { type: ToolResultValueType,
/**
* For Markdown, this will be a JSON string; for JSON, a structured value
*/
value: JsonValue, };
export type ToolResultValueType = { "type": "markdown" } | { "type": "json" };
export type PatchType = { "type": "NORMALIZED_ENTRY", "content": NormalizedEntry } | { "type": "STDOUT", "content": string } | { "type": "STDERR", "content": string } | { "type": "DIFF", "content": Diff };
export type JsonValue = number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null;