Files
Richard ZinkandClaude Opus 5.5 428e2df40a Add share target, prompt templates, command palette and session organisation
- PWA share target: shared text/links start a new chat or go into a
  recent session (chooser dialog)
- Prompt templates (personal + global for admins) with {{placeholders}}
  that are asked for on insert; managed under Settings → Templates
- Ctrl/Cmd+K command palette; Alt+N new session, Alt+Up/Down switch
  sessions, Ctrl+, settings
- Sessions can be pinned, archived and filed into folders; the list can
  be grouped by date or by project, groups are collapsible
- Fix: the "What's new" dialog was never shown to signed-in users

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 05:27:45 +01:00

62 lines
2.5 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { VitePWA } from "vite-plugin-pwa";
const backend = process.env.CODECRAFT_BACKEND ?? "http://127.0.0.1:8787";
const BUILD_ID = Date.now().toString(36);
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: "autoUpdate",
// A new file name per build: reverse proxies with "cache assets" (e.g. Nginx
// Proxy Manager) cache *.js by URL – a stale service worker would break
// updates and installation. /sw.js is a kill switch for old installations.
filename: `sw-${BUILD_ID}.js`,
injectRegister: false,
includeAssets: ["icon.svg", "apple-touch-icon.png"],
manifest: {
name: "CodeCraft",
short_name: "CodeCraft",
description: "Web-based coding harness for AI models",
theme_color: "#282828",
background_color: "#282828",
display: "standalone",
start_url: "/",
id: "/",
scope: "/",
orientation: "any",
categories: ["developer", "productivity"],
// Android "Share" sheet: text/links become a new chat or go into a recent one.
share_target: { action: "/", method: "GET", params: { title: "share_title", text: "share_text", url: "share_url" } },
icons: [
{ src: "icon-192.png", sizes: "192x192", type: "image/png" },
{ src: "icon-512.png", sizes: "512x512", type: "image/png" },
{ src: "icon-maskable-512.png", sizes: "512x512", type: "image/png", purpose: "maskable" },
{ src: "icon.svg", sizes: "any", type: "image/svg+xml" },
],
screenshots: [
{ src: "screenshots/wide.png", sizes: "1400x860", type: "image/png", form_factor: "wide", label: "Chat with an agent" },
{ src: "screenshots/narrow.png", sizes: "780x1688", type: "image/png", form_factor: "narrow", label: "CodeCraft on the phone" },
],
},
workbox: {
// The API is always live data; only the app shell is cached.
navigateFallbackDenylist: [/^\/api/, /^\/cli/],
runtimeCaching: [],
// The STEP importer (OpenCascade, ~8 MB) is loaded only when needed.
globIgnores: ["**/occt-import-js*", "**/screenshots/**", "sw.js"],
// Web Push handlers (push, notificationclick).
importScripts: ["push-sw.mjs"],
},
}),
],
server: {
proxy: {
"/api": { target: backend, ws: true, changeOrigin: true },
},
},
});