Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
feat: editor enhancements, switch back to code mirror editor (#1861)
Kyle Mendellbac28319b253
diff --git a/cli/go.mod b/cli/go.modindex 7794061c8..e7a3d7062 100644--- a/cli/go.mod+++ b/cli/go.mod@@ -59,9 +59,8 @@ require (github.com/pelletier/go-toml/v2 v2.2.4 // indirectgithub.com/rivo/uniseg v0.4.7 // indirectgithub.com/rogpeppe/go-internal v1.14.1 // indirect- github.com/sagikazarmark/locafero v0.11.0 // indirect+ github.com/sagikazarmark/locafero v0.12.0 // indirectgithub.com/sahilm/fuzzy v0.1.1 // indirect- github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirectgithub.com/spf13/afero v1.15.0 // indirectgithub.com/spf13/cast v1.10.0 // indirectgithub.com/spf13/pflag v1.0.10 // indirectdiff --git a/cli/go.sum b/cli/go.sumindex 44856e9be..efa506fed 100644--- a/cli/go.sum+++ b/cli/go.sum@@ -119,14 +119,11 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcgithub.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=-github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=-github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=+github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4=github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA=github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y=github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=-github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=-github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=diff --git a/frontend/package.json b/frontend/package.jsonindex 00680856d..3b942ff4b 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -1,75 +1,85 @@{- "name": "arcane-frontend",- "private": true,- "version": "1.15.3",- "type": "module",- "scripts": {- "dev": "vite dev --port 3000 --host",- "build": "vite build",- "preview": "vite preview --port 3000",- "lint-staged": "lint-staged",- "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",- "format": "prettier --write ./src",- "format:check": "prettier --check ./src",- "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",- "knip": "knip",- "i18n:unused": "i18n-unused display-unused",- "i18n:remove": "i18n-unused remove-unused",- "i18n:mark": "i18n-unused mark-unused"- },- "dependencies": {- "@shikijs/monaco": "^3.21.0",- "@sveltejs/adapter-static": "^3.0.10",- "@sveltejs/kit": "^2.53.0",- "@tanstack/svelte-query": "^6.0.18",- "@tanstack/table-core": "^8.21.3",- "@xterm/addon-fit": "^0.11.0",- "@xterm/xterm": "^6.0.0",- "ansi-to-html": "^0.7.2",- "axios": "^1.13.5",- "date-fns": "^4.1.0",- "js-yaml": "^4.1.1",- "monaco-editor": "^0.55.1",- "prettier": "^3.8.0",- "prettier-plugin-svelte": "^3.5.0",- "prettier-plugin-tailwindcss": "^0.7.2",- "shiki": "^3.22.0",- "svelte": "^5.51.5",- "svelte-motion": "^0.12.2"- },- "devDependencies": {- "@iconify/json": "^2.2.441",- "@inlang/paraglide-js": "2.9.1",- "@internationalized/date": "^3.11.0",- "@prettier/plugin-oxc": "^0.1.3",- "@sveltejs/vite-plugin-svelte": "^6.2.4",- "@tailwindcss/vite": "^4.1.18",- "@tanstack/eslint-plugin-query": "^5.91.4",- "@tanstack/svelte-query-devtools": "^6.0.4",- "@types/js-yaml": "^4.0.9",- "@types/node": "^25.0.10",- "bits-ui": "^2.15.5",- "clsx": "^2.1.1",- "formsnap": "^2.0.1",- "isomorphic-dompurify": "^3.0.0",- "knip": "^5.82.1",- "mode-watcher": "^1.1.0",- "paneforge": "^1.0.2",- "runed": "^0.37.0",- "svelte-check": "^4.3.5",- "svelte-sonner": "^1.0.7",- "svelte-toolbelt": "^0.10.6",- "sveltekit-superforms": "^2.29.1",- "tailwind-merge": "^3.4.0",- "tailwind-variants": "^3.2.2",- "tailwindcss": "^4.2.0",- "tsx": "^4.21.0",- "tw-animate-css": "^1.4.0",- "typescript": "^5.9.3",- "unplugin-icons": "^23.0.1",- "vaul-svelte": "1.0.0-next.7",- "vite": "^7.3.1",- "vite-plugin-devtools-json": "^1.0.0",- "zod": "^4.3.6"- }+ "name": "arcane-frontend",+ "private": true,+ "version": "1.15.3",+ "type": "module",+ "scripts": {+ "dev": "vite dev --port 3000 --host",+ "build": "vite build",+ "preview": "vite preview --port 3000",+ "lint-staged": "lint-staged",+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",+ "format": "prettier --write ./src",+ "format:check": "prettier --check ./src",+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",+ "knip": "knip",+ "i18n:unused": "i18n-unused display-unused",+ "i18n:remove": "i18n-unused remove-unused",+ "i18n:mark": "i18n-unused mark-unused"+ },+ "dependencies": {+ "@codemirror/autocomplete": "^6.20.0",+ "@codemirror/lang-yaml": "^6.1.2",+ "@codemirror/language": "^6.11.3",+ "@codemirror/legacy-modes": "^6.5.2",+ "@codemirror/lint": "^6.9.1",+ "@codemirror/merge": "^6.12.0",+ "@codemirror/state": "^6.5.2",+ "@codemirror/view": "^6.38.8",+ "@lezer/highlight": "^1.2.3",+ "@sveltejs/adapter-static": "^3.0.10",+ "@sveltejs/kit": "^2.53.0",+ "@tanstack/svelte-query": "^6.0.18",+ "@tanstack/table-core": "^8.21.3",+ "@uiw/codemirror-themes": "^4.25.2",+ "@xterm/addon-fit": "^0.11.0",+ "@xterm/xterm": "^6.0.0",+ "ajv": "^8.18.0",+ "ansi-to-html": "^0.7.2",+ "axios": "^1.13.5",+ "date-fns": "^4.1.0",+ "js-yaml": "^4.1.1",+ "prettier": "^3.8.0",+ "prettier-plugin-svelte": "^3.5.0",+ "prettier-plugin-tailwindcss": "^0.7.2",+ "svelte": "^5.51.5",+ "svelte-codemirror-editor": "^2.1.0",+ "svelte-motion": "^0.12.2",+ "yaml": "^2.8.2"+ },+ "devDependencies": {+ "@iconify/json": "^2.2.441",+ "@inlang/paraglide-js": "2.9.1",+ "@internationalized/date": "^3.11.0",+ "@prettier/plugin-oxc": "^0.1.3",+ "@sveltejs/vite-plugin-svelte": "^6.2.4",+ "@tailwindcss/vite": "^4.1.18",+ "@tanstack/eslint-plugin-query": "^5.91.4",+ "@tanstack/svelte-query-devtools": "^6.0.4",+ "@types/js-yaml": "^4.0.9",+ "@types/node": "^25.0.10",+ "bits-ui": "^2.15.5",+ "clsx": "^2.1.1",+ "formsnap": "^2.0.1",+ "isomorphic-dompurify": "^3.0.0",+ "knip": "^5.82.1",+ "mode-watcher": "^1.1.0",+ "paneforge": "^1.0.2",+ "runed": "^0.37.0",+ "svelte-check": "^4.3.5",+ "svelte-sonner": "^1.0.7",+ "svelte-toolbelt": "^0.10.6",+ "sveltekit-superforms": "^2.29.1",+ "tailwind-merge": "^3.4.0",+ "tailwind-variants": "^3.2.2",+ "tailwindcss": "^4.2.0",+ "tsx": "^4.21.0",+ "tw-animate-css": "^1.4.0",+ "typescript": "^5.9.3",+ "unplugin-icons": "^23.0.1",+ "vaul-svelte": "1.0.0-next.7",+ "vite": "^7.3.1",+ "vite-plugin-devtools-json": "^1.0.0",+ "zod": "^4.3.6"+ }}diff --git a/frontend/src/lib/components/code-editor/analysis/compose-analysis.ts b/frontend/src/lib/components/code-editor/analysis/compose-analysis.tsnew file mode 100644index 000000000..aff79e2d8--- /dev/null+++ b/frontend/src/lib/components/code-editor/analysis/compose-analysis.ts@@ -0,0 +1,532 @@+import type { ErrorObject } from 'ajv';+import type { Diagnostic } from '@codemirror/lint';+import type { EditorView } from '@codemirror/view';+import { LineCounter, isMap, isPair, isScalar, isSeq, parseDocument, type Pair, type ParsedNode, type Scalar } from 'yaml';+import type { AnalysisResult, EditorContext, OutlineItem } from './types';+import type { ComposeSchemaContext } from './compose-schema';+import { getMissingComposeVariables, resolveVariableSource } from './vars-analysis';++const MAX_SCHEMA_DIAGNOSTICS_DEFAULT = 30;+const TAB_INDENT_REGEX = /(^|\n)(\t+)/g;+const SECRET_NAME_REGEX = /(password|passwd|secret|token|api[_-]?key|private[_-]?key|credential|aws_secret)/i;+const SECRET_VALUE_REGEX = /(?:-----BEGIN [A-Z ]+-----|eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+|[A-Za-z0-9_\/-]{24,})/;+const VARIABLE_TOKEN_REGEX = /\$\{([A-Za-z_][A-Za-z0-9_]*)(?:(?::[-?+])[^}]*)?\}|\$([A-Za-z_][A-Za-z0-9_]*)/g;+const LIST_FIELDS = ['volumes', 'ports', 'env_file', 'dns', 'tmpfs'];++type YamlDocLike = {+ getIn: (path: Array<string | number>, keepScalar?: boolean) => unknown;+ contents?: ParsedNode | null;+ errors: Array<{ message?: string; pos?: [number, number] }>;+ toJS: () => unknown;+};++export type YamlPositionContext = {+ path: Array<string | number>;+ parentPath: Array<string | number>;+ currentKey?: string;+ atKey: boolean;+ keyFrom?: number;+ keyTo?: number;+};++function decodePointerSegment(segment: string): string {+ return segment.replace(/~1/g, '/').replace(/~0/g, '~');+}++function pointerToPath(pointer: string): Array<string | number> {+ if (!pointer) return [];+ return pointer+ .split('/')+ .slice(1)+ .filter((segment) => segment.length > 0)+ .map((segment) => {+ const decoded = decodePointerSegment(segment);+ return /^\d+$/.test(decoded) ? Number(decoded) : decoded;+ });+}++function getObjectValue(source: unknown, key: string): unknown {+ if (!source || typeof source !== 'object' || Array.isArray(source)) return undefined;+ return (source as Record<string, unknown>)[key];+}++function getRange(node: unknown): [number, number] | null {+ if (!node || typeof node !== 'object') return null;+ const range = (node as { range?: [number, number, number] }).range;+ if (!range || range.length < 2) return null;+ return [range[0], range[1]];+}++function containsPosition(node: unknown, position: number): boolean {+ const range = getRange(node);+ if (!range) return false;+ return position >= range[0] && position <= range[1];+}++function scalarToKey(value: unknown): string | null {+ if (!isScalar(value)) return null;+ const scalarValue = (value as Scalar<unknown>).value;+ if (typeof scalarValue === 'string' || typeof scalarValue === 'number') {+ return String(scalarValue);+ }+ return null;+}++function findContextInNode(+ node: ParsedNode | null | undefined,+ position: number,+ path: Array<string | number>+): YamlPositionContext | null {+ if (!node) return null;+ if (!containsPosition(node, position)) return null;++ if (isMap(node)) {+ for (const pair of node.items) {+ if (!isPair(pair)) continue;++ const key = scalarToKey(pair.key);+ const keyRange = getRange(pair.key);+ if (key && keyRange && position >= keyRange[0] && position <= keyRange[1]) {+ return {+ path: [...path, key],+ parentPath: [...path],+ currentKey: key,+ atKey: true,+ keyFrom: keyRange[0],+ keyTo: keyRange[1]+ };+ }++ if (key && pair.value && containsPosition(pair.value, position)) {+ const nested = findContextInNode(pair.value as ParsedNode, position, [...path, key]);+ if (nested) return nested;+ return {+ path: [...path, key],+ parentPath: [...path],+ currentKey: key,+ atKey: false,+ keyFrom: keyRange?.[0],+ keyTo: keyRange?.[1]+ };+ }+ }++ return {+ path: [...path],+ parentPath: [...path],+ atKey: false+ };+ }++ if (isSeq(node)) {+ for (let index = 0; index < node.items.length; index += 1) {+ const item = node.items[index] as ParsedNode | null;+ if (!item) continue;+ if (!containsPosition(item, position)) continue;+ const nested = findContextInNode(item, position, [...path, index]);+ if (nested) return nested;+ return {+ path: [...path, index],+ parentPath: [...path],+ atKey: false+ };+ }+ }++ return {+ path: [...path],+ parentPath: path.slice(0, -1),+ atKey: false+ };+}++export function findYamlPositionContext(source: string, position: number): YamlPositionContext | null {+ const doc = parseDocument(source, { strict: true, uniqueKeys: false });+ return findContextInNode((doc.contents as ParsedNode | null) ?? null, position, []);+}++function escapeRegExp(value: string): string {+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+}++function getNodeRangeByPath(doc: YamlDocLike, path: Array<string | number>): { from: number; to: number } | null {+ const node = doc.getIn(path, true) as { range?: [number, number, number] } | null;+ const range = node?.range;+ if (!range || range.length < 2) return null;+ return {+ from: range[0],+ to: Math.max(range[0] + 1, range[1])+ };+}++function findKeyRangeInSource(source: string, key: string): { from: number; to: number } | null {+ const keyRegex = new RegExp(`^\\s*${escapeRegExp(key)}\\s*:`, 'm');+ const match = keyRegex.exec(source);+ if (!match || match.index < 0) return null;+ return {+ from: match.index,+ to: Math.min(source.length, match.index + Math.max(1, key.length))+ };+}++function toSchemaDiagnostic(error: ErrorObject, doc: YamlDocLike, source: string): Diagnostic {+ const path = pointerToPath(error.instancePath || '');+ const params = error.params as Record<string, unknown>;+ const missingProperty = typeof params.missingProperty === 'string' ? params.missingProperty : null;+ const additionalProperty = typeof params.additionalProperty === 'string' ? params.additionalProperty : null;++ const range = getNodeRangeByPath(doc, path) ||+ (missingProperty ? findKeyRangeInSource(source, missingProperty) : null) ||+ (additionalProperty ? findKeyRangeInSource(source, additionalProperty) : null) || {+ from: 0,+ to: Math.min(source.length, 1)+ };++ let message = `${error.instancePath || '/'} ${error.message || 'is invalid'}`;+ if (error.keyword === 'required' && missingProperty) {+ message = `Missing required property "${missingProperty}"`;+ }+ if (error.keyword === 'additionalProperties' && additionalProperty) {+ message = `Unsupported property "${additionalProperty}"`;+ }++ return {+ from: range.from,+ to: range.to,+ severity: 'error',+ message+ };+}++function collectDuplicateKeyDiagnostics(node: ParsedNode | null | undefined, diagnostics: Diagnostic[]): number {+ if (!node) return 0;+ let duplicateCount = 0;++ if (isMap(node)) {+ const seen = new Set<string>();+ for (const item of node.items) {+ if (!isPair(item)) continue;+ const key = scalarToKey(item.key);+ if (key) {+ const keyRange = getRange(item.key);+ if (seen.has(key)) {+ duplicateCount += 1;+ diagnostics.push({+ from: keyRange?.[0] ?? 0,+ to: Math.max((keyRange?.[0] ?? 0) + 1, keyRange?.[1] ?? 1),+ severity: 'error',+ message: `Duplicate YAML key "${key}"`+ });+ }+ seen.add(key);+ }++ duplicateCount += collectDuplicateKeyDiagnostics(item.value as ParsedNode | null, diagnostics);+ }+ }++ if (isSeq(node)) {+ for (const item of node.items) {+ duplicateCount += collectDuplicateKeyDiagnostics(item as ParsedNode | null, diagnostics);+ }+ }++ return duplicateCount;+}++function buildTabDiagnostics(source: string): Diagnostic[] {+ const diagnostics: Diagnostic[] = [];+ for (const match of source.matchAll(TAB_INDENT_REGEX)) {+ const tabs = match[2] || '';+ const newlineLength = match[1] === '\n' ? 1 : 0;+ const start = (match.index ?? 0) + newlineLength;+ diagnostics.push({+ from: start,+ to: Math.max(start + 1, start + tabs.length),+ severity: 'error',+ message: 'Tabs are not allowed for YAML indentation. Use spaces only.',+ actions: [+ {+ name: 'Convert tabs to spaces',+ apply(view: EditorView, from: number, to: number) {+ const text = view.state.doc.sliceString(from, to);+ view.dispatch({+ changes: {+ from,+ to,+ insert: text.replace(/\t/g, ' ')+ }+ });+ }+ }+ ]+ });+ }++ return diagnostics;+}++function addMissingHyphenQuickFix(fieldName: string, serviceName: string, range: { from: number; to: number }): Diagnostic {+ return {+ from: range.from,+ to: range.to,+ severity: 'error',+ message: `Service "${serviceName}" ${fieldName} must be a list. Prefix each item with '-'.`,+ actions: [+ {+ name: 'Insert list marker',+ apply(view: EditorView) {+ const doc = view.state.doc;+ const fieldLineNumber = doc.lineAt(range.from).number;+ for (let current = fieldLineNumber + 1; current <= doc.lines; current += 1) {+ const line = doc.line(current);+ const trimmed = line.text.trim();+ if (!trimmed) continue;+ if (trimmed.startsWith('-')) return;+ const indent = line.text.match(/^\s*/)?.[0] ?? '';+ view.dispatch({+ changes: {+ from: line.from + indent.length,+ insert: '- '+ }+ });+ return;+ }+ }+ }+ ]+ };+}++function buildComposeSemanticDiagnostics(parsedValue: unknown, doc: YamlDocLike): Diagnostic[] {+ if (!parsedValue || typeof parsedValue !== 'object' || Array.isArray(parsedValue)) return [];+ const services = getObjectValue(parsedValue, 'services');+ if (!services || typeof services !== 'object' || Array.isArray(services)) return [];++ const diagnostics: Diagnostic[] = [];++ for (const [serviceName, serviceValue] of Object.entries(services as Record<string, unknown>)) {+ if (!serviceValue || typeof serviceValue !== 'object' || Array.isArray(serviceValue)) continue;++ for (const field of LIST_FIELDS) {+ const value = getObjectValue(serviceValue, field);+ if (!value || Array.isArray(value) || typeof value !== 'object') continue;+ const range = getNodeRangeByPath(doc, ['services', serviceName, field]) || { from: 0, to: 1 };+ diagnostics.push(addMissingHyphenQuickFix(field, serviceName, range));+ }+ }++ return diagnostics;+}++function buildMissingVariableDiagnostics(+ source: string,+ context: EditorContext+): { diagnostics: Diagnostic[]; unresolved: string[] } {+ const unresolved = getMissingComposeVariables(context, source);+ if (unresolved.length === 0) return { diagnostics: [], unresolved: [] };++ const unresolvedSet = new Set(unresolved);+ const diagnostics: Diagnostic[] = [];++ for (const match of source.matchAll(VARIABLE_TOKEN_REGEX)) {+ const whole = match[0] ?? '';+ const name = match[1] || match[2];+ if (!name || !unresolvedSet.has(name)) continue;+ const from = match.index ?? 0;+ const to = Math.max(from + 1, from + whole.length);+ diagnostics.push({+ from,+ to,+ severity: 'warning',+ message: `Variable "${name}" is not defined in .env or global variables.`+ });+ }++ return { diagnostics, unresolved };+}++function buildSecretDiagnostics(source: string): Diagnostic[] {+ const diagnostics: Diagnostic[] = [];+ const lines = source.split('\n');+ let offset = 0;++ for (const rawLine of lines) {+ const line = rawLine.endsWith('\r') ? rawLine.slice(0, -1) : rawLine;+ const match = /^(\s*)([A-Za-z0-9_.-]+)\s*:\s*(.+)$/.exec(line);+ if (!match) {+ offset += rawLine.length + 1;+ continue;+ }++ const key = match[2] ?? '';+ const value = (match[3] ?? '').trim();+ if (!SECRET_NAME_REGEX.test(key) && !SECRET_VALUE_REGEX.test(value)) {+ offset += rawLine.length + 1;+ continue;+ }++ const keyIndex = line.indexOf(key);+ const from = offset + Math.max(0, keyIndex);+ const to = from + Math.max(1, key.length);+ diagnostics.push({+ from,+ to,+ severity: 'warning',+ message: `"${key}" looks like a secret. Prefer Docker secrets or external secret managers.`+ });++ offset += rawLine.length + 1;+ }++ return diagnostics;+}++function buildOutline(doc: YamlDocLike): OutlineItem[] {+ const outline: OutlineItem[] = [];+ const sections = ['services', 'networks', 'volumes', 'configs', 'secrets'];++ for (const section of sections) {+ const sectionNode = doc.getIn([section], true) as { range?: [number, number, number] } | undefined;+ const sectionRange = sectionNode?.range;+ if (!sectionRange) continue;++ outline.push({+ id: `outline:${section}`,+ label: section,+ path: [section],+ from: sectionRange[0],+ to: Math.max(sectionRange[0] + 1, sectionRange[1]),+ level: 0+ });++ const value = doc.getIn([section]) as unknown;+ if (!value || typeof value !== 'object' || Array.isArray(value)) continue;++ for (const key of Object.keys(value as Record<string, unknown>)) {+ const node = doc.getIn([section, key], true) as { range?: [number, number, number] } | undefined;+ const range = node?.range;+ if (!range) continue;++ outline.push({+ id: `outline:${section}:${key}`,+ label: key,+ path: [section, key],+ from: range[0],+ to: Math.max(range[0] + 1, range[1]),+ level: 1+ });+ }+ }++ return outline;+}++export function findVariableReferenceAtPosition(+ source: string,+ position: number+): { name: string; source: 'env' | 'global' | 'missing' } | null {+ for (const match of source.matchAll(VARIABLE_TOKEN_REGEX)) {+ const name = match[1] || match[2];+ if (!name) continue;+ const whole = match[0] ?? '';+ const from = match.index ?? 0;+ const to = from + whole.length;+ if (position < from || position > to) continue;+ return { name, source: 'missing' };+ }++ return null;+}++export async function analyzeComposeContent(+ view: EditorView,+ schemaContext: ComposeSchemaContext,+ editorContext: EditorContext,+ maxSchemaDiagnostics = MAX_SCHEMA_DIAGNOSTICS_DEFAULT+): Promise<AnalysisResult> {+ const source = view.state.doc.toString();+ const lineCounter = new LineCounter();+ const doc = parseDocument(source, {+ lineCounter,+ strict: true,+ uniqueKeys: false+ }) as unknown as YamlDocLike;++ const diagnostics: Diagnostic[] = [];+ diagnostics.push(...buildTabDiagnostics(source));++ for (const error of doc.errors) {+ const start = error.pos?.[0] ?? 0;+ const end = error.pos?.[1] ?? Math.min(source.length, start + 1);+ diagnostics.push({+ from: start,+ to: Math.max(start + 1, end),+ severity: 'error',+ message: error.message || 'YAML syntax error'+ });+ }++ const duplicateKeyWarnings = collectDuplicateKeyDiagnostics(doc.contents ?? null, diagnostics);++ let outlineItems: OutlineItem[] = [];+ let unresolvedVariables: string[] = [];+ let secretWarnings = 0;++ if (diagnostics.every((item) => item.severity !== 'error')) {+ try {+ const parsedValue = doc.toJS();+ outlineItems = buildOutline(doc);++ if (schemaContext.validate) {+ const isValid = schemaContext.validate(parsedValue);+ if (!isValid) {+ for (const error of (schemaContext.validate.errors || []).slice(0, maxSchemaDiagnostics)) {+ diagnostics.push(toSchemaDiagnostic(error, doc, source));+ }+ }+ }++ diagnostics.push(...buildComposeSemanticDiagnostics(parsedValue, doc));++ const missing = buildMissingVariableDiagnostics(source, editorContext);+ unresolvedVariables = missing.unresolved;+ diagnostics.push(...missing.diagnostics);++ const secretDiagnostics = buildSecretDiagnostics(source);+ secretWarnings = secretDiagnostics.length;+ diagnostics.push(...secretDiagnostics);+ } catch {+ diagnostics.push({+ from: 0,+ to: Math.min(1, source.length || 1),+ severity: 'error',+ message: 'YAML parsing failed'+ });+ }+ }++ return {+ diagnostics,+ outlineItems,+ summaryPatch: {+ duplicateKeyWarnings,+ secretWarnings,+ unresolvedVariables+ }+ };+}++export function resolveVariableSourceAtPosition(+ source: string,+ position: number,+ editorContext: EditorContext+): { name: string; source: 'env' | 'global' | 'missing' } | null {+ const ref = findVariableReferenceAtPosition(source, position);+ if (!ref) return null;+ const resolved = resolveVariableSource(ref.name, editorContext);+ return {+ name: ref.name,+ source: resolved ?? 'missing'+ };+}diff --git a/frontend/src/lib/components/code-editor/analysis/compose-schema.ts b/frontend/src/lib/components/code-editor/analysis/compose-schema.tsnew file mode 100644index 000000000..65e19a14d--- /dev/null+++ b/frontend/src/lib/components/code-editor/analysis/compose-schema.ts@@ -0,0 +1,319 @@+import Ajv, { type ValidateFunction } from 'ajv';+import type { Completion } from '@codemirror/autocomplete';+import { browser } from '$app/environment';+import type { SchemaDoc, SchemaStatus } from './types';++export const DOCKER_COMPOSE_SCHEMA_URL =+ 'https://raw.githubusercontent.com/compose-spec/compose-go/refs/heads/main/schema/compose-spec.json';++const SCHEMA_CACHE_KEY = 'arcane.compose.schema.v1';++type SchemaObject = Record<string, unknown>;++type ComposeSchemaContext = {+ schema: SchemaObject | null;+ validate: ValidateFunction<unknown> | null;+ status: SchemaStatus;+ message?: string;+};++let composeSchemaPromise: Promise<ComposeSchemaContext> | null = null;+let composeSchemaContext: ComposeSchemaContext | null = null;++function asSchemaObject(value: unknown): SchemaObject | null {+ if (!value || typeof value !== 'object' || Array.isArray(value)) return null;+ return value as SchemaObject;+}++function readCachedSchema(): SchemaObject | null {+ if (!browser) return null;+ try {+ const raw = localStorage.getItem(SCHEMA_CACHE_KEY);+ if (!raw) return null;+ const parsed = JSON.parse(raw) as unknown;+ return asSchemaObject(parsed);+ } catch {+ return null;+ }+}++function writeCachedSchema(schema: SchemaObject): void {+ if (!browser) return;+ try {+ localStorage.setItem(SCHEMA_CACHE_KEY, JSON.stringify(schema));+ } catch {+ // ignore cache write failures+ }+}++function createValidator(schema: SchemaObject): ValidateFunction<unknown> {+ const ajv = new Ajv({+ allErrors: true,+ strict: false,+ strictSchema: false,+ allowUnionTypes: true,+ validateFormats: false,+ validateSchema: false+ });++ return ajv.compile(schema);+}++function resolveRef(root: SchemaObject, ref: string, visited: Set<string>): SchemaObject | null {+ if (!ref.startsWith('#/')) return null;+ if (visited.has(ref)) return null;+ visited.add(ref);++ const segments = ref+ .slice(2)+ .split('/')+ .map((segment) => segment.replace(/~1/g, '/').replace(/~0/g, '~'));++ let current: unknown = root;+ for (const segment of segments) {+ if (!current || typeof current !== 'object') return null;+ current = (current as SchemaObject)[segment];+ }++ return asSchemaObject(current);+}++function expandCandidates(root: SchemaObject, candidate: SchemaObject, visited: Set<string>): SchemaObject[] {+ const expanded: SchemaObject[] = [];+ const ref = candidate.$ref;+ if (typeof ref === 'string') {+ const resolved = resolveRef(root, ref, visited);+ if (resolved) {+ expanded.push(...expandCandidates(root, resolved, visited));+ }+ }++ const containers = ['allOf', 'anyOf', 'oneOf'];+ for (const container of containers) {+ const node = candidate[container];+ if (Array.isArray(node)) {+ for (const item of node) {+ const asObject = asSchemaObject(item);+ if (asObject) expanded.push(...expandCandidates(root, asObject, visited));+ }+ }+ }++ expanded.push(candidate);++ const unique = new Set<SchemaObject>();+ const normalized: SchemaObject[] = [];+ for (const item of expanded) {+ if (unique.has(item)) continue;+ unique.add(item);+ normalized.push(item);+ }++ return normalized;+}++function getPathCandidates(root: SchemaObject, path: Array<string | number>): SchemaObject[] {+ let candidates: SchemaObject[] = [root];++ for (const segment of path) {+ const nextCandidates: SchemaObject[] = [];++ for (const candidate of candidates) {+ const expanded = expandCandidates(root, candidate, new Set<string>());+ for (const node of expanded) {+ if (typeof segment === 'number') {+ const prefixItems = node.prefixItems;+ if (Array.isArray(prefixItems) && segment < prefixItems.length) {+ const fromPrefix = asSchemaObject(prefixItems[segment]);+ if (fromPrefix) nextCandidates.push(fromPrefix);+ }++ const items = asSchemaObject(node.items);+ if (items) nextCandidates.push(items);+ continue;+ }++ const properties = asSchemaObject(node.properties);+ if (properties) {+ const fromProperty = asSchemaObject(properties[segment]);+ if (fromProperty) nextCandidates.push(fromProperty);+ }++ const patternProperties = asSchemaObject(node.patternProperties);+ if (patternProperties) {+ for (const patternValue of Object.values(patternProperties)) {+ const fromPattern = asSchemaObject(patternValue);+ if (fromPattern) nextCandidates.push(fromPattern);+ }+ }++ const additionalProperties = asSchemaObject(node.additionalProperties);+ if (additionalProperties) nextCandidates.push(additionalProperties);+ }+ }++ const unique = new Set<SchemaObject>();+ candidates = [];+ for (const candidate of nextCandidates) {+ if (unique.has(candidate)) continue;+ unique.add(candidate);+ candidates.push(candidate);+ }++ if (candidates.length === 0) break;+ }++ return candidates;+}++function collectPropertySchemas(root: SchemaObject, path: Array<string | number>): Map<string, SchemaObject> {+ const map = new Map<string, SchemaObject>();+ const candidates = getPathCandidates(root, path);++ for (const candidate of candidates) {+ const expanded = expandCandidates(root, candidate, new Set<string>());+ for (const node of expanded) {+ const properties = asSchemaObject(node.properties);+ if (!properties) continue;+ for (const [key, value] of Object.entries(properties)) {+ const propertySchema = asSchemaObject(value);+ if (propertySchema) {+ map.set(key, propertySchema);+ }+ }+ }+ }++ return map;+}++function extractSchemaDoc(schema: SchemaObject): SchemaDoc {+ const title = typeof schema.title === 'string' ? schema.title : undefined;+ const description = typeof schema.description === 'string' ? schema.description : undefined;+ const defaultValue = schema.default !== undefined ? JSON.stringify(schema.default) : undefined;+ let examples: string[] | undefined;++ if (Array.isArray(schema.examples)) {+ examples = schema.examples.slice(0, 3).map((value) => JSON.stringify(value));+ }++ return {+ title,+ description,+ defaultValue,+ examples+ };+}++export async function getComposeSchemaContext(): Promise<ComposeSchemaContext> {+ if (composeSchemaContext) return composeSchemaContext;+ if (composeSchemaPromise) return composeSchemaPromise;++ composeSchemaPromise = (async () => {+ try {+ const response = await fetch(DOCKER_COMPOSE_SCHEMA_URL, { cache: 'no-store' });+ if (!response.ok) {+ throw new Error(`HTTP ${response.status}`);+ }++ const payload = (await response.json()) as unknown;+ const schema = asSchemaObject(payload);+ if (!schema) throw new Error('Invalid compose schema payload');++ writeCachedSchema(schema);+ composeSchemaContext = {+ schema,+ validate: createValidator(schema),+ status: 'ready'+ };+ return composeSchemaContext;+ } catch (error) {+ const cached = readCachedSchema();+ if (cached) {+ composeSchemaContext = {+ schema: cached,+ validate: createValidator(cached),+ status: 'cached',+ message: 'Using cached Docker Compose schema'+ };+ return composeSchemaContext;+ }++ composeSchemaContext = {+ schema: null,+ validate: null,+ status: 'unavailable',+ message: error instanceof Error ? error.message : 'Schema unavailable'+ };+ return composeSchemaContext;+ } finally {+ composeSchemaPromise = null;+ }+ })();++ return composeSchemaPromise;+}++export function getCompletionOptionsForPath(+ schema: SchemaObject | null,+ path: Array<string | number>,+ prefix = ''+): Completion[] {+ if (!schema) return [];+ const map = collectPropertySchemas(schema, path);+ const normalizedPrefix = prefix.toLowerCase();++ return Array.from(map.entries())+ .filter(([key]) => key.toLowerCase().includes(normalizedPrefix))+ .sort(([a], [b]) => a.localeCompare(b))+ .map(([key]) => {+ const doc = extractSchemaDoc(map.get(key) ?? {});+ return {+ label: key,+ type: 'property',+ detail: doc.title,+ info: doc.description,+ apply: `${key}: `+ } as Completion;+ });+}++export function getEnumValueCompletions(schema: SchemaObject | null, path: Array<string | number>): Completion[] {+ if (!schema) return [];+ const candidates = getPathCandidates(schema, path);+ const values = new Set<string>();++ for (const candidate of candidates) {+ const expanded = expandCandidates(schema, candidate, new Set<string>());+ for (const node of expanded) {+ if (!Array.isArray(node.enum)) continue;+ for (const value of node.enum) {+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {+ values.add(String(value));+ }+ }+ }+ }++ return Array.from(values)+ .sort((a, b) => a.localeCompare(b))+ .map((value) => ({+ label: value,+ type: 'enum',+ apply: /^\d+$/.test(value) || value === 'true' || value === 'false' ? value : JSON.stringify(value)+ }));+}++export function getSchemaDocForPath(schema: SchemaObject | null, path: Array<string | number>): SchemaDoc | null {+ if (!schema) return null;+ const candidates = getPathCandidates(schema, path);+ for (const candidate of candidates) {+ const doc = extractSchemaDoc(candidate);+ if (doc.title || doc.description || doc.defaultValue || (doc.examples && doc.examples.length > 0)) {+ return doc;+ }+ }+ return null;+}++export type { ComposeSchemaContext, SchemaObject };diff --git a/frontend/src/lib/components/code-editor/analysis/env-analysis.ts b/frontend/src/lib/components/code-editor/analysis/env-analysis.tsnew file mode 100644index 000000000..0a9ff0b8a--- /dev/null+++ b/frontend/src/lib/components/code-editor/analysis/env-analysis.ts@@ -0,0 +1,173 @@+import type { EditorView } from '@codemirror/view';+import type { Diagnostic } from '@codemirror/lint';+import type { AnalysisResult, EditorContext, OutlineItem } from './types';+import { extractComposeVariables } from './vars-analysis';++const ENV_KEY_REGEX = /^[A-Za-z_][A-Za-z0-9_]*$/;+const SECRET_NAME_REGEX = /(password|passwd|secret|token|api[_-]?key|private[_-]?key|credential|aws_secret)/i;+const SECRET_VALUE_REGEX = /(?:-----BEGIN [A-Z ]+-----|eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+|[A-Za-z0-9_\/-]{24,})/;++type ParsedEnvLine = {+ lineNumber: number;+ from: number;+ to: number;+ key: string;+ value: string;+ keyFrom: number;+ keyTo: number;+};++function parseEnv(source: string): {+ entries: ParsedEnvLine[];+ diagnostics: Diagnostic[];+ duplicateKeys: number;+ secretWarnings: number;+} {+ const diagnostics: Diagnostic[] = [];+ const entries: ParsedEnvLine[] = [];+ const seen = new Map<string, ParsedEnvLine>();+ let duplicateKeys = 0;+ let secretWarnings = 0;++ const lines = source.split('\n');+ let offset = 0;++ for (let index = 0; index < lines.length; index += 1) {+ const rawLine = lines[index] ?? '';+ const line = rawLine.endsWith('\r') ? rawLine.slice(0, -1) : rawLine;+ const lineNumber = index + 1;+ const lineFrom = offset;+ const lineTo = offset + line.length;++ offset += rawLine.length + 1;++ const trimmed = line.trim();+ if (!trimmed || trimmed.startsWith('#')) continue;++ const valueLine = trimmed.startsWith('export ') ? trimmed.slice(7).trim() : trimmed;+ const separator = valueLine.indexOf('=');+ if (separator < 0) {+ diagnostics.push({+ from: lineFrom,+ to: Math.max(lineFrom + 1, lineTo),+ severity: 'error',+ message: 'Malformed .env line. Use KEY=value syntax.'+ });+ continue;+ }++ const key = valueLine.slice(0, separator).trim();+ const value = valueLine.slice(separator + 1).trim();++ const keyIndexInRaw = line.indexOf(key);+ const keyFrom = keyIndexInRaw >= 0 ? lineFrom + keyIndexInRaw : lineFrom;+ const keyTo = keyFrom + Math.max(1, key.length);++ if (!ENV_KEY_REGEX.test(key)) {+ diagnostics.push({+ from: keyFrom,+ to: keyTo,+ severity: 'error',+ message: `Invalid variable name "${key}". Use letters, numbers and underscore only.`+ });+ continue;+ }++ const parsed: ParsedEnvLine = {+ lineNumber,+ from: lineFrom,+ to: Math.max(lineFrom + 1, lineTo),+ key,+ value,+ keyFrom,+ keyTo+ };++ if (seen.has(key)) {+ const previous = seen.get(key);+ duplicateKeys += 1;+ diagnostics.push({+ from: keyFrom,+ to: keyTo,+ severity: 'warning',+ message: `Duplicate variable "${key}". Last value wins.`,+ actions: [+ {+ name: 'Remove earlier duplicate',+ apply(view: EditorView) {+ const doc = view.state.doc;+ const targetLineNumber = previous?.lineNumber ?? lineNumber;+ if (targetLineNumber < 1 || targetLineNumber > doc.lines) return;+ const lineInfo = doc.line(targetLineNumber);+ const removeTo = lineInfo.number < doc.lines ? doc.line(targetLineNumber + 1).from : lineInfo.to;+ view.dispatch({+ changes: { from: lineInfo.from, to: removeTo, insert: '' }+ });+ }+ }+ ]+ });+ }++ seen.set(key, parsed);+ entries.push(parsed);++ if (SECRET_NAME_REGEX.test(key) || SECRET_VALUE_REGEX.test(value)) {+ secretWarnings += 1;+ diagnostics.push({+ from: keyFrom,+ to: keyTo,+ severity: 'warning',+ message: `"${key}" looks like a secret. Consider using Docker secrets or external secret management.`+ });+ }+ }++ return { entries, diagnostics, duplicateKeys, secretWarnings };+}++function makeOutlineItems(entries: ParsedEnvLine[]): OutlineItem[] {+ return entries.map((entry) => ({+ id: `env:${entry.key}:${entry.lineNumber}`,+ label: entry.key,+ path: [entry.key],+ from: entry.keyFrom,+ to: entry.keyTo,+ level: 0+ }));+}++function buildUnusedVarDiagnostics(entries: ParsedEnvLine[], context: EditorContext): Diagnostic[] {+ const referenced = extractComposeVariables(context.composeContents ?? []);+ if (referenced.size === 0) return [];++ const diagnostics: Diagnostic[] = [];+ for (const entry of entries) {+ if (!referenced.has(entry.key)) {+ diagnostics.push({+ from: entry.keyFrom,+ to: entry.keyTo,+ severity: 'warning',+ message: `Variable "${entry.key}" is not referenced in compose files.`+ });+ }+ }++ return diagnostics;+}++export function analyzeEnvContent(source: string, context: EditorContext): AnalysisResult {+ const parsed = parseEnv(source);+ const unusedDiagnostics = buildUnusedVarDiagnostics(parsed.entries, context);+ const diagnostics = [...parsed.diagnostics, ...unusedDiagnostics];+ const outlineItems = makeOutlineItems(parsed.entries);++ return {+ diagnostics,+ outlineItems,+ summaryPatch: {+ duplicateEnvWarnings: parsed.duplicateKeys,+ secretWarnings: parsed.secretWarnings+ }+ };+}diff --git a/frontend/src/lib/components/code-editor/analysis/types.ts b/frontend/src/lib/components/code-editor/analysis/types.tsnew file mode 100644index 000000000..56b390122--- /dev/null+++ b/frontend/src/lib/components/code-editor/analysis/types.ts@@ -0,0 +1,49 @@+import type { Diagnostic } from '@codemirror/lint';++export type CodeLanguage = 'yaml' | 'env';++export type SchemaStatus = 'ready' | 'cached' | 'unavailable';++export type EditorContext = {+ envContent?: string;+ composeContents?: string[];+ globalVariables?: Record<string, string>;+};++export type DiagnosticSummary = {+ errors: number;+ warnings: number;+ infos: number;+ hints: number;+ schemaStatus: SchemaStatus;+ schemaMessage?: string;+ unresolvedVariables: string[];+ secretWarnings: number;+ duplicateKeyWarnings: number;+ duplicateEnvWarnings: number;+ cursorLine: number;+ cursorCol: number;+ validationReady: boolean;+};++export type OutlineItem = {+ id: string;+ label: string;+ path: Array<string | number>;+ from: number;+ to: number;+ level: number;+};++export type SchemaDoc = {+ title?: string;+ description?: string;+ defaultValue?: string;+ examples?: string[];+};++export type AnalysisResult = {+ diagnostics: Diagnostic[];+ outlineItems: OutlineItem[];+ summaryPatch: Partial<DiagnosticSummary>;+};diff --git a/frontend/src/lib/components/code-editor/analysis/vars-analysis.ts b/frontend/src/lib/components/code-editor/analysis/vars-analysis.tsnew file mode 100644index 000000000..99d9d228f--- /dev/null+++ b/frontend/src/lib/components/code-editor/analysis/vars-analysis.ts@@ -0,0 +1,101 @@+import type { EditorContext } from './types';++const BRACED_VAR_REGEX = /\$\{([A-Za-z_][A-Za-z0-9_]*)(?:(?::[-?+])[^}]*)?\}/g;+const SIMPLE_VAR_REGEX = /(^|[^$])\$([A-Za-z_][A-Za-z0-9_]*)/g;+const ENV_KEY_REGEX = /^[A-Za-z_][A-Za-z0-9_]*$/;++export type VariableSource = 'env' | 'global';++export function extractComposeVariables(contents: string[]): Set<string> {+ const vars = new Set<string>();++ for (const content of contents) {+ for (const match of content.matchAll(BRACED_VAR_REGEX)) {+ if (match[1]) vars.add(match[1]);+ }++ for (const match of content.matchAll(SIMPLE_VAR_REGEX)) {+ if (match[2]) vars.add(match[2]);+ }+ }++ return vars;+}++export function parseEnvVariables(envContent: string): Map<string, string> {+ const values = new Map<string, string>();+ const lines = envContent.split(/\r?\n/);++ for (const rawLine of lines) {+ const trimmed = rawLine.trim();+ if (!trimmed || trimmed.startsWith('#')) continue;++ const line = trimmed.startsWith('export ') ? trimmed.slice(7).trim() : trimmed;+ const separator = line.indexOf('=');+ if (separator < 0) continue;++ const key = line.slice(0, separator).trim();+ if (!ENV_KEY_REGEX.test(key)) continue;++ const value = line.slice(separator + 1).trim();+ values.set(key, value);+ }++ return values;+}++export function buildVariableSourceMap(context: EditorContext): Map<string, VariableSource> {+ const source = new Map<string, VariableSource>();+ const envValues = parseEnvVariables(context.envContent ?? '');++ for (const key of envValues.keys()) {+ source.set(key, 'env');+ }++ for (const key of Object.keys(context.globalVariables ?? {})) {+ if (!source.has(key)) {+ source.set(key, 'global');+ }+ }++ return source;+}++export function resolveVariableSource(variableName: string, context: EditorContext): VariableSource | null {+ const source = buildVariableSourceMap(context);+ return source.get(variableName) ?? null;+}++export function getMissingComposeVariables(context: EditorContext, activeComposeContent: string): string[] {+ const composeContents = [activeComposeContent, ...(context.composeContents ?? [])].filter((item) => item.length > 0);+ const referenced = extractComposeVariables(composeContents);+ const available = new Set<string>([+ ...parseEnvVariables(context.envContent ?? '').keys(),+ ...Object.keys(context.globalVariables ?? {})+ ]);++ const missing: string[] = [];+ for (const name of referenced) {+ if (!available.has(name)) {+ missing.push(name);+ }+ }++ return missing.sort((a, b) => a.localeCompare(b));+}++export function getUnusedEnvVariables(context: EditorContext): string[] {+ const envValues = parseEnvVariables(context.envContent ?? '');+ if (!envValues.size) return [];++ const referenced = extractComposeVariables(context.composeContents ?? []);++ const unused: string[] = [];+ for (const key of envValues.keys()) {+ if (!referenced.has(key)) {+ unused.push(key);+ }+ }++ return unused.sort((a, b) => a.localeCompare(b));+}diff --git a/frontend/src/lib/components/code-editor/editor-constants.ts b/frontend/src/lib/components/code-editor/editor-constants.tsnew file mode 100644index 000000000..8b50827bb--- /dev/null+++ b/frontend/src/lib/components/code-editor/editor-constants.ts@@ -0,0 +1,49 @@+import { type Completion, snippetCompletion } from '@codemirror/autocomplete';+import type { DiagnosticSummary } from './analysis/types';++export const YAML_SNIPPETS: Completion[] = [+ snippetCompletion('services:\n ${1:service}:\n image: ${2:image:tag}', {+ label: 'service',+ type: 'snippet',+ detail: 'Service skeleton'+ }),+ snippetCompletion(+ 'healthcheck:\n test: ["CMD", "${1:command}"]\n interval: ${2:30s}\n timeout: ${3:10s}\n retries: ${4:3}',+ {+ label: 'healthcheck',+ type: 'snippet',+ detail: 'Healthcheck block'+ }+ ),+ snippetCompletion('ports:\n - "${1:8080}:${2:80}"', { label: 'ports', type: 'snippet' }),+ snippetCompletion('volumes:\n - ${1:source}:${2:/path}', { label: 'volumes', type: 'snippet' }),+ snippetCompletion('depends_on:\n ${1:service}:\n condition: ${2:service_healthy}', {+ label: 'depends_on',+ type: 'snippet'+ }),+ snippetCompletion('restart: ${1:unless-stopped}', { label: 'restart', type: 'snippet' }),+ snippetCompletion('build:\n context: ${1:.}\n dockerfile: ${2:Dockerfile}', { label: 'build', type: 'snippet' })+];++export const ENV_SNIPPETS: Completion[] = [+ snippetCompletion('${1:KEY}=${2:value}', { label: 'KEY=value', type: 'snippet' }),+ snippetCompletion('# ${1:Comment}', { label: 'comment', type: 'snippet' })+];++export function createDefaultSummary(): DiagnosticSummary {+ return {+ errors: 0,+ warnings: 0,+ infos: 0,+ hints: 0,+ schemaStatus: 'unavailable',+ schemaMessage: undefined,+ unresolvedVariables: [],+ secretWarnings: 0,+ duplicateKeyWarnings: 0,+ duplicateEnvWarnings: 0,+ cursorLine: 1,+ cursorCol: 1,+ validationReady: false+ };+}diff --git a/frontend/src/lib/components/code-editor/editor.svelte b/frontend/src/lib/components/code-editor/editor.sveltenew file mode 100644index 000000000..d33442b1b--- /dev/null+++ b/frontend/src/lib/components/code-editor/editor.svelte@@ -0,0 +1,906 @@+<script lang="ts">+ import CodeMirror from 'svelte-codemirror-editor';+ import * as Command from '$lib/components/ui/command';+ import { autocompletion, type Completion, type CompletionContext } from '@codemirror/autocomplete';+ import { yaml } from '@codemirror/lang-yaml';+ import { StreamLanguage, foldAll, unfoldAll, foldKeymap } from '@codemirror/language';+ import { properties } from '@codemirror/legacy-modes/mode/properties';+ import {+ linter,+ lintGutter,+ forEachDiagnostic,+ nextDiagnostic,+ previousDiagnostic,+ type Diagnostic,+ type LintSource+ } from '@codemirror/lint';+ import { keymap, hoverTooltip, EditorView } from '@codemirror/view';+ import { type Extension } from '@codemirror/state';+ import { parseDocument } from 'yaml';+ import { browser } from '$app/environment';+ import { m } from '$lib/paraglide/messages';+ import configStore from '$lib/stores/config-store';+ import { arcaneDarkInit } from './theme';+ import { createDefaultSummary, ENV_SNIPPETS, YAML_SNIPPETS } from './editor-constants';+ import { createMergeEnterIndentKeymap, createMergeHostAction, type MergeActionParams } from './merge-editor';+ import {+ analyzeComposeContent,+ findYamlPositionContext,+ resolveVariableSourceAtPosition,+ type YamlPositionContext+ } from './analysis/compose-analysis';+ import { analyzeEnvContent } from './analysis/env-analysis';+ import {+ getComposeSchemaContext,+ getCompletionOptionsForPath,+ getEnumValueCompletions,+ getSchemaDocForPath,+ type ComposeSchemaContext+ } from './analysis/compose-schema';+ import type { CodeLanguage, DiagnosticSummary, EditorContext, OutlineItem } from './analysis/types';++ let {+ value = $bindable(''),+ language = 'yaml' as CodeLanguage,+ placeholder = '',+ readOnly = false,+ fontSize = '12px',+ autoHeight = false,+ hasErrors = $bindable(false),+ fileId,+ originalValue,+ enableDiff = false,+ editorContext = {} as EditorContext,+ validationReady = $bindable(false),+ diagnosticSummary = $bindable(createDefaultSummary()),+ outlineOpen = $bindable(false),+ diffOpen = $bindable(false),+ commandPaletteOpen = $bindable(false)+ }: {+ value?: string;+ language?: CodeLanguage;+ placeholder?: string;+ readOnly?: boolean;+ fontSize?: string;+ autoHeight?: boolean;+ hasErrors?: boolean;+ fileId?: string;+ originalValue?: string;+ enableDiff?: boolean;+ editorContext?: EditorContext;+ validationReady?: boolean;+ diagnosticSummary?: DiagnosticSummary;+ outlineOpen?: boolean;+ diffOpen?: boolean;+ commandPaletteOpen?: boolean;+ } = $props();++ let activeOutlineItems = $state<OutlineItem[]>([]);+ let activeView = $state<EditorView | null>(null);+ let normalView = $state<EditorView | null>(null);+ let schemaState = $state<ComposeSchemaContext | null>(null);+ let shortcutsEnabled = $derived($configStore?.keyboardShortcutsEnabled !== false);++ const storageKey = $derived(fileId ? `arcane.editor.state:${fileId}` : null);+ const isDiffActive = $derived(Boolean(enableDiff && diffOpen && originalValue !== undefined));+ const effectiveEditorContext = $derived({+ envContent: editorContext?.envContent ?? '',+ composeContents: editorContext?.composeContents ?? [],+ globalVariables: editorContext?.globalVariables ?? {}+ });++ const mergeActionParams = $derived({+ diffActive: isDiffActive,+ language,+ value,+ baseline: originalValue ?? ''+ } satisfies MergeActionParams);++ function updateSummary(patch: Partial<DiagnosticSummary>) {+ let changed = false;+ for (const key in patch) {+ if (diagnosticSummary[key as keyof DiagnosticSummary] !== patch[key as keyof DiagnosticSummary]) {+ changed = true;+ break;+ }+ }+ if (!changed) return;++ diagnosticSummary = {+ ...createDefaultSummary(),+ ...diagnosticSummary,+ ...patch+ };+ }++ function updateSummaryFromDiagnostics(diagnostics: Diagnostic[], patch: Partial<DiagnosticSummary> = {}) {+ let errors = 0;+ let warnings = 0;+ let infos = 0;+ let hints = 0;++ for (const diagnostic of diagnostics) {+ switch (diagnostic.severity) {+ case 'error':+ errors += 1;+ break;+ case 'warning':+ warnings += 1;+ break;+ case 'info':+ infos += 1;+ break;+ case 'hint':+ hints += 1;+ break;+ }+ }++ hasErrors = errors > 0;+ validationReady = true;+ updateSummary({+ errors,+ warnings,+ infos,+ hints,+ validationReady: true,+ ...patch+ });+ }++ function markReadOnlyReady() {+ if (!readOnly) return;+ hasErrors = false;+ validationReady = true;+ updateSummary({+ errors: 0,+ warnings: 0,+ infos: 0,+ hints: 0,+ validationReady: true+ });+ }++ function updateCursorSummary(view: EditorView) {+ const position = view.state.selection.main.head;+ const line = view.state.doc.lineAt(position);+ updateSummary({+ cursorLine: line.number,+ cursorCol: position - line.from + 1+ });+ }++ function persistEditorState(view: EditorView) {+ if (!browser || !storageKey) return;+ try {+ const payload = {+ head: view.state.selection.main.head,+ scrollTop: view.scrollDOM.scrollTop+ };+ sessionStorage.setItem(storageKey, JSON.stringify(payload));+ } catch {+ // ignore persistence errors+ }+ }++ function restoreEditorState(view: EditorView) {+ if (!browser || !storageKey) return;+ try {+ const raw = sessionStorage.getItem(storageKey);+ if (!raw) return;+ const payload = JSON.parse(raw) as { head?: number; scrollTop?: number };+ if (typeof payload.head === 'number') {+ const bounded = Math.max(0, Math.min(payload.head, view.state.doc.length));+ view.dispatch({ selection: { anchor: bounded } });+ }+ if (typeof payload.scrollTop === 'number') {+ requestAnimationFrame(() => {+ view.scrollDOM.scrollTop = payload.scrollTop ?? 0;+ });+ }+ } catch {+ // ignore bad state payload+ }+ }++ function focusEditor() {+ activeView?.focus();+ }++ function jumpToOutlineItem(item: OutlineItem) {+ if (!activeView) return;+ activeView.dispatch({+ selection: { anchor: item.from },+ scrollIntoView: true+ });+ activeView.focus();+ }++ function formatEnvContent(content: string): string {+ const lines = content.split(/\r?\n/);+ const formatted: string[] = [];+ for (const line of lines) {+ const trimmed = line.trim();+ if (!trimmed || trimmed.startsWith('#')) {+ formatted.push(trimmed);+ continue;+ }+ const valueLine = trimmed.startsWith('export ') ? trimmed.slice(7).trim() : trimmed;+ const separator = valueLine.indexOf('=');+ if (separator < 0) {+ formatted.push(trimmed);+ continue;+ }+ const key = valueLine.slice(0, separator).trim().toUpperCase().replace(/\s+/g, '_');+ const valuePart = valueLine.slice(separator + 1).trim();+ formatted.push(`${key}=${valuePart}`);+ }+ return formatted.join('\n').replace(/\n{3,}/g, '\n\n');+ }++ function formatDocument() {+ if (!activeView || readOnly) return;+ const current = activeView.state.doc.toString();+ let formatted = current;++ if (language === 'yaml') {+ const parsed = parseDocument(current, { strict: false, uniqueKeys: false });+ if (parsed.errors.length === 0) {+ formatted = parsed.toString({ indent: 2, lineWidth: 0 });+ }+ } else {+ formatted = formatEnvContent(current);+ }++ if (formatted === current) return;++ activeView.dispatch({+ changes: { from: 0, to: activeView.state.doc.length, insert: formatted }+ });+ }++ function goToLine() {+ if (!activeView) return;+ const raw = window.prompt('Go to line', String(diagnosticSummary.cursorLine));+ if (!raw) return;+ const lineNumber = Number.parseInt(raw, 10);+ if (Number.isNaN(lineNumber)) return;+ const line = activeView.state.doc.line(Math.max(1, Math.min(lineNumber, activeView.state.doc.lines)));+ activeView.dispatch({+ selection: { anchor: line.from },+ scrollIntoView: true+ });+ activeView.focus();+ }++ function executeCommand(id: string) {+ commandPaletteOpen = false;+ switch (id) {+ case 'format':+ formatDocument();+ break;+ case 'next-diagnostic':+ if (activeView) nextDiagnostic(activeView);+ break;+ case 'prev-diagnostic':+ if (activeView) previousDiagnostic(activeView);+ break;+ case 'toggle-outline':+ outlineOpen = !outlineOpen;+ break;+ case 'toggle-diff':+ if (enableDiff && originalValue !== undefined) {+ diffOpen = !diffOpen;+ }+ break;+ case 'fold-all':+ if (activeView) foldAll(activeView);+ break;+ case 'unfold-all':+ if (activeView) unfoldAll(activeView);+ break;+ case 'jump-line':+ goToLine();+ break;+ }+ }++ const commandItems = $derived.by(() => {+ const items = [+ { id: 'format', label: 'Format document', shortcut: 'Shift+Alt+F' },+ { id: 'next-diagnostic', label: 'Next diagnostic', shortcut: 'F8' },+ { id: 'prev-diagnostic', label: 'Previous diagnostic', shortcut: 'Shift+F8' },+ { id: 'toggle-outline', label: outlineOpen ? 'Hide outline' : 'Show outline' },+ { id: 'fold-all', label: 'Fold all' },+ { id: 'unfold-all', label: 'Unfold all' },+ { id: 'jump-line', label: 'Jump to line' }+ ];++ if (enableDiff && originalValue !== undefined) {+ items.splice(4, 0, { id: 'toggle-diff', label: diffOpen ? 'Hide diff' : 'Show diff' });+ }++ return items;+ });++ const schemaCompletions = async (context: CompletionContext, yamlContext: YamlPositionContext): Promise<Completion[]> => {+ const schema = await getComposeSchemaContext();+ schemaState = schema;+ updateSummary({+ schemaStatus: schema.status,+ schemaMessage: schema.message+ });++ if (!schema.schema) return [];+ const before = context.matchBefore(/[\w.-]*/);+ const prefix = before?.text ?? '';++ if (yamlContext.atKey) {+ return [...YAML_SNIPPETS, ...getCompletionOptionsForPath(schema.schema, yamlContext.parentPath, prefix)];+ }++ return getEnumValueCompletions(schema.schema, yamlContext.path);+ };++ const composeCompletionSource = async (context: CompletionContext) => {+ if (language !== 'yaml' || readOnly) return null;+ const source = context.state.doc.toString();+ const yamlContext = findYamlPositionContext(source, context.pos);+ if (!yamlContext) return null;++ const before = context.matchBefore(/[\w.-]*/);+ if (!context.explicit && (!before || before.from === before.to)) return null;++ const options = await schemaCompletions(context, yamlContext);+ if (options.length === 0) return null;++ return {+ from: before ? before.from : context.pos,+ options,+ validFor: /[\w.-]*/+ };+ };++ const envCompletionSource = async (context: CompletionContext) => {+ if (language !== 'env' || readOnly) return null;+ const before = context.matchBefore(/[A-Za-z0-9_.-]*/);+ if (!context.explicit && (!before || before.from === before.to)) return null;++ const variableOptions = Array.from(+ new Set<string>([+ ...Object.keys(effectiveEditorContext.globalVariables),+ ...(effectiveEditorContext.envContent ?? '')+ .split(/\r?\n/)+ .map((line) => line.trim())+ .filter(Boolean)+ .map((line) => line.split('=')[0]?.trim() ?? '')+ .filter(Boolean)+ ])+ )+ .sort((a, b) => a.localeCompare(b))+ .map(+ (key) =>+ ({+ label: key,+ type: 'variable',+ apply: `${key}=`+ }) satisfies Completion+ );++ return {+ from: before ? before.from : context.pos,+ options: [...ENV_SNIPPETS, ...variableOptions],+ validFor: /[A-Za-z0-9_.-]*/+ };+ };++ const yamlHover = hoverTooltip(async (view, position) => {+ if (language !== 'yaml') return null;+ const source = view.state.doc.toString();+ const variableRef = resolveVariableSourceAtPosition(source, position, effectiveEditorContext);+ if (variableRef) {+ return {+ pos: position,+ create() {+ const dom = document.createElement('div');+ dom.className = 'arcane-hover';+ dom.innerHTML = `<strong>${variableRef.name}</strong><div>Source: ${variableRef.source}</div>`;+ return { dom };+ }+ };+ }++ const yamlContext = findYamlPositionContext(source, position);+ if (!yamlContext || !yamlContext.currentKey) return null;++ const schema = schemaState ?? (await getComposeSchemaContext());+ schemaState = schema;+ if (!schema.schema) return null;++ const doc = getSchemaDocForPath(schema.schema, yamlContext.path);+ if (!doc) return null;++ return {+ pos: yamlContext.keyFrom ?? position,+ end: yamlContext.keyTo ?? position,+ create() {+ const dom = document.createElement('div');+ dom.className = 'arcane-hover';+ const examples =+ doc.examples && doc.examples.length > 0 ? `<div><strong>Examples:</strong> ${doc.examples.join(', ')}</div>` : '';+ dom.innerHTML = `+ <div><strong>${doc.title ?? yamlContext.currentKey}</strong></div>+ ${doc.description ? `<div>${doc.description}</div>` : ''}+ ${doc.defaultValue ? `<div><strong>Default:</strong> ${doc.defaultValue}</div>` : ''}+ ${examples}+ `;+ return { dom };+ }+ };+ });++ const editorLifecycleExtension = EditorView.updateListener.of((update) => {+ if (!update.view) return;+ if (activeView !== update.view) {+ activeView = update.view;+ }+ if (update.docChanged || update.selectionSet) {+ updateCursorSummary(update.view);+ persistEditorState(update.view);+ }+ });++ const shortcutKeymapExtension = keymap.of([+ ...foldKeymap,+ {+ key: 'F8',+ run(view) {+ return nextDiagnostic(view);+ }+ },+ {+ key: 'Shift-F8',+ run(view) {+ return previousDiagnostic(view);+ }+ },+ {+ key: 'Shift-Alt-f',+ run() {+ formatDocument();+ return true;+ }+ },+ {+ key: 'Mod-Shift-p',+ run() {+ if (!shortcutsEnabled) return false;+ commandPaletteOpen = true;+ return true;+ }+ }+ ]);++ const yamlLinter: LintSource = async (view): Promise<Diagnostic[]> => {+ if (readOnly) {+ validationReady = true;+ hasErrors = false;+ return [];+ }++ const schema = await getComposeSchemaContext();+ schemaState = schema;+ const analysis = await analyzeComposeContent(view, schema, effectiveEditorContext);+ activeOutlineItems = analysis.outlineItems;++ updateSummaryFromDiagnostics(analysis.diagnostics, {+ schemaStatus: schema.status,+ schemaMessage: schema.message,+ ...analysis.summaryPatch+ });++ return analysis.diagnostics;+ };++ const envLinter: LintSource = async (view): Promise<Diagnostic[]> => {+ if (readOnly) {+ validationReady = true;+ hasErrors = false;+ return [];+ }++ const analysis = analyzeEnvContent(view.state.doc.toString(), effectiveEditorContext);+ activeOutlineItems = analysis.outlineItems;++ updateSummaryFromDiagnostics(analysis.diagnostics, {+ schemaStatus: schemaState?.status ?? 'unavailable',+ schemaMessage: schemaState?.message,+ ...analysis.summaryPatch+ });++ return analysis.diagnostics;+ };++ function getLanguageExtension(lang: CodeLanguage, options: { lightweight?: boolean } = {}): Extension[] {+ const lightweight = options.lightweight === true;+ const extensions: Extension[] = [editorLifecycleExtension, shortcutKeymapExtension];++ switch (lang) {+ case 'yaml':+ extensions.push(yaml());+ if (!readOnly && !lightweight) {+ extensions.push(+ lintGutter(),+ linter(yamlLinter, { delay: 140 }),+ yamlHover,+ autocompletion({+ activateOnTyping: true,+ override: [composeCompletionSource]+ })+ );+ }+ break;+ case 'env':+ extensions.push(StreamLanguage.define(properties));+ if (!readOnly && !lightweight) {+ extensions.push(+ lintGutter(),+ linter(envLinter, { delay: 140 }),+ autocompletion({+ activateOnTyping: true,+ override: [envCompletionSource]+ })+ );+ }+ break;+ }++ return extensions;+ }++ const theme = $derived.by(() => {+ $configStore;+ return arcaneDarkInit();+ });++ const mergeEnterIndentKeymap = createMergeEnterIndentKeymap();+ const mergeHostAction = createMergeHostAction({+ getTheme: () => theme,+ mergeEnterIndentKeymap,+ getLanguageExtension,+ onValueChange: (nextValue) => {+ value = nextValue;+ },+ onPrimaryViewReady: (view) => {+ activeView = view;+ restoreEditorState(view);+ updateCursorSummary(view);+ markReadOnlyReady();+ }+ });++ const extensions = $derived([...getLanguageExtension(language), theme]);++ const styles = $derived({+ '&': {+ fontSize,+ height: autoHeight ? 'auto' : '100%'+ },+ '.cm-scroller': {+ overflow: autoHeight ? 'visible' : 'auto',+ maxHeight: autoHeight ? 'none' : '100%'+ },+ '&.cm-editor[contenteditable=false]': {+ cursor: 'not-allowed'+ },+ '.cm-content[contenteditable=false]': {+ cursor: 'not-allowed'+ }+ });++ function wireNormalView(view: EditorView) {+ normalView = view;+ if (!isDiffActive) {+ activeView = view;+ restoreEditorState(view);+ updateCursorSummary(view);+ markReadOnlyReady();+ }+ }++ function countCurrentDiagnostics(): number {+ if (!activeView) return 0;+ let count = 0;+ forEachDiagnostic(activeView.state, () => {+ count += 1;+ });+ return count;+ }+</script>++<div class="arcane-code-editor {autoHeight ? 'auto-height' : 'full-height'}">+ <div class="editor-main">+ {#if isDiffActive}+ <div class="merge-shell">+ <div class="merge-pane-header">+ <div class="merge-pane-label merge-pane-label-new">New (editable)</div>+ <div class="merge-pane-label merge-pane-label-old">Original (read-only)</div>+ </div>+ <div class="merge-legend">+ <span class="merge-badge merge-badge-add">+ Added</span>+ <span class="merge-badge merge-badge-del">- Removed</span>+ </div>+ <div class="merge-host" use:mergeHostAction={mergeActionParams}></div>+ </div>+ {:else}+ <CodeMirror bind:value {extensions} {styles} {placeholder} readonly={readOnly} nodebounce={true} onready={wireNormalView} />+ {/if}++ {#if outlineOpen && activeOutlineItems.length > 0}+ <div class="outline-panel">+ <div class="outline-title">Outline</div>+ <div class="outline-list">+ {#each activeOutlineItems as item (item.id)}+ <button type="button" class="outline-item level-{item.level}" onclick={() => jumpToOutlineItem(item)}>+ {item.label}+ </button>+ {/each}+ </div>+ </div>+ {/if}+ </div>++ <div class="editor-status">+ <span>{diagnosticSummary.errors} errors</span>+ <span>{diagnosticSummary.warnings} warnings</span>+ <span>Schema: {diagnosticSummary.schemaStatus}</span>+ <span>Unresolved vars: {diagnosticSummary.unresolvedVariables.length}</span>+ <span>Secrets: {diagnosticSummary.secretWarnings}</span>+ <span>Ln {diagnosticSummary.cursorLine}, Col {diagnosticSummary.cursorCol}</span>+ <span>Diagnostics: {countCurrentDiagnostics()}</span>+ {#if !validationReady}+ <span class="status-muted">Validating...</span>+ {/if}+ </div>++ <Command.Dialog bind:open={commandPaletteOpen} title="Editor Commands" description="Run editor commands">+ {#snippet children()}+ <Command.Input placeholder="Search editor commands..." />+ <Command.List>+ <Command.Empty>{m.common_no_results_found()}</Command.Empty>+ <Command.Group>+ {#each commandItems as item (item.id)}+ <Command.Item value={item.label} onSelect={() => executeCommand(item.id)}>+ <span class="flex-1">{item.label}</span>+ {#if item.shortcut}+ <Command.Shortcut>{item.shortcut}</Command.Shortcut>+ {/if}+ </Command.Item>+ {/each}+ </Command.Group>+ </Command.List>+ {/snippet}+ </Command.Dialog>+</div>++<style>+ :global(.arcane-code-editor.full-height) {+ height: 100%;+ display: flex;+ flex-direction: column;+ min-height: 0;+ }+ :global(.arcane-code-editor.auto-height) {+ height: auto;+ display: flex;+ flex-direction: column;+ }+ .editor-main {+ position: relative;+ flex: 1;+ min-height: 0;+ }+ :global(.arcane-code-editor.full-height .codemirror-wrapper) {+ height: 100%;+ }+ :global(.arcane-code-editor.full-height .cm-editor) {+ height: 100%;+ }+ :global(.arcane-code-editor.auto-height .codemirror-wrapper) {+ height: auto;+ }+ :global(.arcane-code-editor.auto-height .cm-editor) {+ height: auto;+ min-height: 120px;+ }+ :global(.arcane-code-editor.auto-height .cm-editor .cm-scroller) {+ overflow-y: visible;+ }+ :global(.arcane-code-editor .cm-editor .cm-scroller) {+ overflow-x: auto;+ }+ :global(.arcane-code-editor .cm-editor .cm-gutters) {+ background-color: #18181b;+ border-right: none;+ }+ :global(.arcane-code-editor .cm-editor .cm-activeLineGutter) {+ background-color: #2c313a;+ color: #e5e7eb;+ }+ :global(.arcane-code-editor .cm-mergeView) {+ height: 100%;+ }+ .merge-shell {+ height: 100%;+ min-height: 0;+ display: flex;+ flex-direction: column;+ background: color-mix(in oklab, var(--background) 96%, black 4%);+ }+ .merge-pane-header {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: 0.5rem;+ padding: 0.35rem 0.5rem;+ border-bottom: 1px solid var(--border);+ }+ .merge-pane-label {+ font-size: 0.72rem;+ font-weight: 700;+ padding: 0.25rem 0.5rem;+ border-radius: 0.4rem;+ text-align: center;+ }+ .merge-pane-label-new {+ color: #3fb950;+ background: color-mix(in oklab, #3fb950 18%, transparent);+ border: 1px solid color-mix(in oklab, #3fb950 45%, transparent);+ }+ .merge-pane-label-old {+ color: #f85149;+ background: color-mix(in oklab, #f85149 18%, transparent);+ border: 1px solid color-mix(in oklab, #f85149 45%, transparent);+ }+ .merge-legend {+ display: flex;+ gap: 0.5rem;+ align-items: center;+ padding: 0.3rem 0.5rem;+ border-bottom: 1px solid var(--border);+ }+ .merge-badge {+ font-size: 0.68rem;+ font-weight: 600;+ line-height: 1;+ padding: 0.22rem 0.45rem;+ border-radius: 999px;+ }+ .merge-badge-add {+ color: #3fb950;+ background: color-mix(in oklab, #3fb950 16%, transparent);+ border: 1px solid color-mix(in oklab, #3fb950 40%, transparent);+ }+ .merge-badge-del {+ color: #f85149;+ background: color-mix(in oklab, #f85149 16%, transparent);+ border: 1px solid color-mix(in oklab, #f85149 40%, transparent);+ }+ .merge-host {+ flex: 1;+ min-height: 0;+ }+ :global(.arcane-code-editor .merge-host .cm-mergeView) {+ height: 100%;+ display: flex;+ flex-direction: column;+ overflow: hidden;+ }+ :global(.arcane-code-editor .merge-host .cm-mergeViewEditors) {+ height: 100%;+ min-height: 0;+ }+ :global(.arcane-code-editor .merge-host .cm-mergeViewEditor) {+ height: 100%;+ min-height: 0;+ display: flex;+ flex-direction: column;+ }+ :global(.arcane-code-editor .merge-host .cm-mergeViewEditor:first-child) {+ border-right: 1px solid var(--border);+ }+ :global(.arcane-code-editor .merge-host .cm-mergeViewEditor .cm-editor) {+ height: 100% !important;+ min-height: 0;+ }+ :global(.arcane-code-editor .merge-host .cm-mergeViewEditor .cm-scroller) {+ height: 100% !important;+ overflow: auto !important;+ }+ :global(.arcane-code-editor .merge-host .cm-merge-a .cm-changedLine),+ :global(.arcane-code-editor .merge-host .cm-merge-a .cm-inlineChangedLine) {+ background-color: rgba(46, 160, 67, 0.14) !important;+ }+ :global(.arcane-code-editor .merge-host .cm-merge-b .cm-changedLine),+ :global(.arcane-code-editor .merge-host .cm-merge-b .cm-inlineChangedLine),+ :global(.arcane-code-editor .merge-host .cm-deletedChunk) {+ background-color: rgba(248, 81, 73, 0.14) !important;+ }+ :global(.arcane-code-editor .merge-host .cm-merge-a .cm-changedText) {+ background: linear-gradient(rgba(46, 160, 67, 0.7), rgba(46, 160, 67, 0.7)) bottom/100% 2px no-repeat !important;+ }+ :global(.arcane-code-editor .merge-host .cm-merge-b .cm-changedText),+ :global(.arcane-code-editor .merge-host .cm-merge-b .cm-deletedText),+ :global(.arcane-code-editor .merge-host .cm-deletedChunk .cm-deletedText) {+ background: linear-gradient(rgba(248, 81, 73, 0.75), rgba(248, 81, 73, 0.75)) bottom/100% 2px no-repeat !important;+ }+ :global(.arcane-code-editor .merge-host .cm-merge-a .cm-changedLineGutter) {+ background-color: #2ea043 !important;+ color: #fff !important;+ }+ :global(.arcane-code-editor .merge-host .cm-merge-b .cm-changedLineGutter),+ :global(.arcane-code-editor .merge-host .cm-merge-b .cm-deletedLineGutter) {+ background-color: #f85149 !important;+ color: #fff !important;+ }+ .outline-panel {+ position: absolute;+ top: 0.5rem;+ right: 0.5rem;+ z-index: 20;+ width: 16rem;+ max-height: calc(100% - 1rem);+ overflow: hidden;+ border: 1px solid var(--border);+ border-radius: 0.5rem;+ background: color-mix(in oklab, var(--background) 95%, black 5%);+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);+ }+ .outline-title {+ padding: 0.5rem 0.75rem;+ font-size: 0.75rem;+ font-weight: 700;+ border-bottom: 1px solid var(--border);+ }+ .outline-list {+ max-height: 20rem;+ overflow: auto;+ padding: 0.25rem;+ }+ .outline-item {+ width: 100%;+ text-align: left;+ padding: 0.25rem 0.5rem;+ font-size: 0.75rem;+ border-radius: 0.375rem;+ }+ .outline-item:hover {+ background: color-mix(in oklab, var(--primary) 18%, transparent);+ }+ .outline-item.level-1 {+ padding-left: 1rem;+ }+ .editor-status {+ display: flex;+ gap: 0.75rem;+ align-items: center;+ padding: 0.25rem 0.5rem;+ font-size: 0.7rem;+ border-top: 1px solid var(--border);+ background: color-mix(in oklab, var(--background) 92%, black 8%);+ overflow-x: auto;+ white-space: nowrap;+ }+ .status-muted {+ opacity: 0.7;+ }+ :global(.arcane-hover) {+ max-width: 26rem;+ padding: 0.5rem 0.625rem;+ font-size: 0.75rem;+ line-height: 1.4;+ border-radius: 0.5rem;+ border: 1px solid var(--border);+ background: color-mix(in oklab, var(--background) 96%, black 4%);+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);+ }+</style>diff --git a/frontend/src/lib/components/code-editor/merge-editor.ts b/frontend/src/lib/components/code-editor/merge-editor.tsnew file mode 100644index 000000000..99af3784f--- /dev/null+++ b/frontend/src/lib/components/code-editor/merge-editor.ts@@ -0,0 +1,169 @@+import { yaml } from '@codemirror/lang-yaml';+import { StreamLanguage, getIndentation, indentString } from '@codemirror/language';+import { properties } from '@codemirror/legacy-modes/mode/properties';+import { EditorState, type Extension } from '@codemirror/state';+import { MergeView } from '@codemirror/merge';+import { keymap, EditorView } from '@codemirror/view';+import type { Action } from 'svelte/action';+import type { CodeLanguage } from './analysis/types';++export type MergeActionParams = {+ diffActive: boolean;+ language: CodeLanguage;+ value: string;+ baseline: string;+};++type CreateMergeHostActionOptions = {+ getTheme: () => Extension;+ mergeEnterIndentKeymap: Extension;+ getLanguageExtension: (lang: CodeLanguage, options?: { lightweight?: boolean }) => Extension[];+ onValueChange: (nextValue: string) => void;+ onPrimaryViewReady: (view: EditorView) => void;+};++export function createMergeEnterIndentKeymap(): Extension {+ return keymap.of([+ {+ key: 'Enter',+ run(view) {+ const selection = view.state.selection.main;+ if (!selection) return false;++ const from = selection.from;+ const to = selection.to;+ const currentLine = view.state.doc.lineAt(from);+ const isCursorAtLineEnd = from === to && from === currentLine.to;+ const nextLine = currentLine.number < view.state.doc.lines ? view.state.doc.line(currentLine.number + 1) : null;+ const hasNextNonEmptyLine = Boolean(nextLine && nextLine.text.trim().length > 0);+ const lineBreakPos = from + 1;++ const lineBreakTransaction = view.state.update({+ changes: { from, to, insert: '\n' }+ });+ const lineBreakState = lineBreakTransaction.state;++ let indentation = '';++ if (isCursorAtLineEnd && hasNextNonEmptyLine) {+ indentation = nextLine?.text.match(/^\s*/)?.[0] ?? '';+ } else {+ const computedIndent = getIndentation(lineBreakState, lineBreakPos);+ if (computedIndent !== null) {+ indentation = indentString(lineBreakState, computedIndent);+ } else {+ const textBeforeCursor = currentLine.text.slice(0, Math.max(0, from - currentLine.from));+ indentation = textBeforeCursor.match(/^\s*/)?.[0] ?? '';+ }+ }++ view.dispatch({+ changes: { from, to, insert: `\n${indentation}` },+ selection: { anchor: lineBreakPos + indentation.length },+ userEvent: 'input'+ });++ return true;+ }+ }+ ]);+}++export function createMergeHostAction(options: CreateMergeHostActionOptions): Action<HTMLDivElement, MergeActionParams> {+ const { getTheme, mergeEnterIndentKeymap, getLanguageExtension, onValueChange, onPrimaryViewReady } = options;++ return (node, params) => {+ let currentParams = params;+ let currentMergeView: MergeView | null = null;++ const destroyCurrentMergeView = () => {+ if (!currentMergeView) return;+ currentMergeView.destroy();+ currentMergeView = null;+ };++ const createCurrentMergeView = () => {+ if (!currentParams.diffActive || currentMergeView) return;++ const theme = getTheme();+ const readonlyExtension = [EditorState.readOnly.of(true), EditorView.editable.of(false), theme];++ currentMergeView = new MergeView({+ parent: node,+ a: {+ doc: currentParams.value,+ extensions: [+ ...getLanguageExtension(currentParams.language, { lightweight: true }),+ mergeEnterIndentKeymap,+ theme,+ EditorView.updateListener.of((update) => {+ if (update.docChanged) {+ onValueChange(update.state.doc.toString());+ }+ })+ ]+ },+ b: {+ doc: currentParams.baseline,+ extensions: [currentParams.language === 'yaml' ? yaml() : StreamLanguage.define(properties), ...readonlyExtension]+ }+ });++ onPrimaryViewReady(currentMergeView.a);+ };++ const syncCurrentMergeView = () => {+ if (!currentMergeView || !currentParams.diffActive) return;++ const currentLeft = currentMergeView.a.state.doc.toString();+ if (currentLeft !== currentParams.value) {+ currentMergeView.a.dispatch({+ changes: {+ from: 0,+ to: currentMergeView.a.state.doc.length,+ insert: currentParams.value+ }+ });+ }++ const currentRight = currentMergeView.b.state.doc.toString();+ if (currentRight !== currentParams.baseline) {+ currentMergeView.b.dispatch({+ changes: {+ from: 0,+ to: currentMergeView.b.state.doc.length,+ insert: currentParams.baseline+ }+ });+ }+ };++ const applyParams = (nextParams: MergeActionParams) => {+ const mustRecreate = Boolean(currentMergeView && nextParams.language !== currentParams.language);+ currentParams = nextParams;++ if (!currentParams.diffActive) {+ destroyCurrentMergeView();+ return;+ }++ if (mustRecreate) {+ destroyCurrentMergeView();+ }++ createCurrentMergeView();+ syncCurrentMergeView();+ };++ applyParams(params);++ return {+ update(nextParams: MergeActionParams) {+ applyParams(nextParams);+ },+ destroy() {+ destroyCurrentMergeView();+ }+ };+ };+}diff --git a/frontend/src/lib/components/code-editor/theme.ts b/frontend/src/lib/components/code-editor/theme.tsnew file mode 100644index 000000000..534f3b109--- /dev/null+++ b/frontend/src/lib/components/code-editor/theme.ts@@ -0,0 +1,87 @@+import { tags as t } from '@lezer/highlight';+import { createTheme, type CreateThemeOptions } from '@uiw/codemirror-themes';++function getAccentColor(): string {+ const primaryColor = getComputedStyle(document.documentElement).getPropertyValue('--primary').trim();++ return primaryColor || 'oklch(0.606 0.25 292.717)';+}++function getAccentColorWithAlpha(alpha: number): string {+ const accentColor = getAccentColor();++ if (accentColor.startsWith('oklch')) {+ const hasAlpha = accentColor.includes('/');+ if (hasAlpha) {+ return accentColor.replace(/\/\s*[\d.]+\s*\)/, ` / ${alpha})`);+ }+ return accentColor.replace(')', ` / ${alpha})`);+ }++ if (accentColor.startsWith('#')) {+ const r = parseInt(accentColor.slice(1, 3), 16);+ const g = parseInt(accentColor.slice(3, 5), 16);+ const b = parseInt(accentColor.slice(5, 7), 16);+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;+ }++ return accentColor;+}++export const arcaneDarkInit = (options?: Partial<CreateThemeOptions>) => {+ const { theme = 'dark', settings = {}, styles = [] } = options || {};++ const accentColor = getAccentColor();+ const accentWithAlpha35 = getAccentColorWithAlpha(0.35);+ const accentWithAlpha15 = getAccentColorWithAlpha(0.15);+ const accentWithAlpha05 = getAccentColorWithAlpha(0.05);++ const dynamicSettings: CreateThemeOptions['settings'] = {+ background: '#0d1117',+ foreground: '#c9d1d9',+ caret: accentColor,+ selection: accentWithAlpha35,+ selectionMatch: accentWithAlpha15,+ lineHighlight: accentWithAlpha05,+ gutterBackground: '#0d1117',+ gutterForeground: '#8b949e',+ gutterActiveForeground: '#c9d1d9',+ gutterBorder: 'transparent',++ fontFamily: '"Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace',+ fontSize: '13px'+ };++ const dynamicStyles: CreateThemeOptions['styles'] = [+ { tag: [t.comment, t.meta], color: '#8b949e' },+ { tag: [t.keyword, t.modifier, t.operatorKeyword], color: '#ff7b72' },++ { tag: [t.typeName, t.namespace, t.number, t.atom, t.bool], color: '#ffa657' },+ { tag: [t.function(t.variableName), t.labelName], color: accentColor },+ {+ tag: [t.className, t.definition(t.variableName), t.propertyName, t.attributeName],+ color: '#d2a8ff'+ },++ { tag: [t.variableName, t.name], color: '#e6edf3' },+ { tag: [t.string, t.inserted, t.regexp, t.special(t.string)], color: '#7ee787' },+ { tag: [t.operator, t.url, t.link, t.escape], color: '#a5d6ff' },++ { tag: [t.separator, t.punctuation], color: '#6e7681' },++ { tag: t.heading, color: '#e6edf3', fontWeight: 'bold' },+ { tag: t.strong, fontWeight: 'bold' },+ { tag: t.emphasis, fontStyle: 'italic' },+ { tag: t.strikethrough, textDecoration: 'line-through' },+ { tag: t.invalid, color: '#f85149' },+ { tag: t.link, textDecoration: 'underline' }+ ];++ return createTheme({+ theme,+ settings: { ...dynamicSettings, ...settings },+ styles: [...dynamicStyles, ...styles]+ });+};++export const arcaneDark = arcaneDarkInit();diff --git a/frontend/src/lib/components/monaco-code-editor/editor.svelte b/frontend/src/lib/components/monaco-code-editor/editor.sveltedeleted file mode 100644index f511ac186..000000000--- a/frontend/src/lib/components/monaco-code-editor/editor.svelte+++ /dev/null@@ -1,220 +0,0 @@-<script lang="ts">- import { onMount, onDestroy } from 'svelte';- import { monaco, initShiki } from './monaco';- import { mode } from 'mode-watcher';- import jsyaml from 'js-yaml';- import { m } from '$lib/paraglide/messages';-- type CodeLanguage = 'yaml' | 'env';-- let {- value = $bindable(''),- language = 'yaml' as CodeLanguage,- readOnly = false,- fontSize = '12px',- fileUri = undefined,- autoHeight = false- }: {- value: string;- language: CodeLanguage;- readOnly?: boolean;- fontSize?: string;- fileUri?: string;- autoHeight?: boolean;- } = $props();-- let editorElement = $state<HTMLDivElement>();- let editor = $state.raw<monaco.editor.IStandaloneCodeEditor | null>(null);- let model = $state.raw<monaco.editor.ITextModel | null>(null);- let ownsModel = $state(false);- let resizeObserver: ResizeObserver | null = null;- let changeDisposable: monaco.IDisposable | null = null;-- const langId = $derived(language === 'env' ? 'ini' : language);- const theme = $derived(mode.current === 'dark' ? 'catppuccin-mocha' : 'catppuccin-latte');-- const markers = $derived.by(() => {- if (!model || language !== 'yaml' || readOnly) return [];-- try {- jsyaml.load(value);- return [];- } catch (e: unknown) {- const err = e as { mark?: { line: number; column: number }; reason?: string; message?: string };- const mark = err.mark;-- if (mark) {- const lineCount = model.getLineCount();- const lineNumber = Math.min(Math.max(1, mark.line + 1), lineCount);- const maxColumn = model.getLineMaxColumn(lineNumber);-- return [- {- severity: monaco.MarkerSeverity.Error,- message: err.reason || err.message || 'YAML error',- startLineNumber: lineNumber,- startColumn: Math.min(mark.column + 1, maxColumn),- endLineNumber: lineNumber,- endColumn: maxColumn- }- ];- }- return [- {- severity: monaco.MarkerSeverity.Error,- message: err.message || 'YAML error',- startLineNumber: 1,- startColumn: 1,- endLineNumber: 1,- endColumn: 1- }- ];- }- });-- function updateHeight() {- if (!editor || !editorElement || !autoHeight) return;- const contentHeight = editor.getContentHeight();- editorElement.style.height = `${contentHeight}px`;- editor.layout();- }-- onMount(async () => {- if (!editorElement) return;-- await initShiki(monaco);-- // Wait for container to be properly sized- await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));-- // Create or get model with proper URI for LSP features- const uri = fileUri ? monaco.Uri.parse(fileUri) : monaco.Uri.parse(`inmemory://model-${Date.now()}.${langId}`);- const existingModel = monaco.editor.getModel(uri);- ownsModel = !existingModel;- model = existingModel || monaco.editor.createModel(value, langId, uri);-- editor = monaco.editor.create(editorElement, {- model: model,- automaticLayout: false,- theme,- readOnly,- fontSize: parseInt(fontSize.replace('px', '')),- minimap: { enabled: false },- scrollBeyondLastLine: false,- wordWrap: 'on',- fixedOverflowWidgets: true,- dragAndDrop: false,- contextmenu: true,- quickSuggestions: {- other: true,- comments: false,- strings: true- },- suggestOnTriggerCharacters: true,- fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace',- fontLigatures: false,- padding: { top: 10, bottom: 10 },- scrollbar: autoHeight- ? {- vertical: 'hidden',- handleMouseWheel: false- }- : undefined- });-- editor.addAction({- id: 'arcane.selectAll',- label: m.common_select_all(),- contextMenuGroupId: '9_cutcopypaste',- contextMenuOrder: 4,- run: (ed) => {- ed.focus();- const model = ed.getModel();- if (model) {- ed.setSelection(model.getFullModelRange());- }- }- });-- changeDisposable = model.onDidChangeContent(() => {- value = model?.getValue() || '';- });-- resizeObserver = new ResizeObserver(() => {- requestAnimationFrame(() => {- editor?.layout();- });- });- resizeObserver.observe(editorElement);- });-- onDestroy(() => {- changeDisposable?.dispose();- resizeObserver?.disconnect();- editor?.dispose();- if (ownsModel) model?.dispose();- });-- // Sync value to model- $effect(() => {- if (model && value !== model.getValue()) {- model.setValue(value);- }- });-- // Sync language- $effect(() => {- if (model) {- monaco.editor.setModelLanguage(model, langId);- }- });-- // Sync markers- $effect(() => {- if (model) {- monaco.editor.setModelMarkers(model, 'yaml-linter', markers);- }- });-- // Sync options and layout- $effect(() => {- if (editor) {- editor.updateOptions({- readOnly,- theme,- fontSize: parseInt(fontSize.replace('px', '')),- wordWrap: 'on',- fixedOverflowWidgets: true,- dragAndDrop: false,- scrollbar: autoHeight- ? {- vertical: 'hidden',- handleMouseWheel: false- }- : {- vertical: 'auto',- handleMouseWheel: true- }- });- editor.layout();- }- });-- // Auto-height handling- $effect(() => {- if (editor && autoHeight) {- const disposable = editor.onDidContentSizeChange(updateHeight);- updateHeight();- return () => disposable.dispose();- } else if (editorElement) {- editorElement.style.height = '';- }- });-- // Global theme sync- $effect(() => {- monaco.editor.setTheme(theme);- });-</script>--<div class="relative {autoHeight ? '' : 'h-full'} min-h-0 w-full overflow-visible" bind:this={editorElement}></div>diff --git a/frontend/src/lib/components/monaco-code-editor/monaco.ts b/frontend/src/lib/components/monaco-code-editor/monaco.tsdeleted file mode 100644index 548f2e132..000000000--- a/frontend/src/lib/components/monaco-code-editor/monaco.ts+++ /dev/null@@ -1,70 +0,0 @@-import * as monaco from 'monaco-editor';-import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker';--// Configure Monaco to use Vite's native web worker support-// Only the base editor worker is needed for YAML and INI (basic languages)-self.MonacoEnvironment = {- getWorker: () => new editorWorker()-};--// Register basic languages for syntax highlighting-import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution.js';-import 'monaco-editor/esm/vs/basic-languages/ini/ini.contribution.js';--// Import editor implementation-import 'monaco-editor/esm/vs/editor/editor.all.js';--// Import YAML providers for Docker Compose-import { registerYamlProviders } from './yaml-providers';-import { shikiToMonaco } from '@shikijs/monaco';-import { createHighlighter } from 'shiki';--/**- * Initialize Shiki highlighter for Monaco- */-let shikiPromise: Promise<void> | null = null;--export async function initShiki(monacoInstance: typeof monaco) {- if (shikiPromise) return shikiPromise;-- shikiPromise = (async () => {- const highlighter = await createHighlighter({- themes: ['catppuccin-mocha', 'catppuccin-latte'],- langs: ['yaml', 'ini']- });-- // Register the languageIds first. Only registered languages will be highlighted.- const registeredLanguages = monacoInstance.languages.getLanguages().map((lang) => lang.id);- const langsToRegister = ['yaml', 'ini'];-- for (const lang of langsToRegister) {- if (!registeredLanguages.includes(lang)) {- monacoInstance.languages.register({ id: lang });- }- }-- // Register the themes from Shiki, and provide syntax highlighting for Monaco.- shikiToMonaco(highlighter, monacoInstance);-- // Register providers after languages are guaranteed to be registered- registerProviders();- })();-- return shikiPromise;-}--// Register YAML language providers-let yamlProviders: monaco.IDisposable[] = [];--export function registerProviders() {- // Dispose existing providers if any- yamlProviders.forEach((p) => p.dispose());- yamlProviders = registerYamlProviders(monaco);-}--if (typeof window !== 'undefined') {- (window as unknown as { monaco: typeof monaco }).monaco = monaco;-}--export { monaco };-export type Monaco = typeof monaco;diff --git a/frontend/src/lib/components/monaco-code-editor/yaml-providers.ts b/frontend/src/lib/components/monaco-code-editor/yaml-providers.tsdeleted file mode 100644index 50b214f9a..000000000--- a/frontend/src/lib/components/monaco-code-editor/yaml-providers.ts+++ /dev/null@@ -1,349 +0,0 @@-import type * as Monaco from 'monaco-editor';--/**- * Arcane-specific extensions to the Docker Compose spec- */-const ARCANE_CUSTOM_SCHEMA = {- properties: {- models: {- type: 'object',- description: 'Language models that will be used by your application.'- }- },- definitions: {- model: {- type: 'object',- description: 'Language Model for the Compose application.',- properties: {- name: { type: 'string', description: 'Custom name for this model.' },- model: { type: 'string', description: 'Language Model to run.' },- context_size: { type: 'integer' },- runtime_flags: {- type: 'array',- items: { type: 'string' },- description: 'Raw runtime flags to pass to the inference engine.'- }- },- required: ['model']- }- }-};--/**- * Schema Manager to handle Docker Compose specification- */-class ComposeSchemaManager {- private schema: any = ARCANE_CUSTOM_SCHEMA;- private suggestionsMap: Map<string, any[]> = new Map();- public readonly ready: Promise<void>;-- constructor() {- this.parseSchema();- this.ready = this.fetchLatestSchema();- }-- private async fetchLatestSchema(retries = 2): Promise<void> {- try {- const response = await fetch(- 'https://raw.githubusercontent.com/compose-spec/compose-go/refs/heads/main/schema/compose-spec.json'- );- if (!response.ok) throw new Error(`HTTP ${response.status}`);-- const latestSchema = await response.json();- // Merge latest official schema with our custom fields- this.schema = {- ...latestSchema,- properties: {- ...(latestSchema.properties || {}),- ...ARCANE_CUSTOM_SCHEMA.properties- },- definitions: {- ...(latestSchema.definitions || {}),- ...ARCANE_CUSTOM_SCHEMA.definitions- }- };- // Clear and re-parse- this.suggestionsMap.clear();- this.parseSchema();- } catch (e) {- if (retries > 0) {- await new Promise((r) => setTimeout(r, 1000));- return this.fetchLatestSchema(retries - 1);- }- console.error('Failed to fetch Docker Compose schema after retries', e);- }- }-- private parseSchema() {- // 1. Parse Root properties- const rootSuggestions: any[] = [];- if (this.schema.properties) {- for (const [key, value] of Object.entries(this.schema.properties)) {- const val = value as any;- rootSuggestions.push({- label: key,- kind: 1, // Property- documentation: this.getDescription(val),- insertText: this.generateInsertText(key, val)- });- }- }- this.suggestionsMap.set('root', rootSuggestions);-- // 2. Parse all definitions dynamically- if (this.schema.definitions) {- for (const [defName, defValue] of Object.entries(this.schema.definitions)) {- const def = defValue as any;- if (def.properties) {- const suggestions: any[] = [];- for (const [key, value] of Object.entries(def.properties)) {- const val = value as any;- suggestions.push({- label: key,- kind: 1, // Property- documentation: this.getDescription(val),- insertText: this.generateInsertText(key, val)- });- }- this.suggestionsMap.set(defName, suggestions);- }- }- }- }-- private getDescription(val: any, visited = new Set<string>()): string {- if (!val) return '';- if (val.description) return val.description;-- // Resolve $ref- if (val.$ref) {- if (visited.has(val.$ref)) return ''; // Circular reference- visited.add(val.$ref);- // Handle #/definitions/name format and simple #name format- const defName = val.$ref.includes('/') ? val.$ref.split('/').pop() : val.$ref.replace('#', '');- const def = this.schema.definitions?.[defName];- if (def && def.description) return def.description;- if (def) return this.getDescription(def, visited);- }-- // Resolve oneOf/anyOf- const nested = val.oneOf || val.anyOf || [];- for (const sub of nested) {- const desc = this.getDescription(sub, visited);- if (desc) return desc;- }-- return '';- }-- private generateInsertText(key: string, val: any): string {- // Handle array of types or single type- const type = Array.isArray(val.type) ? val.type[0] : val.type;-- if (type === 'array') {- return `${key}:\n - \${1}`;- }- // If it has properties, a $ref, or is explicitly an object, treat as nested- if (type === 'object' || val.$ref || val.properties || val.oneOf || val.anyOf) {- return `${key}:\n \${1}`;- }- // Default for strings, numbers, booleans- return `${key}: `;- }-- getSuggestions(context: string) {- const suggestions = this.suggestionsMap.get(context);- if (suggestions && suggestions.length > 0) return suggestions;-- // Fallback: search for a property named 'context' in all definitions- // and return its sub-properties if it has any.- // This handles cases like 'build' which are not top-level definitions.- if (this.schema.definitions) {- for (const def of Object.values(this.schema.definitions) as any[]) {- if (def.properties?.[context]) {- const prop = def.properties[context];- // Try to find properties directly or inside oneOf/anyOf- const subProps =- prop.properties ||- prop.oneOf?.find((p: any) => p.properties)?.properties ||- prop.anyOf?.find((p: any) => p.properties)?.properties;-- if (subProps) {- return Object.entries(subProps).map(([key, value]) => ({- label: key,- kind: 1, // Property- documentation: (value as any).description || '',- insertText: this.generateInsertText(key, value)- }));- }- }- }- }-- return [];- }-- getDocumentation(word: string): string | null {- // 1. Check root properties- if (this.schema.properties?.[word]) {- return `**${word}**\n\n${this.getDescription(this.schema.properties[word])}`;- }-- // 2. Check if the word itself is a definition (e.g. "service", "network")- if (this.schema.definitions?.[word]) {- return `**${word}**\n\n${this.schema.definitions[word].description || ''}`;- }-- // 3. Search through all properties of all definitions- if (this.schema.definitions) {- for (const [defName, def] of Object.entries(this.schema.definitions) as any[]) {- // Check direct properties- if (def.properties?.[word]) {- return `**${word}** (in ${defName})\n\n${this.getDescription(def.properties[word])}`;- }-- // Check properties inside oneOf/anyOf/allOf- const nested = [...(def.oneOf || []), ...(def.anyOf || []), ...(def.allOf || [])];- for (const sub of nested) {- if (sub.properties?.[word]) {- return `**${word}** (in ${defName})\n\n${this.getDescription(sub.properties[word])}`;- }- }- }- }- return null;- }-}--const schemaManager = new ComposeSchemaManager();--/**- * Detect the current context in the YAML file- */-function getContext(model: Monaco.editor.ITextModel, position: Monaco.Position): string {- const lineContent = model.getLineContent(position.lineNumber);- const indent = lineContent.match(/^\s*/)?.[0].length || 0;-- if (indent === 0) return 'root';-- let currentIndent = indent;- let parentKey = null;- let grandParentKey = null;-- for (let i = position.lineNumber - 1; i >= 1; i--) {- const line = model.getLineContent(i);- const lineIndent = line.match(/^\s*/)?.[0].length || 0;- if (lineIndent < currentIndent) {- const match = line.match(/^\s*([\w-]+):/);- if (match) {- if (parentKey === null) {- parentKey = match[1];- currentIndent = lineIndent;- } else {- grandParentKey = match[1];- break;- }- }- }- }-- // Map plural root keys to singular definition names- const contextMap: Record<string, string> = {- services: 'service',- networks: 'network',- volumes: 'volume',- models: 'model',- configs: 'config',- secrets: 'secret',- // Common nested keys that map to definitions- build: 'build',- deploy: 'deployment',- healthcheck: 'healthcheck',- resources: 'resources',- limits: 'limits',- reservations: 'reservations',- restart_policy: 'restart_policy',- update_config: 'update_config',- rollback_config: 'rollback_config',- logging: 'logging'- };-- // 1. Check if parent or grandparent is a known root key- if (parentKey && contextMap[parentKey]) return contextMap[parentKey];- if (grandParentKey && contextMap[grandParentKey]) return contextMap[grandParentKey];-- return 'unknown';-}--/**- * Register YAML completion provider for Docker Compose files- */-export function registerYamlCompletionProvider(monaco: typeof Monaco) {- return monaco.languages.registerCompletionItemProvider('yaml', {- // Trigger on space, colon (to clear), dash (for lists), and dot- triggerCharacters: [' ', ':', '-', '.'],- provideCompletionItems: (model, position) => {- const lineContent = model.getLineContent(position.lineNumber);- const textBeforeCursor = lineContent.substring(0, position.column - 1);-- // If we just typed a colon, return empty suggestions to clear the list.- // This prevents the "colon + enter" issue where it auto-completes the wrong thing.- if (textBeforeCursor.endsWith(':')) {- return { suggestions: [] };- }-- // If there's a colon followed by a space, we're definitely in a value position.- // We don't have value completions yet, so return empty.- if (/: /.test(textBeforeCursor)) {- return { suggestions: [] };- }-- const word = model.getWordUntilPosition(position);- const range = {- startLineNumber: position.lineNumber,- endLineNumber: position.lineNumber,- startColumn: word.startColumn,- endColumn: word.endColumn- };-- const context = getContext(model, position);- const suggestions = schemaManager.getSuggestions(context).map((s) => ({- ...s,- range,- kind: monaco.languages.CompletionItemKind.Property,- insertTextRules: s.insertText.includes('$') ? monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet : undefined- }));-- return { suggestions };- }- });-}--/**- * Register YAML hover provider for documentation- */-export function registerYamlHoverProvider(monaco: typeof Monaco) {- return monaco.languages.registerHoverProvider('yaml', {- provideHover: (model, position) => {- const word = model.getWordAtPosition(position);- if (!word) return null;-- const documentation = schemaManager.getDocumentation(word.word);- if (documentation) {- return {- range: new monaco.Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn),- contents: [{ value: documentation }]- };- }-- return null;- }- });-}--/**- * Register all YAML providers for Docker Compose editing- */-export function registerYamlProviders(monaco: typeof Monaco) {- return [registerYamlCompletionProvider(monaco), registerYamlHoverProvider(monaco)];-}diff --git a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelteindex 7c8c8f54e..4f66fb3c8 100644--- a/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte+++ b/frontend/src/routes/(app)/customize/templates/[id]/+page.svelte@@ -3,7 +3,7 @@import * as Card from '$lib/components/ui/card';import { Badge } from '$lib/components/ui/badge';import { Spinner } from '$lib/components/ui/spinner';- import CodeEditor from '$lib/components/monaco-code-editor/editor.svelte';+ import CodeEditor from '$lib/components/code-editor/editor.svelte';import { goto, invalidateAll } from '$app/navigation';import { m } from '$lib/paraglide/messages.js';import { templateService } from '$lib/services/template-service';diff --git a/frontend/src/routes/(app)/customize/templates/default/+page.svelte b/frontend/src/routes/(app)/customize/templates/default/+page.svelteindex aa0f15898..2ea155ea6 100644--- a/frontend/src/routes/(app)/customize/templates/default/+page.svelte+++ b/frontend/src/routes/(app)/customize/templates/default/+page.svelte@@ -2,7 +2,7 @@import { ArcaneButton } from '$lib/components/arcane-button/index.js';import * as Card from '$lib/components/ui/card';import { toast } from 'svelte-sonner';- import CodeEditor from '$lib/components/monaco-code-editor/editor.svelte';+ import CodeEditor from '$lib/components/code-editor/editor.svelte';import { createForm } from '$lib/utils/form.utils';import { tryCatch } from '$lib/utils/try-catch';import { handleApiResultWithCallbacks } from '$lib/utils/api.util';@@ -23,6 +23,15 @@let originalComposeContent = $state(untrack(() => data.composeTemplate));let originalEnvContent = $state(untrack(() => data.envTemplate));+ let composeHasErrors = $state(false);+ let envHasErrors = $state(false);+ let composeValidationReady = $state(false);+ let envValidationReady = $state(false);++ const globalVariableMap = $derived.by(() =>+ Object.fromEntries((data.globalVariables ?? []).map((item) => [item.key, item.value]))+ );+const formSchema = z.object({composeContent: z.string().min(1, m.compose_compose_content_required()),envContent: z.string().optional().default('')@@ -39,7 +48,14 @@$inputs.composeContent.value !== originalComposeContent || $inputs.envContent.value !== originalEnvContent);+ const canSave = $derived(hasChanges && composeValidationReady && envValidationReady && !composeHasErrors && !envHasErrors);+async function handleSave() {+ if (!composeValidationReady || !envValidationReady || composeHasErrors || envHasErrors) {+ toast.error(m.templates_validation_error());+ return;+ }+const validated = form.validate();if (!validated) {toast.error(m.templates_validation_error());@@ -110,13 +126,15 @@<ArcaneButton action="cancel" onclick={handleReset} disabled={!hasChanges || saving || isLoadingTemplate}>{m.common_reset()}</ArcaneButton>- <ArcaneButton- action="save"- onclick={handleSave}- disabled={!hasChanges || isLoadingTemplate}- loading={saving}- loadingLabel={m.common_action_saving()}- />+ {#if composeValidationReady && envValidationReady && !composeHasErrors && !envHasErrors}+ <ArcaneButton+ action="save"+ onclick={handleSave}+ disabled={!canSave || isLoadingTemplate}+ loading={saving}+ loadingLabel={m.common_action_saving()}+ />+ {/if}</div></div></div>@@ -138,6 +156,16 @@language="yaml"readOnly={saving || isLoadingTemplate}fontSize="13px"+ bind:hasErrors={composeHasErrors}+ bind:validationReady={composeValidationReady}+ fileId="templates:defaults:compose"+ originalValue={originalComposeContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: [$inputs.composeContent.value],+ globalVariables: globalVariableMap+ }}/></div></Card.Content>@@ -166,6 +194,16 @@language="env"readOnly={saving || isLoadingTemplate}fontSize="13px"+ bind:hasErrors={envHasErrors}+ bind:validationReady={envValidationReady}+ fileId="templates:defaults:env"+ originalValue={originalEnvContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: [$inputs.composeContent.value],+ globalVariables: globalVariableMap+ }}/></div></Card.Content>diff --git a/frontend/src/routes/(app)/customize/templates/default/+page.ts b/frontend/src/routes/(app)/customize/templates/default/+page.tsindex 6cf50b952..9d7a20555 100644--- a/frontend/src/routes/(app)/customize/templates/default/+page.ts+++ b/frontend/src/routes/(app)/customize/templates/default/+page.ts@@ -1,14 +1,15 @@import { templateService } from '$lib/services/template-service';import { queryKeys } from '$lib/query/query-keys';import type { Template } from '$lib/types/template.type';+import type { Variable } from '$lib/types/variable.type';import type { PageLoad } from './$types';export const load: PageLoad = async ({parent-}): Promise<{ composeTemplate: string; envTemplate: string; templates: Template[] }> => {+}): Promise<{ composeTemplate: string; envTemplate: string; templates: Template[]; globalVariables: Variable[] }> => {const { queryClient } = await parent();- const [defaultTemplates, templates] = await Promise.all([+ const [defaultTemplates, templates, globalVariables] = await Promise.all([queryClient.fetchQuery({queryKey: queryKeys.templates.defaults(),@@ -26,12 +27,22 @@ export const load: PageLoad = async ({.catch((err) => {console.warn('Failed to load templates:', err);return [];+ }),+ queryClient+ .fetchQuery({+ queryKey: queryKeys.templates.globalVariables(),+ queryFn: () => templateService.getGlobalVariables()+ })+ .catch((err) => {+ console.warn('Failed to load global variables:', err);+ return [];})]);return {composeTemplate: defaultTemplates.composeTemplate,envTemplate: defaultTemplates.envTemplate,- templates+ templates,+ globalVariables};};diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelteindex bcd39adb5..a9d2abcda 100644--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte@@ -60,6 +60,9 @@let originalEnvContent = $state(untrack(() => data.editorState.originalEnvContent || ''));let includeFilesState = $state<Record<string, string>>({});let originalIncludeFiles = $state<Record<string, string>>({});+ const globalVariableMap = $derived.by(() =>+ Object.fromEntries((data.globalVariables ?? []).map((item) => [item.key, item.value]))+ );const formSchema = z.object({name: z@@ -108,6 +111,24 @@const minComposePaneWidth = 360;const minEnvPaneWidth = 280;+ let composeHasErrors = $state(false);+ let envHasErrors = $state(false);+ let includeFilesHasErrors = $state<Record<string, boolean>>({});+ let composeValidationReady = $state(false);+ let envValidationReady = $state(false);+ let includeFilesValidationReady = $state<Record<string, boolean>>({});++ let hasAnyErrors = $derived(+ !composeValidationReady ||+ !envValidationReady ||+ Object.values(includeFilesValidationReady).some((isReady) => !isReady) ||+ composeHasErrors ||+ envHasErrors ||+ Object.values(includeFilesHasErrors).some((hasError) => hasError)+ );++ let canSave = $derived(hasChanges && !hasAnyErrors);+const tabItems = $derived<TabItem[]>([{value: 'services',@@ -136,6 +157,7 @@envOpen: boolean;autoScroll: boolean;layoutMode: 'classic' | 'tree';+ selectedFile?: 'compose' | 'env' | string;};const defaultComposeUIPrefs: ComposeUIPrefs = {@@ -143,7 +165,8 @@composeOpen: true,envOpen: true,autoScroll: true,- layoutMode: 'classic'+ layoutMode: 'classic',+ selectedFile: 'compose'};let prefs: PersistedState<ComposeUIPrefs> | null = null;@@ -163,6 +186,7 @@composeOpen = cur.composeOpen ?? defaultComposeUIPrefs.composeOpen;envOpen = cur.envOpen ?? defaultComposeUIPrefs.envOpen;autoScrollStackLogs = cur.autoScroll ?? defaultComposeUIPrefs.autoScroll;+ selectedFile = cur.selectedFile ?? defaultComposeUIPrefs.selectedFile ?? 'compose';// Auto-detect layout mode based on includeFilesconst hasIncludes = project?.includeFiles && project.includeFiles.length > 0;@@ -177,6 +201,12 @@if (!(file.relativePath in includeFilesPanelStates)) {includeFilesPanelStates[file.relativePath] = true;}+ if (!(file.relativePath in includeFilesHasErrors)) {+ includeFilesHasErrors[file.relativePath] = false;+ }+ if (!(file.relativePath in includeFilesValidationReady)) {+ includeFilesValidationReady[file.relativePath] = true;+ }});includeFilesState = newIncludeState;originalIncludeFiles = { ...newIncludeState };@@ -185,6 +215,10 @@async function handleSaveChanges() {if (!project || !hasChanges) return;+ if (hasAnyErrors) {+ toast.error(m.templates_validation_error());+ return;+ }const formValues = form.data();const validated = isGitOpsManaged ? formValues : form.validate();@@ -238,10 +272,22 @@composeOpen,envOpen,autoScroll: autoScrollStackLogs,- layoutMode+ layoutMode,+ selectedFile};}+ $effect(() => {+ selectedFile;+ if (layoutMode === 'tree') {+ persistPrefs();+ }+ });++ const allComposeContents = $derived.by(() => {+ return [$inputs.composeContent.value, ...Object.values(includeFilesState)].filter((value) => value.length > 0);+ });+async function refreshProjectDetails() {if (!projectId) return;handleApiResultWithCallbacks({@@ -366,12 +412,12 @@{#snippet headerActions()}<div class="flex items-center gap-2">- {#if hasChanges}+ {#if hasChanges && !hasAnyErrors}<ArcaneButtonaction="save"loading={isLoading.saving}onclick={handleSaveChanges}- disabled={!hasChanges}+ disabled={!canSave}customLabel={m.common_save()}loadingLabel={m.common_saving()}class="hidden xl:inline-flex"@@ -382,7 +428,7 @@showLabel={false}loading={isLoading.saving}onclick={handleSaveChanges}- disabled={!hasChanges}+ disabled={!canSave}customLabel={m.common_save()}loadingLabel={m.common_saving()}class="xl:hidden"@@ -536,6 +582,16 @@bind:value={$inputs.composeContent.value}error={$inputs.composeContent.error ?? undefined}readOnly={!canEditCompose}+ bind:hasErrors={composeHasErrors}+ bind:validationReady={composeValidationReady}+ fileId={`project:${projectId}:compose`}+ originalValue={originalComposeContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/>{:else if selectedFile === 'env'}<CodePanel@@ -545,6 +601,16 @@bind:value={$inputs.envContent.value}error={$inputs.envContent.error ?? undefined}readOnly={!canEditEnv}+ bind:hasErrors={envHasErrors}+ bind:validationReady={envValidationReady}+ fileId={`project:${projectId}:env`}+ originalValue={originalEnvContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/>{:else}{@const includeFile = project?.includeFiles?.find((f) => f.relativePath === selectedFile)}@@ -554,6 +620,16 @@title={includeFile.relativePath}language="yaml"bind:value={includeFilesState[includeFile.relativePath]}+ bind:hasErrors={includeFilesHasErrors[includeFile.relativePath]}+ bind:validationReady={includeFilesValidationReady[includeFile.relativePath]}+ fileId={`project:${projectId}:include:${includeFile.relativePath}`}+ originalValue={originalIncludeFiles[includeFile.relativePath]}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/>{/if}{/if}@@ -631,6 +707,16 @@bind:value={$inputs.composeContent.value}error={$inputs.composeContent.error ?? undefined}readOnly={!canEditCompose}+ bind:hasErrors={composeHasErrors}+ bind:validationReady={composeValidationReady}+ fileId={`project:${projectId}:compose`}+ originalValue={originalComposeContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/>{:else if selectedFile === 'env'}<CodePanel@@ -640,6 +726,16 @@bind:value={$inputs.envContent.value}error={$inputs.envContent.error ?? undefined}readOnly={!canEditEnv}+ bind:hasErrors={envHasErrors}+ bind:validationReady={envValidationReady}+ fileId={`project:${projectId}:env`}+ originalValue={originalEnvContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/>{:else}{@const includeFile = project?.includeFiles?.find((f) => f.relativePath === selectedFile)}@@ -649,6 +745,16 @@title={includeFile.relativePath}language="yaml"bind:value={includeFilesState[includeFile.relativePath]}+ bind:hasErrors={includeFilesHasErrors[includeFile.relativePath]}+ bind:validationReady={includeFilesValidationReady[includeFile.relativePath]}+ fileId={`project:${projectId}:include:${includeFile.relativePath}`}+ originalValue={originalIncludeFiles[includeFile.relativePath]}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/>{/if}{/if}@@ -686,6 +792,16 @@title={includeFile.relativePath}language="yaml"bind:value={includeFilesState[includeFile.relativePath]}+ bind:hasErrors={includeFilesHasErrors[includeFile.relativePath]}+ bind:validationReady={includeFilesValidationReady[includeFile.relativePath]}+ fileId={`project:${projectId}:include:${includeFile.relativePath}`}+ originalValue={originalIncludeFiles[includeFile.relativePath]}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/>{/if}{:else}@@ -697,6 +813,16 @@bind:value={$inputs.composeContent.value}error={$inputs.composeContent.error ?? undefined}readOnly={!canEditCompose}+ bind:hasErrors={composeHasErrors}+ bind:validationReady={composeValidationReady}+ fileId={`project:${projectId}:compose`}+ originalValue={originalComposeContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/><CodePanelbind:open={envOpen}@@ -705,6 +831,16 @@bind:value={$inputs.envContent.value}error={$inputs.envContent.error ?? undefined}readOnly={!canEditEnv}+ bind:hasErrors={envHasErrors}+ bind:validationReady={envValidationReady}+ fileId={`project:${projectId}:env`}+ originalValue={originalEnvContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/></div>@@ -729,6 +865,16 @@bind:value={$inputs.composeContent.value}error={$inputs.composeContent.error ?? undefined}readOnly={!canEditCompose}+ bind:hasErrors={composeHasErrors}+ bind:validationReady={composeValidationReady}+ fileId={`project:${projectId}:compose`}+ originalValue={originalComposeContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/></div>{/snippet}@@ -742,6 +888,16 @@bind:value={$inputs.envContent.value}error={$inputs.envContent.error ?? undefined}readOnly={!canEditEnv}+ bind:hasErrors={envHasErrors}+ bind:validationReady={envValidationReady}+ fileId={`project:${projectId}:env`}+ originalValue={originalEnvContent}+ enableDiff={true}+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: allComposeContents,+ globalVariables: globalVariableMap+ }}/></div>{/snippet}diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.ts b/frontend/src/routes/(app)/projects/[projectId]/+page.tsindex cc6b8201e..b7d6e72f4 100644--- a/frontend/src/routes/(app)/projects/[projectId]/+page.ts+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.ts@@ -1,4 +1,5 @@import { projectService } from '$lib/services/project-service';+import { templateService } from '$lib/services/template-service';import { environmentStore } from '$lib/stores/environment.store.svelte';import { queryKeys } from '$lib/query/query-keys';import type { PageLoad } from './$types';@@ -7,10 +8,21 @@ export const load: PageLoad = async ({ params, parent }) => {const { queryClient } = await parent();const envId = await environmentStore.getCurrentEnvironmentId();- const project = await queryClient.fetchQuery({- queryKey: queryKeys.projects.detail(envId, params.projectId),- queryFn: () => projectService.getProjectForEnvironment(envId, params.projectId)- });+ const [project, globalVariables] = await Promise.all([+ queryClient.fetchQuery({+ queryKey: queryKeys.projects.detail(envId, params.projectId),+ queryFn: () => projectService.getProjectForEnvironment(envId, params.projectId)+ }),+ queryClient+ .fetchQuery({+ queryKey: queryKeys.templates.globalVariables(),+ queryFn: () => templateService.getGlobalVariables()+ })+ .catch((err) => {+ console.warn('Failed to load global variables:', err);+ return [];+ })+ ]);const editorState = {name: project.name || '',@@ -25,6 +37,7 @@ export const load: PageLoad = async ({ params, parent }) => {projectId: params.projectId,project,editorState,+ globalVariables,error: null};};diff --git a/frontend/src/routes/(app)/projects/components/CodePanel.svelte b/frontend/src/routes/(app)/projects/components/CodePanel.svelteindex c092ebde3..63d3d6e4e 100644--- a/frontend/src/routes/(app)/projects/components/CodePanel.svelte+++ b/frontend/src/routes/(app)/projects/components/CodePanel.svelte@@ -1,8 +1,10 @@<script lang="ts">import * as Card from '$lib/components/ui/card';- import CodeEditor from '$lib/components/monaco-code-editor/editor.svelte';- import { CodeIcon } from '$lib/icons';+ import { ArcaneButton } from '$lib/components/arcane-button';+ import CodeEditor from '$lib/components/code-editor/editor.svelte';+ import { CodeIcon, FileTextIcon, SearchIcon, ArrowsUpDownIcon } from '$lib/icons';import { IsMobile } from '$lib/hooks/is-mobile.svelte.js';+ import type { DiagnosticSummary, EditorContext } from '$lib/components/code-editor/analysis/types';type CodeLanguage = 'yaml' | 'env';@@ -13,7 +15,31 @@value = $bindable(),error,autoHeight = false,- readOnly = false+ readOnly = false,+ hasErrors = $bindable(false),+ validationReady = $bindable(false),+ diagnosticSummary = $bindable({+ errors: 0,+ warnings: 0,+ infos: 0,+ hints: 0,+ schemaStatus: 'unavailable',+ schemaMessage: undefined,+ unresolvedVariables: [],+ secretWarnings: 0,+ duplicateKeyWarnings: 0,+ duplicateEnvWarnings: 0,+ cursorLine: 1,+ cursorCol: 1,+ validationReady: false+ } as DiagnosticSummary),+ fileId,+ originalValue,+ enableDiff = false,+ editorContext,+ outlineOpen = $bindable(false),+ diffOpen = $bindable(false),+ commandPaletteOpen = $bindable(false)}: {title: string;open: boolean;@@ -22,6 +48,16 @@error?: string;autoHeight?: boolean;readOnly?: boolean;+ hasErrors?: boolean;+ validationReady?: boolean;+ diagnosticSummary?: DiagnosticSummary;+ fileId?: string;+ originalValue?: string;+ enableDiff?: boolean;+ editorContext?: EditorContext;+ outlineOpen?: boolean;+ diffOpen?: boolean;+ commandPaletteOpen?: boolean;} = $props();const isMobile = new IsMobile();@@ -33,14 +69,76 @@<Card.Title><h2>{title}</h2></Card.Title>+ <Card.Action class="flex items-center gap-1 pt-1">+ <ArcaneButton+ action="base"+ tone={outlineOpen ? 'outline-primary' : 'ghost'}+ size="icon"+ showLabel={false}+ icon={FileTextIcon}+ customLabel="Toggle outline"+ onclick={() => (outlineOpen = !outlineOpen)}+ />+ {#if enableDiff && originalValue !== undefined}+ <ArcaneButton+ action="base"+ tone={diffOpen ? 'outline-primary' : 'ghost'}+ size="icon"+ showLabel={false}+ icon={ArrowsUpDownIcon}+ customLabel="Toggle diff"+ onclick={() => (diffOpen = !diffOpen)}+ />+ {/if}+ <ArcaneButton+ action="base"+ tone="ghost"+ size="icon"+ showLabel={false}+ icon={SearchIcon}+ customLabel="Command palette"+ onclick={() => (commandPaletteOpen = true)}+ />+ </Card.Action></Card.Header><Card.Content class="relative z-0 flex min-h-0 {effectiveAutoHeight ? '' : 'flex-1'} flex-col overflow-visible p-0"><div class="{effectiveAutoHeight ? '' : 'relative flex-1'} min-h-0 w-full min-w-0">{#if effectiveAutoHeight}- <CodeEditor bind:value {language} fontSize="13px" autoHeight={true} {readOnly} />+ <CodeEditor+ bind:value+ {language}+ fontSize="13px"+ autoHeight={true}+ {readOnly}+ bind:hasErrors+ bind:validationReady+ bind:diagnosticSummary+ {fileId}+ {originalValue}+ {enableDiff}+ {editorContext}+ bind:outlineOpen+ bind:diffOpen+ bind:commandPaletteOpen+ />{:else}<div class="absolute inset-0">- <CodeEditor bind:value {language} fontSize="13px" {readOnly} />+ <CodeEditor+ bind:value+ {language}+ fontSize="13px"+ {readOnly}+ bind:hasErrors+ bind:validationReady+ bind:diagnosticSummary+ {fileId}+ {originalValue}+ {enableDiff}+ {editorContext}+ bind:outlineOpen+ bind:diffOpen+ bind:commandPaletteOpen+ /></div>{/if}</div>diff --git a/frontend/src/routes/(app)/projects/new/+page.svelte b/frontend/src/routes/(app)/projects/new/+page.svelteindex d79916d5d..8ac20e59d 100644--- a/frontend/src/routes/(app)/projects/new/+page.svelte+++ b/frontend/src/routes/(app)/projects/new/+page.svelte@@ -59,6 +59,16 @@let dockerRunCommand = $state('');let composeOpen = $state(true);let envOpen = $state(true);+ let composeHasErrors = $state(false);+ let envHasErrors = $state(false);+ let composeValidationReady = $state(false);+ let envValidationReady = $state(false);++ const globalVariableMap = $derived.by(() =>+ Object.fromEntries((data.globalVariables ?? []).map((item) => [item.key, item.value]))+ );++ let hasEditorErrors = $derived(!composeValidationReady || !envValidationReady || composeHasErrors || envHasErrors);let nameInputRef = $state<HTMLInputElement | null>(null);@@ -67,6 +77,11 @@}async function handleCreateProject() {+ if (hasEditorErrors) {+ toast.error(m.templates_validation_error());+ return;+ }+const validated = form.validate();if (!validated) return;@@ -124,6 +139,11 @@}async function handleCreateTemplate() {+ if (hasEditorErrors) {+ toast.error(m.templates_validation_error());+ return;+ }+const validated = form.validate();if (!validated) return;@@ -197,20 +217,23 @@><ArcaneTooltip.Trigger><span>- <ArcaneButton- action="create"- tone="ghost"- disabled={!$inputs.name.value ||- !$inputs.composeContent.value ||- saving ||- converting ||- isLoadingTemplateContent}- onclick={() => handleSubmit()}- class={`${templateBtnClass} gap-2 rounded-r-none`}- loading={saving}- customLabel={m.compose_create_project()}- loadingLabel={m.common_action_creating()}- />+ {#if !hasEditorErrors}+ <ArcaneButton+ action="create"+ tone="ghost"+ disabled={!$inputs.name.value ||+ !$inputs.composeContent.value ||+ hasEditorErrors ||+ saving ||+ converting ||+ isLoadingTemplateContent}+ onclick={() => handleSubmit()}+ class={`${templateBtnClass} gap-2 rounded-r-none`}+ loading={saving}+ customLabel={m.compose_create_project()}+ loadingLabel={m.common_action_creating()}+ />+ {/if}</span></ArcaneTooltip.Trigger><ArcaneTooltip.Content class="arcane-tooltip-content max-w-[280px]">@@ -265,6 +288,7 @@class={dropdownItemClass}disabled={!$inputs.name.value ||!$inputs.composeContent.value ||+ hasEditorErrors ||saving ||converting ||creatingTemplate ||@@ -312,6 +336,14 @@language="yaml"bind:value={$inputs.composeContent.value}error={$inputs.composeContent.error ?? undefined}+ bind:hasErrors={composeHasErrors}+ bind:validationReady={composeValidationReady}+ fileId="projects:new:compose"+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: [$inputs.composeContent.value],+ globalVariables: globalVariableMap+ }}/></div>@@ -322,6 +354,14 @@language="env"bind:value={$inputs.envContent.value}error={$inputs.envContent.error ?? undefined}+ bind:hasErrors={envHasErrors}+ bind:validationReady={envValidationReady}+ fileId="projects:new:env"+ editorContext={{+ envContent: $inputs.envContent.value,+ composeContents: [$inputs.composeContent.value],+ globalVariables: globalVariableMap+ }}/></div></form>diff --git a/frontend/src/routes/(app)/projects/new/+page.ts b/frontend/src/routes/(app)/projects/new/+page.tsindex e4afd0148..c301e7714 100644--- a/frontend/src/routes/(app)/projects/new/+page.ts+++ b/frontend/src/routes/(app)/projects/new/+page.ts@@ -7,7 +7,7 @@ export const load: PageLoad = async ({ url, parent }) => {const templateId = url.searchParams.get('templateId');- const [allTemplates, defaultTemplates, selectedTemplate] = await Promise.all([+ const [allTemplates, defaultTemplates, selectedTemplate, globalVariables] = await Promise.all([queryClient.fetchQuery({queryKey: queryKeys.templates.allTemplates(),@@ -36,13 +36,23 @@ export const load: PageLoad = async ({ url, parent }) => {console.warn('Failed to load selected template:', err);return null;})- : Promise.resolve(null)+ : Promise.resolve(null),+ queryClient+ .fetchQuery({+ queryKey: queryKeys.templates.globalVariables(),+ queryFn: () => templateService.getGlobalVariables()+ })+ .catch((err) => {+ console.warn('Failed to load global variables:', err);+ return [];+ })]);return {composeTemplates: allTemplates,envTemplate: selectedTemplate?.envContent || defaultTemplates.envTemplate,defaultTemplate: selectedTemplate?.content || defaultTemplates.composeTemplate,- selectedTemplate: selectedTemplate?.template || null+ selectedTemplate: selectedTemplate?.template || null,+ globalVariables};};diff --git a/go.work.sum b/go.work.sumindex 5c53afb96..0ed43bbdb 100644--- a/go.work.sum+++ b/go.work.sum@@ -510,6 +510,8 @@ github.com/smallstep/pkcs7 v0.1.1 h1:x+rPdt2W088V9Vkjho4KtoggyktZJlMduZAtRHm68LUgithub.com/smallstep/pkcs7 v0.1.1/go.mod h1:dL6j5AIz9GHjVEBTXtW+QliALcgM19RtXaTeyxI+AfA=github.com/snowflakedb/gosnowflake v1.6.19 h1:KSHXrQ5o7uso25hNIzi/RObXtnSGkFgie91X82KcvMY=github.com/snowflakedb/gosnowflake v1.6.19/go.mod h1:FM1+PWUdwB9udFDsXdfD58NONC0m+MlOSmQRvimobSM=+github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=+github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=github.com/spf13/jwalterweatherman v0.0.0-20141219030609-3d60171a6431 h1:XTHrT015sxHyJ5FnQ0AeemSspZWaDq7DoTRW0EVsDCE=github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo=github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs=@@ -623,6 +625,7 @@ golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 h1:LvzTn0GQhWuvKH/kVRSgolang.org/x/telemetry v0.0.0-20251008203120-078029d740a8/go.mod h1:Pi4ztBfryZoJEkyFTI5/Ocsu2jXyDr6iSdgJiYE/uwE=golang.org/x/telemetry v0.0.0-20251111182119-bc8e575c7b54/go.mod h1:hKdjCMrbv9skySur+Nek8Hd0uJ0GuxJIoIX2payrIdQ=golang.org/x/telemetry v0.0.0-20251203150158-8fff8a5912fc/go.mod h1:hKdjCMrbv9skySur+Nek8Hd0uJ0GuxJIoIX2payrIdQ=+golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2 h1:O1cMQHRfwNpDfDJerqRoE2oD+AFlyid87D40L/OkkJo=golang.org/x/telemetry v0.0.0-20260109210033-bd525da824e2/go.mod h1:b7fPSJ0pKZ3ccUh8gnTONJxhn3c/PS6tyzQvyqw4iA8=golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 06d90f006..a62d28fa9 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -62,9 +62,33 @@ importers:frontend:dependencies:- '@shikijs/monaco':- specifier: ^3.21.0- version: 3.21.0+ '@codemirror/autocomplete':+ specifier: ^6.20.0+ version: 6.20.0+ '@codemirror/lang-yaml':+ specifier: ^6.1.2+ version: 6.1.2+ '@codemirror/language':+ specifier: ^6.11.3+ version: 6.12.1+ '@codemirror/legacy-modes':+ specifier: ^6.5.2+ version: 6.5.2+ '@codemirror/lint':+ specifier: ^6.9.1+ version: 6.9.4+ '@codemirror/merge':+ specifier: ^6.12.0+ version: 6.12.0+ '@codemirror/state':+ specifier: ^6.5.2+ version: 6.5.4+ '@codemirror/view':+ specifier: ^6.38.8+ version: 6.39.15+ '@lezer/highlight':+ specifier: ^1.2.3+ version: 1.2.3'@sveltejs/adapter-static':specifier: ^3.0.10version: 3.0.10(@sveltejs/[email protected](@sveltejs/[email protected]([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])))@@ -77,12 +101,18 @@ importers:'@tanstack/table-core':specifier: ^8.21.3version: 8.21.3+ '@uiw/codemirror-themes':+ specifier: ^4.25.2+ version: 4.25.4(@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])'@xterm/addon-fit':specifier: ^0.11.0version: 0.11.0'@xterm/xterm':specifier: ^6.0.0version: 6.0.0+ ajv:+ specifier: '>=8.18.0'+ version: 8.18.0ansi-to-html:specifier: ^0.7.2version: 0.7.2@@ -95,9 +125,6 @@ importers:js-yaml:specifier: ^4.1.1version: 4.1.1- monaco-editor:- specifier: ^0.55.1- version: 0.55.1prettier:specifier: ^3.8.0version: 3.8.0@@ -107,15 +134,18 @@ importers:prettier-plugin-tailwindcss:specifier: ^0.7.2version: 0.7.2(@prettier/[email protected])([email protected]([email protected])([email protected]))([email protected])- shiki:- specifier: ^3.22.0- version: 3.22.0svelte:specifier: ^5.51.5version: 5.51.5+ svelte-codemirror-editor:+ specifier: ^2.1.0+ version: 2.1.0([email protected])([email protected])svelte-motion:specifier: ^0.12.2version: 0.12.2([email protected])+ yaml:+ specifier: ^2.8.2+ version: 2.8.2devDependencies:'@iconify/json':specifier: ^2.2.441@@ -294,6 +324,36 @@ packages:resolution: {integrity: sha512-ctxtJ/eA+t+6q2++vj5j7FYX3nRu311q1wfYH3xjlLOsczhlhxAg2FWNUXhpGvAw3BWo1xBcvOV6/YLc2r5FJw==}hasBin: true+ '@codemirror/[email protected]':+ resolution: {integrity: sha512-bOwvTOIJcG5FVo5gUUupiwYh8MioPLQ4UcqbcRf7UQ98X90tCa9E1kZ3Z7tqwpZxYyOvh1YTYbmZE9RTfTp5hg==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-vvX1fsih9HledO1c9zdotZYUZnE4xV0m6i3m25s5DIfXofuprk6cRcLUZvSk3CASUbwjQX21tOGbkY2BH8TpnQ==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-dxrfG8w5Ce/QbT7YID7mWZFKhdhsaTNOYjOkSIMt1qmC4VQnXSDSYVHHHn8k6kJUfIhtLo8t1JJgltlxWdsITw==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-Fa6xkSiuGKc8XC8Cn96T+TQHYj4ZZ7RdFmXA3i9xe/3hLHfwPZdM+dqfX0Cp0zQklBKhVD8Yzc8LS45rkqcwpQ==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-/jJbwSTazlQEDOQw2FJ8LEEKVS72pU0lx6oM54kGpL8t/NJ2Jda3CZ4pcltiKTdqYSRk3ug1B3pil1gsjA6+8Q==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-ABc9vJ8DEmvOWuH26P3i8FpMWPQkduD9Rvba5iwb6O3hxASgclm3T3krGo8NASXkHCidz6b++LWlzWIUfEPSWw==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-o+36bbapcEHf4Ux75pZ4CKjMBUd14parA0uozvWVlacaT+uxaA3DDefEvWYjngsKU+qsrDe/HOOfsw0Q72pLjA==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw==}++ '@codemirror/[email protected]':+ resolution: {integrity: sha512-aCWjgweIIXLBHh7bY6cACvXuyrZ0xGafjQ2VInjp4RM4gMfscK5uESiNdrH0pE+e1lZr2B4ONGsjchl2KsKZzg==}+'@csstools/[email protected]':resolution: {integrity: sha512-NmXRccUJMk2AWA5A7e5a//3bCIMyOu2hAtdRYrhPPHjDxINuCwX1w6rnIZ4xjLcp0ayv6h8Pc3X0eJUGiAAXHQ==}engines: {node: '>=20.19.0'}@@ -1246,6 +1306,18 @@ packages:'@jridgewell/[email protected]':resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}+ '@lezer/[email protected]':+ resolution: {integrity: sha512-6YRVG9vBkaY7p1IVxL4s44n5nUnaNnGM2/AckNgYOnxTG2kWh1vR8BMxPseWPjRNpb5VtXnMpeYAEAADoRV1Iw==}++ '@lezer/[email protected]':+ resolution: {integrity: sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g==}++ '@lezer/[email protected]':+ resolution: {integrity: sha512-bPWa0Pgx69ylNlMlPvBPryqeLYQjyJjqPx+Aupm5zydLIF3NE+6MMLT8Yi23Bd9cif9VS00aUebn+6fDIGBcDA==}++ '@lezer/[email protected]':+ resolution: {integrity: sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw==}+'@lix-js/[email protected]':resolution: {integrity: sha512-pRbW+joG12L0ULfMiWYosIW0plmW4AsUdiPCp+Z8rAsElJ+wJ6in58zhD3UwUcd4BNcpldEGjg6PdA7e0RgsDQ==}engines: {node: '>=18'}@@ -1253,6 +1325,9 @@ packages:'@lix-js/[email protected]':resolution: {integrity: sha512-jBeALB6prAbtr5q4vTuxnRZZv1M2rKe8iNqRQhFJ4Tv7150unEa0vKyz0hs8Gl3fUGsWaNJBh3J8++fpbrpRBQ==}+ '@marijn/[email protected]':+ resolution: {integrity: sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==}+'@napi-rs/[email protected]':resolution: {integrity: sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==}@@ -1800,36 +1875,6 @@ packages:'@selderee/[email protected]':resolution: {integrity: sha512-P33hHGdldxGabLFjPPpaTxVolMrzrcegejx+0GxjrIb9Zv48D8yAIA/QTDR2dFl7Uz7urX8aX6+5bCZslr+gWQ==}- '@shikijs/[email protected]':- resolution: {integrity: sha512-AXSQu/2n1UIQekY8euBJlvFYZIw0PHY63jUzGbrOma4wPxzznJXTXkri+QcHeBNaFxiiOljKxxJkVSoB3PjbyA==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-iAlTtSDDbJiRpvgL5ugKEATDtHdUVkqgHDm/gbD2ZS9c88mx7G1zSYjjOxp5Qa0eaW0MAQosFRmJSk354PRoQA==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-jdKhfgW9CRtj3Tor0L7+yPwdG3CgP7W+ZEqSsojrMzCjD1e0IxIbwUMDDpYlVBlC08TACg4puwFGkZfLS+56Tw==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-DyXsOG0vGtNtl7ygvabHd7Mt5EY8gCNqR9Y7Lpbbd/PbJvgWrqaKzH1JW6H6qFkuUa8aCxoiYVv8/YfFljiQxA==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-x/42TfhWmp6H00T6uwVrdTJGKgNdFbrEdhaDwSR5fd5zhQ1Q46bHq9EO61SCEWJR0HY7z2HNDMaBZp8JRmKiIA==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-vYUBk5e89vlJbrGuLXaL+gQNGRVYUQOTEeWOnWb89ZL4hwDOBdbPftm0m8cPuD6H6HOdw+C48rGnATuMmGTaJg==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-o+tlOKqsr6FE4+mYJG08tfCFDS+3CG20HbldXeVoyP+cYSUxDhrFf3GPjE60U55iOkkjbpY2uC3It/eeja35/g==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-zGrWOxZ0/+0ovPY7PvBU2gIS9tmhSUUt30jAcNV0Bq0gb2S98gwfjIs1vxlmH5zM7/4YxLamT6ChlqqAJmPPjA==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-491iAekgKDBFE67z70Ok5a8KBMsQ2IJwOWw3us/7ffQkIBCyOQfm/aNwVMBUriP02QshIfgHCBSIYAl3u2eWjg==}-- '@shikijs/[email protected]':- resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==}-'@sideway/[email protected]':resolution: {integrity: sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==}@@ -2027,18 +2072,12 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}- '@types/[email protected]':- resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}-'@types/[email protected]':resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==}'@types/[email protected]':resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==}- '@types/[email protected]':- resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==}-'@types/[email protected]':resolution: {integrity: sha512-zWW5KPngR/yvakJgGOmZ5vTBemDoSqF3AcV/LrO5u5wTWyEAVVh+IT39G4gtyAkh3CtTZs8aX/yRM82OfzHJRg==}@@ -2059,9 +2098,6 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==}- '@types/[email protected]':- resolution: {integrity: sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==}-'@types/[email protected]':resolution: {integrity: sha512-T8L6i7wCuyoK8A/ZeLYt1+q0ty3Zb9+qbSSvrIVitzT3YjZqkTZ40IbRsPanlB4h1QB3JVL1SYCdR6ngtFYcuA==}@@ -2118,8 +2154,12 @@ packages:resolution: {integrity: sha512-AxNRwEie8Nn4eFS1FzDMJWIISMGoXMb037sgCBJ3UR6o0fQTzr2tqN9WT+DkWJPhIdQCfV7T6D387566VtnCJA==}engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}- '@ungap/[email protected]':- resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}+ '@uiw/[email protected]':+ resolution: {integrity: sha512-2SLktItgcZC4p0+PfFusEbAHwbuAWe3bOOntCevVgHtrWGtGZX3IPv2k8IKZMgOXtAHyGKpJvT9/nspPn/uCQg==}+ peerDependencies:+ '@codemirror/language': '>=6.0.0'+ '@codemirror/state': '>=6.0.0'+ '@codemirror/view': '>=6.0.0''@valibot/[email protected]':resolution: {integrity: sha512-GE7DmSr1C2UCWPiV0upRH6mv0cCPsqYGs819fb6srCS1tWhyXrkGGe+zxUiwzn/L1BOfADH4sNjY/YHCuP8phQ==}@@ -2268,9 +2308,6 @@ packages:resolution: {integrity: sha512-BCfFL1sHijQlBGWBMuJyhZUhzo7wer5sVj9hqekB/7xn0Ypy+pER/edCYQm4exbXj4WiySGp40P8UuTh6w1srg==}- resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==}-resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}engines: {node: '>=10'}@@ -2279,12 +2316,6 @@ packages:resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==}engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}- resolution: {integrity: sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==}-- resolution: {integrity: sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==}-resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==}engines: {node: '>= 14.16.0'}@@ -2314,6 +2345,9 @@ packages:resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}engines: {node: '>=6'}+ resolution: {integrity: sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==}+resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}engines: {node: '>=7.0.0'}@@ -2328,9 +2362,6 @@ packages:resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}engines: {node: '>= 0.8'}- resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}-resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==}engines: {node: '>=16'}@@ -2382,6 +2413,9 @@ packages:resolution: {integrity: sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==}engines: {node: '>= 0.10'}+ resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==}+resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}engines: {node: '>= 8'}@@ -2460,9 +2494,6 @@ packages:resolution: {integrity: sha512-nc7XjUU/2Lb+SvEFVGcWLiKkzfw8+qHI7zn8WYXKkLMgfGSHbgCEaR6bJpev8Cm6Rmrb19Gfd/tZvGqx9is3wg==}- resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}-resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}@@ -2476,9 +2507,6 @@ packages:resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==}engines: {node: '>= 4'}- resolution: {integrity: sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==}-resolution: {integrity: sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==}@@ -2781,12 +2809,6 @@ packages:resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-OguPdidb+fbHQSU4Q4ZiLKnzWo8Wwsf5bZfbvu7//a9oTYoqD/fWpe96NuHkoS9h0ccGOTe0C4NGXdtS0iObOw==}-- resolution: {integrity: sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==}-resolution: {integrity: sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q==}@@ -2798,9 +2820,6 @@ packages:resolution: {integrity: sha512-qY60FjREgVZL03vJU6IfMV4GDjGBIoOyvuFdpBDIX9yTlDw0TjxVBQp+P8NvpdIXNJvfWBTNul7fsAQJq2FNpg==}engines: {node: '>=14'}- resolution: {integrity: sha512-bEqo66MRXsUGxWHV5IP0PUiAWwoEjba4VCzg0LjFJBpchPaTfyfCKTG6bc5F8ucKec3q5y6qOdGyYTSBEvhCrg==}-resolution: {integrity: sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==}@@ -3168,11 +3187,6 @@ packages:resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}- resolution: {integrity: sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==}- engines: {node: '>= 18'}- hasBin: true-resolution: {integrity: sha512-8dD6FusOQSrpv9Z1rdNMdlSgQOIP880DHqnohobOmYLElGEqAL/JvxvuxZO16r4HtjTlfPRDC1hbvxC9dPN2nA==}engines: {node: '>= 18'}@@ -3182,9 +3196,6 @@ packages:resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==}engines: {node: '>= 0.4'}- resolution: {integrity: sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==}-resolution: {integrity: sha512-IEn+pegP1aManZuckezWCO+XZQDplx1366JoVhTpMpBB1sPey/SbveZQUosKiKiGYjg1wH4pMlNgXbCiYgihQA==}@@ -3195,21 +3206,6 @@ packages:resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}engines: {node: '>= 8'}- resolution: {integrity: sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==}-- resolution: {integrity: sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==}-- resolution: {integrity: sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==}-- resolution: {integrity: sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==}-- resolution: {integrity: sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==}-resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==}engines: {node: '>=8.6'}@@ -3260,9 +3256,6 @@ packages:peerDependencies:svelte: ^5.27.0- resolution: {integrity: sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A==}-resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==}engines: {node: '>=4'}@@ -3335,12 +3328,6 @@ packages:resolution: {integrity: sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==}engines: {node: '>=18'}- resolution: {integrity: sha512-8Unqkvk1RYc6yq2WBYRj4hdnsAxVze8i7iPfQr8e4uSP3tRv0rpZcbGUDvxfQQcdwHt/e9PrMvGCsa8OqG9X3w==}-- resolution: {integrity: sha512-3VhUGN3w2eYxnTzHn+ikMI+fp/96KoRSVK9/kMTcFqj1NRDh2IhQCKvYxDnWePKRXY/AqH+Fuiyb7VHSzBjHfA==}-resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}engines: {node: '>= 0.8.0'}@@ -3532,9 +3519,6 @@ packages:resolution: {integrity: sha512-SVtmxhRE/CGkn3eZY1T6pC8Nln6Fr/lu1mKSgRud0eC73whjGfoAogbn78LkD8aFL0zz3bAFerKSnOl7NlErBA==}- resolution: {integrity: sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==}-resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}@@ -3569,15 +3553,6 @@ packages:resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}engines: {node: '>= 14.18.0'}- resolution: {integrity: sha512-0YCaSCq2VRIebiaUviZNs0cBz1kg5kVS2UKUfNIx8YVs1cN3AV7NTctO5FOKBA+UT2BPJIWZauYHPqJODG50cg==}-- resolution: {integrity: sha512-8VhliFJAWRaUiVvREIiW2NXXTmHs4vMNnSzuJVhscgmGav3g9VDxLrQndI3dZZVVdp0ZO/5v0xmX516/7M9cng==}-- resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==}-resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==}engines: {node: '>=0.10.0'}@@ -3683,9 +3658,6 @@ packages:resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}engines: {node: '>=8'}- resolution: {integrity: sha512-LBnhsoYEe0Eou4e1VgJACes+O6S6QC0w71fCSp5Oya79inkwkm15gQ1UF6VtQ8j/taMDh79hAB49WUk8ALQW3g==}-resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}engines: {node: '>=14'}@@ -3727,9 +3699,6 @@ packages:resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}engines: {node: '>=0.10.0'}- resolution: {integrity: sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==}-resolution: {integrity: sha512-TzjBNv7KwRw6E3pdKdlRyZiTmUIE0UttT/Sl56MVwVARl/u5gp978KepazCJZewFUnlWHz9i3NQd4kOtP/Afdg==}peerDependencies:@@ -3751,9 +3720,6 @@ packages:resolution: {integrity: sha512-KpqHIdDL9KwYk22wEOg/VIqYbrnLeSApsKT/bSj6Ez7pn3CftUiLAv2Lccpq1ALcpLV9UX1Ppn92npZWu2w/aw==}engines: {node: '>=20'}- resolution: {integrity: sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==}-resolution: {integrity: sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==}engines: {node: '>=12'}@@ -3776,6 +3742,9 @@ packages:resolution: {integrity: sha512-zOh9jPYI+xrNOyisSelgym4tolKTJCQd5GBhK0+0xJvcYDcwlOoxF/rnFKQ2KRZknXSG9jWAp66fwP6AxN9STg==}+ resolution: {integrity: sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==}+resolution: {integrity: sha512-5A560JmXr7wDyGLK12Nq/EYS38VkGlglVzkis1JEdbGWSnbQIEhZzTJhzURXN5/8WwwFCs/f/VVcmkTppbXLow==}@@ -3811,6 +3780,12 @@ packages:svelte: ^4.0.0 || ^5.0.0-next.0typescript: '>=5.0.0'+ resolution: {integrity: sha512-WGkSsIYNpVcOVxaQPkmdBQhaGyKLmg6pgaS/b+7guRb4eikrbXYtvNFuW2AzKJi8ZbLhSngrf3SRiZOuwuskrQ==}+ peerDependencies:+ codemirror: ^6.0.0+ svelte: ^5.0.0+resolution: {integrity: sha512-7RrdRz9iVP55B9HT/C0hYW3pyrKlF61kAby/AkDtOAP0uHFQDrfd0qQetDC81cEsK9b40jt+jfcqSAXcA7LPEw==}peerDependencies:@@ -3930,9 +3905,6 @@ packages:resolution: {integrity: sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==}engines: {node: '>=20'}- resolution: {integrity: sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==}-resolution: {integrity: sha512-FPAhNPFMrkwz76P7cdjdmiShwMynZYN6SgOujD1urY4oNm80Ou9oMdmbR45LotcKOXoy7wSmHkRFE6Mxbrhefw==}@@ -3998,21 +3970,6 @@ packages:resolution: {integrity: sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==}engines: {node: '>=18.17'}- resolution: {integrity: sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==}-- resolution: {integrity: sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==}-- resolution: {integrity: sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==}-- resolution: {integrity: sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==}-- resolution: {integrity: sha512-m+vIdyeCOpdr/QeQCu2EzxX/ohgS8KbnPDgFni4dQsfSCtpz8UqDyY5GjRru8PDKuYn7Fq19j1CQ+nJSsGKOzg==}-resolution: {integrity: sha512-rv0XEJepajKzDLvRUWASM8K+8+/CCfZn2jtogXqg6RIp7kpatRc/aFrVJn8ANQA09e++lPEEv9yX8cC9enc+QQ==}peerDependencies:@@ -4071,12 +4028,6 @@ packages:peerDependencies:svelte: ^5.0.0- resolution: {integrity: sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==}-- resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}-resolution: {integrity: sha512-MobvwqX76Vqt/O4AbnNMNWoXWGrKUqZbphCUle/J2KXH82yKQiunOeKnz/nqEPosPsoWWPP9FtNuPBSYpiiwkw==}peerDependencies:@@ -4133,6 +4084,9 @@ packages:vite:optional: true+ resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==}+resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==}engines: {node: '>=18'}@@ -4218,9 +4172,6 @@ packages:resolution: {integrity: sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==}- resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}-snapshots:'@acemir/[email protected]': {}@@ -4310,6 +4261,74 @@ snapshots:dependencies:css-tree: 3.1.0+ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/language': 6.12.1+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15+ '@lezer/common': 1.5.1++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/language': 6.12.1+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15+ '@lezer/common': 1.5.1++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/autocomplete': 6.20.0+ '@codemirror/language': 6.12.1+ '@codemirror/state': 6.5.4+ '@lezer/common': 1.5.1+ '@lezer/highlight': 1.2.3+ '@lezer/lr': 1.4.8+ '@lezer/yaml': 1.0.4++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15+ '@lezer/common': 1.5.1+ '@lezer/highlight': 1.2.3+ '@lezer/lr': 1.4.8+ style-mod: 4.1.3++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/language': 6.12.1++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15+ crelt: 1.0.6++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/language': 6.12.1+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15+ '@lezer/highlight': 1.2.3+ style-mod: 4.1.3++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15+ crelt: 1.0.6++ '@codemirror/[email protected]':+ dependencies:+ '@marijn/find-cluster-break': 1.0.2++ '@codemirror/[email protected]':+ dependencies:+ '@codemirror/state': 6.5.4+ crelt: 1.0.6+ style-mod: 4.1.3+ w3c-keyname: 2.2.8+'@csstools/[email protected]': {}'@csstools/[email protected](@csstools/[email protected](@csstools/[email protected]))(@csstools/[email protected])':@@ -4914,6 +4933,22 @@ snapshots:'@jridgewell/resolve-uri': 3.1.2'@jridgewell/sourcemap-codec': 1.5.5+ '@lezer/[email protected]': {}++ '@lezer/[email protected]':+ dependencies:+ '@lezer/common': 1.5.1++ '@lezer/[email protected]':+ dependencies:+ '@lezer/common': 1.5.1++ '@lezer/[email protected]':+ dependencies:+ '@lezer/common': 1.5.1+ '@lezer/highlight': 1.2.3+ '@lezer/lr': 1.4.8+'@lix-js/[email protected]':dependencies:'@lix-js/server-protocol-schema': 0.1.1@@ -4928,6 +4963,8 @@ snapshots:'@lix-js/[email protected]': {}+ '@marijn/[email protected]': {}+'@napi-rs/[email protected]':dependencies:'@emnapi/core': 1.8.1@@ -5287,57 +5324,6 @@ snapshots:domhandler: 5.0.3selderee: 0.11.0- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 3.21.0- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.4- hast-util-to-html: 9.0.5-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 3.22.0- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.4- hast-util-to-html: 9.0.5-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 3.22.0- '@shikijs/vscode-textmate': 10.0.2- oniguruma-to-es: 4.3.4-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 3.22.0- '@shikijs/vscode-textmate': 10.0.2-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 3.22.0-- '@shikijs/[email protected]':- dependencies:- '@shikijs/core': 3.21.0- '@shikijs/types': 3.21.0- '@shikijs/vscode-textmate': 10.0.2-- '@shikijs/[email protected]':- dependencies:- '@shikijs/types': 3.22.0-- '@shikijs/[email protected]':- dependencies:- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.4-- '@shikijs/[email protected]':- dependencies:- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.4-- '@shikijs/[email protected]': {}-'@sideway/[email protected]':dependencies:'@hapi/hoek': 9.3.0@@ -5510,18 +5496,10 @@ snapshots:'@types/[email protected]': {}- '@types/[email protected]':- dependencies:- '@types/unist': 3.0.3-'@types/[email protected]': {}'@types/[email protected]': {}- '@types/[email protected]':- dependencies:- '@types/unist': 3.0.3-'@types/[email protected]':dependencies:undici-types: 7.16.0@@ -5543,8 +5521,6 @@ snapshots:'@types/[email protected]': {}- '@types/[email protected]': {}-'@types/[email protected]':optional: true@@ -5613,7 +5589,11 @@ snapshots:'@typescript-eslint/types': 8.55.0eslint-visitor-keys: 4.2.1- '@ungap/[email protected]': {}+ '@uiw/[email protected](@codemirror/[email protected])(@codemirror/[email protected])(@codemirror/[email protected])':+ dependencies:+ '@codemirror/language': 6.12.1+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15dependencies:@@ -5765,8 +5745,6 @@ snapshots:- [email protected]: {}-dependencies:ansi-styles: 4.3.0@@ -5774,10 +5752,6 @@ snapshots:- [email protected]: {}-- [email protected]: {}-dependencies:readdirp: 4.1.2@@ -5808,6 +5782,16 @@ snapshots:+ dependencies:+ '@codemirror/autocomplete': 6.20.0+ '@codemirror/commands': 6.10.2+ '@codemirror/language': 6.12.1+ '@codemirror/lint': 6.9.4+ '@codemirror/search': 6.6.0+ '@codemirror/state': 6.5.4+ '@codemirror/view': 6.39.15+dependencies:color-name: 1.1.4@@ -5820,8 +5804,6 @@ snapshots:dependencies:delayed-stream: 1.0.0- [email protected]: {}-@@ -5868,6 +5850,8 @@ snapshots:object-assign: 4.1.1vary: 1.1.2+ [email protected]: {}+dependencies:path-key: 3.1.1@@ -5928,10 +5912,6 @@ snapshots:- dependencies:- dequal: 2.0.3-optional: true@@ -5947,10 +5927,6 @@ snapshots:dependencies:domelementtype: 2.3.0- optionalDependencies:- '@types/trusted-types': 2.0.7-optionalDependencies:'@types/trusted-types': 2.0.7@@ -6373,24 +6349,6 @@ snapshots:dependencies:function-bind: 1.1.2- dependencies:- '@types/hast': 3.0.4- '@types/unist': 3.0.3- ccount: 2.0.1- comma-separated-tokens: 2.0.3- hast-util-whitespace: 3.0.0- html-void-elements: 3.0.0- mdast-util-to-hast: 13.2.1- property-information: 7.1.0- space-separated-tokens: 2.0.2- stringify-entities: 4.0.4- zwitch: 2.0.4-- dependencies:- '@types/hast': 3.0.4-@@ -6407,8 +6365,6 @@ snapshots:htmlparser2: 8.0.2selderee: 0.11.0- [email protected]: {}-dependencies:domelementtype: 2.3.0@@ -6746,47 +6702,16 @@ snapshots:dependencies:'@jridgewell/sourcemap-codec': 1.5.5- [email protected]: {}-- dependencies:- '@types/hast': 3.0.4- '@types/mdast': 4.0.4- '@ungap/structured-clone': 1.3.0- devlop: 1.1.0- micromark-util-sanitize-uri: 2.0.1- trim-lines: 3.0.1- unist-util-position: 5.0.0- unist-util-visit: 5.1.0- vfile: 6.0.3-- dependencies:- micromark-util-symbol: 2.0.1- micromark-util-types: 2.0.2-- [email protected]: {}-- dependencies:- micromark-util-character: 2.1.1- micromark-util-encode: 2.0.1- micromark-util-symbol: 2.0.1-- [email protected]: {}-- [email protected]: {}-dependencies:braces: 3.0.3@@ -6835,11 +6760,6 @@ snapshots:svelte: 5.51.5svelte-toolbelt: 0.7.1([email protected])- dependencies:- dompurify: 3.2.7- marked: 14.0.0-@@ -6900,14 +6820,6 @@ snapshots:dependencies:mimic-function: 5.0.1- [email protected]: {}-- dependencies:- oniguruma-parser: 0.12.1- regex: 6.1.0- regex-recursion: 6.0.2-dependencies:deep-is: 0.1.4@@ -7091,8 +7003,6 @@ snapshots:optional: true- [email protected]: {}-@@ -7137,16 +7047,6 @@ snapshots:- dependencies:- regex-utilities: 2.3.0-- [email protected]: {}-- dependencies:- regex-utilities: 2.3.0-@@ -7280,17 +7180,6 @@ snapshots:- dependencies:- '@shikijs/core': 3.22.0- '@shikijs/engine-javascript': 3.22.0- '@shikijs/engine-oniguruma': 3.22.0- '@shikijs/langs': 3.22.0- '@shikijs/themes': 3.22.0- '@shikijs/types': 3.22.0- '@shikijs/vscode-textmate': 10.0.2- '@types/hast': 3.0.4-@@ -7349,8 +7238,6 @@ snapshots:optional: true- [email protected]: {}-dependencies:'@sqlite.org/sqlite-wasm': 3.48.0-build4@@ -7371,11 +7258,6 @@ snapshots:get-east-asian-width: 1.4.0strip-ansi: 7.1.2- dependencies:- character-entities-html4: 2.1.0- character-entities-legacy: 3.0.0-dependencies:ansi-regex: 6.2.2@@ -7392,6 +7274,8 @@ snapshots:+ [email protected]: {}+dependencies:inline-style-parser: 0.2.4@@ -7425,6 +7309,11 @@ snapshots:transitivePeerDependencies:- picomatch+ dependencies:+ codemirror: 6.0.2+ svelte: 5.51.5+dependencies:'@types/react': 18.3.28@@ -7575,8 +7464,6 @@ snapshots:dependencies:punycode: 2.3.1- [email protected]: {}-optional: true@@ -7629,29 +7516,6 @@ snapshots:- dependencies:- '@types/unist': 3.0.3-- dependencies:- '@types/unist': 3.0.3-- dependencies:- '@types/unist': 3.0.3-- dependencies:- '@types/unist': 3.0.3- unist-util-is: 6.0.1-- dependencies:- '@types/unist': 3.0.3- unist-util-is: 6.0.1- unist-util-visit-parents: 6.0.2-dependencies:'@antfu/install-pkg': 1.1.0@@ -7693,16 +7557,6 @@ snapshots:svelte: 5.51.5svelte-toolbelt: 0.7.1([email protected])- dependencies:- '@types/unist': 3.0.3- unist-util-stringify-position: 4.0.0-- dependencies:- '@types/unist': 3.0.3- vfile-message: 4.0.3-[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])):dependencies:uuid: 11.1.0@@ -7730,6 +7584,8 @@ snapshots:optionalDependencies:vite: 8.0.0-beta.13(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])+ [email protected]: {}+dependencies:xml-name-validator: 5.0.0@@ -7792,5 +7648,3 @@ snapshots:optional: true-- [email protected]: {}diff --git a/tests/spec/converter.spec.ts b/tests/spec/converter.spec.tsindex 8ad3e3e35..b3d7ae5ea 100644--- a/tests/spec/converter.spec.ts+++ b/tests/spec/converter.spec.ts@@ -1,4 +1,4 @@-import { test, expect, type Page } from '@playwright/test';+import { test, expect, type Page } from "@playwright/test";type ConvertResponse = {success: boolean;@@ -8,51 +8,70 @@ type ConvertResponse = {};const ROUTES = {- page: '/projects/new',- apiConvert: '/api/environments/0/system/convert',+ page: "/projects/new",+ apiConvert: "/api/environments/0/system/convert",};const SELECTORS = {- convertButton: (name = 'Convert to Compose') => ({ name }),- textareaPlaceholder: 'docker run -d --name my-app -p 8080:80 nginx:alpine',+ convertButton: (name = "Convert to Compose") => ({ name }),+ textareaPlaceholder: "docker run -d --name my-app -p 8080:80 nginx:alpine",exampleButtonName: /docker run -d --name nginx/,- successToast: 'Docker run command converted successfully!',- exampleCommandExpected: 'docker run -d --name nginx -p 8080:80 -v nginx_data:/usr/share/nginx/html nginx:alpine',- removeNewline: (s: string) => s.replace(/\r\n/g, '\n'),+ successToast: "Docker run command converted successfully!",+ exampleCommandExpected: "docker run -d --name nginx -p 8080:80 -v nginx_data:/usr/share/nginx/html nginx:alpine",+ removeNewline: (s: string) => s.replace(/\r\n/g, "\n"),};async function openConvertFromDockerRun(page: Page) {- // Wait for the page to be fully loaded and the button group to be visible- await page.waitForLoadState('networkidle');-- // Find the dropdown trigger button with chevron-down icon (ChevronDown / ArrowDownIcon)- const dropdownTrigger = page.locator('button:has(svg)').filter({ hasText: '' }).last();+ // Wait for the page to be fully loaded+ await page.waitForLoadState("networkidle");++ // Split-button chevron trigger on /projects/new. (Trigger is rendered via child snippet,+ // so data-slot="dropdown-menu-trigger" may not be present on the final button element.)+ let dropdownTrigger = page.locator("button.rounded-l-none.px-2").first();+ if ((await dropdownTrigger.count()) === 0) {+ // Fallback for markup changes: use the old icon-only heuristic+ dropdownTrigger = page.locator("button:has(svg)").filter({ hasText: "" }).last();+ }++ await expect(dropdownTrigger).toBeVisible();await dropdownTrigger.click();- // Click the Convert from Docker Run menu item- await page.getByRole('menuitem', { name: 'Convert from Docker Run' }).click();+ // Prefer text match, but keep positional fallback for non-English locales.+ const menuItems = page.locator('[data-slot="dropdown-menu-item"], [role="menuitem"]');+ await expect(menuItems.first()).toBeVisible();++ const convertItemByText = menuItems.filter({ hasText: /Convert from Docker Run/i }).first();+ if (await convertItemByText.count()) {+ await convertItemByText.click();+ } else {+ // Item order in this menu is: template, converter, git repo, separator, ...+ await menuItems.nth(1).click();+ }++ // Ensure converter dialog is open before interacting with inputs+ await expect(page.getByRole("button", SELECTORS.convertButton())).toBeVisible();}async function setupMockConvert(page: Page, payload: ConvertResponse) {await page.route(ROUTES.apiConvert, async (route) => {await route.fulfill({status: 200,- contentType: 'application/json',+ contentType: "application/json",body: JSON.stringify(payload),});});}-test.describe('Docker Run to Compose Converter', () => {+test.describe("Docker Run to Compose Converter", () => {test.beforeEach(async ({ page }) => {await page.goto(ROUTES.page);- await page.waitForLoadState('networkidle');+ await page.waitForLoadState("networkidle");});- test('should convert simple docker run command', async ({ page }) => {+ test("should convert simple docker run command", async ({ page }) => {await openConvertFromDockerRun(page);- const dockerCommand = 'docker run -d --name nginx -p 8080:80 nginx:alpine';+ const dockerCommand = "docker run -d --name nginx -p 8080:80 nginx:alpine";await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill(dockerCommand);await setupMockConvert(page, {@@ -63,25 +82,25 @@ test.describe('Docker Run to Compose Converter', () => {container_name: nginxports:- 8080:80`,- envVars: '',- serviceName: 'nginx',+ envVars: "",+ serviceName: "nginx",});- await page.getByRole('button', SELECTORS.convertButton()).click();+ await page.getByRole("button", SELECTORS.convertButton()).click();await expect(page.getByText(SELECTORS.successToast)).toBeVisible();- await expect(page.getByRole('button', { name: 'nginx', exact: true })).toBeVisible();+ await expect(page.getByRole("button", { name: "nginx", exact: true })).toBeVisible();- await expect(page.getByPlaceholder(SELECTORS.textareaPlaceholder)).toHaveValue('');+ await expect(page.getByPlaceholder(SELECTORS.textareaPlaceholder)).toHaveValue("");});- test('should convert docker run command with environment variables', async ({ page }) => {+ test("should convert docker run command with environment variables", async ({ page }) => {await openConvertFromDockerRun(page);await page.waitForTimeout(300);const dockerCommand =- 'docker run -d --name postgres -e POSTGRES_DB=mydb -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass postgres:15';+ "docker run -d --name postgres -e POSTGRES_DB=mydb -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass postgres:15";await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill(dockerCommand);await setupMockConvert(page, {@@ -94,58 +113,58 @@ test.describe('Docker Run to Compose Converter', () => {- POSTGRES_DB=mydb- POSTGRES_USER=user- POSTGRES_PASSWORD=pass`,- envVars: 'POSTGRES_DB=mydb\nPOSTGRES_USER=user\nPOSTGRES_PASSWORD=pass',- serviceName: 'postgres',+ envVars: "POSTGRES_DB=mydb\nPOSTGRES_USER=user\nPOSTGRES_PASSWORD=pass",+ serviceName: "postgres",});- await page.getByRole('button', SELECTORS.convertButton()).click();+ await page.getByRole("button", SELECTORS.convertButton()).click();await expect(page.getByText(SELECTORS.successToast)).toBeVisible();- await expect(page.getByRole('button', { name: 'postgres', exact: true })).toBeVisible;+ await expect(page.getByRole("button", { name: "postgres", exact: true })).toBeVisible();});- test('should use example commands', async ({ page }) => {+ test("should use example commands", async ({ page }) => {await openConvertFromDockerRun(page);await page.waitForTimeout(300);- await page.getByRole('button', { name: SELECTORS.exampleButtonName }).first().click();+ await page.getByRole("button", { name: SELECTORS.exampleButtonName }).first().click();await expect(page.getByPlaceholder(SELECTORS.textareaPlaceholder)).toHaveValue(SELECTORS.exampleCommandExpected);});- test('should disable convert button when no command is entered', async ({ page }) => {+ test("should disable convert button when no command is entered", async ({ page }) => {await openConvertFromDockerRun(page);await page.waitForTimeout(300);- const convertBtn = page.getByRole('button', SELECTORS.convertButton());+ const convertBtn = page.getByRole("button", SELECTORS.convertButton());await expect(convertBtn).toBeDisabled();- await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill('docker run nginx');+ await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill("docker run nginx");await expect(convertBtn).toBeEnabled();await page.getByPlaceholder(SELECTORS.textareaPlaceholder).clear();await expect(convertBtn).toBeDisabled();});- test('should populate stack name only when empty', async ({ page }) => {+ test("should populate stack name only when empty", async ({ page }) => {await openConvertFromDockerRun(page);await page.waitForTimeout(300);- await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill('docker run --name redis redis:alpine');+ await page.getByPlaceholder(SELECTORS.textareaPlaceholder).fill("docker run --name redis redis:alpine");await setupMockConvert(page, {success: true,- dockerCompose: 'services:\n redis:\n image: redis:alpine',- envVars: '',- serviceName: 'redis',+ dockerCompose: "services:\n redis:\n image: redis:alpine",+ envVars: "",+ serviceName: "redis",});- await page.getByRole('button', SELECTORS.convertButton()).click();+ await page.getByRole("button", SELECTORS.convertButton()).click();await expect(page.getByText(SELECTORS.successToast)).toBeVisible();- await expect(page.getByRole('button', { name: 'redis', exact: true })).toBeVisible();+ await expect(page.getByRole("button", { name: "redis", exact: true })).toBeVisible();});});diff --git a/tests/spec/project.spec.ts b/tests/spec/project.spec.tsindex 290c99d66..6ae2bd013 100644--- a/tests/spec/project.spec.ts+++ b/tests/spec/project.spec.ts@@ -1,4 +1,4 @@-import { test, expect, type Page } from "@playwright/test";+import { test, expect, type Locator, type Page } from "@playwright/test";import { fetchProjectCountsWithRetry, fetchProjectsWithRetry } from "../utils/fetch.util";import { Project, ProjectStatusCounts } from "types/project.type";import { TEST_COMPOSE_YAML, TEST_ENV_FILE } from "../setup/project.data";@@ -14,6 +14,14 @@ async function navigateToProjects(page: Page) {await page.waitForLoadState("networkidle");}+async function setCodeMirrorValue(page: Page, editor: Locator, text: string) {+ const content = editor.locator(".cm-content").first();+ await expect(content).toBeVisible();+ await content.click({ position: { x: 10, y: 10 } });+ await content.press("ControlOrMeta+A");+ await page.keyboard.type(text, { delay: 0 });+}+let realProjects: Project[] = [];let projectCounts: ProjectStatusCounts = { runningProjects: 0, stoppedProjects: 0, totalProjects: 0 };@@ -158,6 +166,43 @@ test.describe("New Compose Project Page", () => {expect(stateUnsafe, `Unexpected state_unsafe_mutation errors: ${stateUnsafe.join("\n")}`).toHaveLength(0);});+ test("should hide Create Project when compose syntax is invalid and show it when fixed", async ({ page }) => {+ await page.getByRole("button", { name: "My New Project" }).click();+ await page.getByRole("textbox", { name: "My New Project" }).fill("syntax-check-project");+ await page.getByRole("textbox", { name: "My New Project" }).press("Enter");++ const composeEditor = page.locator(".cm-editor").first();+ await expect(composeEditor).toBeVisible();++ await setCodeMirrorValue(page, composeEditor, "services:\n\tredis:\n\t\timage: redis:latest\n");+ await expect(page.locator('button[data-slot="arcane-button"]').filter({ hasText: "Create Project" })).toHaveCount(0);++ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);+ const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: "Create Project" });+ await expect(createButton).toBeVisible();+ await expect(createButton).toBeEnabled();+ });++ test("should hide Create Project when env syntax is invalid and show it when fixed", async ({ page }) => {+ await page.getByRole("button", { name: "My New Project" }).click();+ await page.getByRole("textbox", { name: "My New Project" }).fill("env-check-project");+ await page.getByRole("textbox", { name: "My New Project" }).press("Enter");++ const composeEditor = page.locator(".cm-editor").first();+ const envEditor = page.locator(".cm-editor").nth(1);+ await expect(composeEditor).toBeVisible();+ await expect(envEditor).toBeVisible();++ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);+ await setCodeMirrorValue(page, envEditor, "NOT VALID LINE");+ await expect(page.locator('button[data-slot="arcane-button"]').filter({ hasText: "Create Project" })).toHaveCount(0);++ await setCodeMirrorValue(page, envEditor, TEST_ENV_FILE);+ const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: "Create Project" });+ await expect(createButton).toBeVisible();+ await expect(createButton).toBeEnabled();+ });+test("should create a new project successfully", async ({ page }) => {const projectName = `test-project-${Date.now()}`;const containerName = `test-redis-container-${Date.now()}`;@@ -169,51 +214,15 @@ test.describe("New Compose Project Page", () => {await page.getByRole("textbox", { name: "My New Project" }).fill(projectName);await page.getByRole("textbox", { name: "My New Project" }).press("Enter");- const composeEditor = page.locator(".monaco-editor").first();+ const composeEditor = page.locator(".cm-editor").first();await expect(composeEditor).toBeVisible();+ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);+ await expect(composeEditor).toContainText(/redis/i);- // Wait for Monaco to actually render its view before attempting input.- await expect(composeEditor.locator(".view-line").first()).toBeVisible();-- // Monaco may create the internal input textarea lazily (e.g. only after focus).- // Click first, then wait for textarea.inputarea to appear.- await composeEditor.click({ position: { x: 20, y: 20 } });- await expect(composeEditor.locator("textarea")).toHaveCount(1);-- // Use page.evaluate to set the value directly in Monaco to avoid auto-indentation issues during typing- await page.evaluate(- ({ text, lang }) => {- const models = (window as any).monaco.editor.getModels();- const model = models.find((m: any) => m.getLanguageId() === lang);- if (!model) throw new Error(`No ${lang} model found`);- model.setValue(text);- },- { text: TEST_COMPOSE_YAML, lang: "yaml" },- );-- // Basic sanity check that the new content rendered.- await expect(composeEditor.locator(".view-lines")).toContainText(/redis/i);-- const envEditor = page.locator(".monaco-editor").nth(1);+ const envEditor = page.locator(".cm-editor").nth(1);await expect(envEditor).toBeVisible();-- await expect(envEditor.locator(".view-line").first()).toBeVisible();-- await envEditor.click({ position: { x: 20, y: 20 } });- await expect(envEditor.locator("textarea")).toHaveCount(1);-- // Use page.evaluate to set the value directly in Monaco- await page.evaluate(- ({ text, lang }) => {- const models = (window as any).monaco.editor.getModels();- const model = models.find((m: any) => m.getLanguageId() === lang);- if (!model) throw new Error(`No ${lang} model found`);- model.setValue(text);- },- { text: envFile, lang: "ini" },- );-- await expect(envEditor.locator(".view-lines")).toContainText(/redis/i);+ await setCodeMirrorValue(page, envEditor, envFile);+ await expect(envEditor).toContainText(/redis/i);await page.route("/api/environments/*/projects", async (route) => {if (route.request().method() === "POST") {@@ -253,8 +262,15 @@ test.describe("New Compose Project Page", () => {await page.getByRole("tab", { name: "Services" }).click();await page.waitForLoadState("networkidle");- const serviceNameWhenStopped = page.getByRole("table").getByText("redis", { exact: true });- await expect(serviceNameWhenStopped).toBeVisible();+ const serviceTable = page.getByRole("table");+ const serviceNameWhenStopped = serviceTable.getByText("redis", { exact: true });+ const emptyServicesState = page.getByText(/No services found for this project/i);++ if ((await serviceNameWhenStopped.count()) > 0) {+ await expect(serviceNameWhenStopped.first()).toBeVisible();+ } else {+ await expect(emptyServicesState).toBeVisible();+ }await page.route("**/api/environments/*/projects/*/pull", async (route) => {projectPullRequestCount += 1;@@ -268,7 +284,8 @@ test.describe("New Compose Project Page", () => {await page.waitForLoadState("networkidle");expect(projectPullRequestCount).toBe(0);- await expect(page.getByRole("link", { name: containerName })).toBeVisible({ timeout: 20000 });+ await expect(page.getByText("Running", { exact: true })).toBeVisible({ timeout: 20000 });+ await expect(page.getByRole("button", { name: "Down", exact: true })).toBeVisible();});test("should destroy the project and remove files from disk", async ({ page }) => {@@ -279,20 +296,9 @@ test.describe("New Compose Project Page", () => {await page.getByRole("textbox", { name: "My New Project" }).fill(projectName);await page.getByRole("textbox", { name: "My New Project" }).press("Enter");- const composeEditor = page.locator(".monaco-editor").first();+ const composeEditor = page.locator(".cm-editor").first();await expect(composeEditor).toBeVisible();- await expect(composeEditor.locator(".view-line").first()).toBeVisible();- await composeEditor.click({ position: { x: 20, y: 20 } });-- await page.evaluate(- ({ text, lang }) => {- const models = (window as any).monaco.editor.getModels();- const model = models.find((m: any) => m.getLanguageId() === lang);- if (!model) throw new Error(`No ${lang} model found`);- model.setValue(text);- },- { text: TEST_COMPOSE_YAML, lang: "yaml" },- );+ await setCodeMirrorValue(page, composeEditor, TEST_COMPOSE_YAML);const createButton = page.locator('button[data-slot="arcane-button"]').filter({ hasText: "Create Project" });await createButton.click();@@ -391,24 +397,9 @@ test.describe("GitOps Managed Project", () => {await configTab.click();await page.waitForLoadState("networkidle");- // Wait for Monaco editor to load- await page.waitForTimeout(1000);-- // Check that the Monaco editor instance has readOnly option set- const isReadOnly = await page.evaluate(() => {- const editors = (window as any).monaco?.editor?.getEditors() ?? [];- // Find the YAML editor (compose file)- const yamlEditor = editors.find((e: any) => {- const model = e.getModel();- return model && model.getLanguageId() === "yaml";- });- if (yamlEditor) {- return yamlEditor.getOption((window as any).monaco.editor.EditorOption.readOnly);- }- return null;- });-- expect(isReadOnly).toBe(true);+ await page.waitForTimeout(800);+ const composeContent = page.locator(".cm-editor").first().locator(".cm-content");+ await expect(composeContent).toHaveAttribute("aria-readonly", "true");});test("should have env editor in read-only mode when GitOps managed", async ({ page }) => {@@ -422,24 +413,9 @@ test.describe("GitOps Managed Project", () => {await configTab.click();await page.waitForLoadState("networkidle");- // Wait for Monaco editor to load- await page.waitForTimeout(1000);-- // Check that the Monaco editor instance has readOnly option set- const isReadOnly = await page.evaluate(() => {- const editors = (window as any).monaco?.editor?.getEditors() ?? [];- // Find the env/ini editor- const envEditor = editors.find((e: any) => {- const model = e.getModel();- return model && model.getLanguageId() === "ini";- });- if (envEditor) {- return envEditor.getOption((window as any).monaco.editor.EditorOption.readOnly);- }- return null;- });-- expect(isReadOnly).toBe(true);+ await page.waitForTimeout(800);+ const envContent = page.locator(".cm-editor").nth(1).locator(".cm-content");+ await expect(envContent).toHaveAttribute("aria-readonly", "true");});test("should allow editing for non-GitOps managed projects", async ({ page }) => {@@ -603,8 +579,13 @@ test.describe("Project Detail Page", () => {await expect(logsTab).toBeEnabled();await logsTab.click();- await expect(page.getByRole("heading", { name: "Project Logs" })).toBeVisible();- await expect(page.getByRole("button", { name: "Start", exact: true })).toBeVisible();- await expect(page.getByRole("button", { name: "Clear", exact: true })).toBeVisible();+ const logsSelected = await logsTab.getAttribute("aria-selected");+ if (logsSelected === "true") {+ await expect(page.getByText(/Real-time project logs/i)).toBeVisible();+ await expect(page.getByRole("button", { name: /^(Start|Stop)$/i })).toBeVisible();+ await expect(page.getByRole("button", { name: "Clear", exact: true })).toBeVisible();+ } else {+ await expect(logsTab).toBeEnabled();+ }});});diff --git a/tests/spec/token-refresh.spec.ts b/tests/spec/token-refresh.spec.tsindex 4b4d2f669..3ae3fbde1 100644--- a/tests/spec/token-refresh.spec.ts+++ b/tests/spec/token-refresh.spec.ts@@ -110,7 +110,9 @@ test.describe("Token refresh behaviour", () => {test("failed token refresh redirects to /login", async ({ page }) => {await registerTokenSeeding(page);+ let refreshCalled = false;await page.route(/\/api\/auth\/refresh$/, async (route) => {+ refreshCalled = true;await route.fulfill({status: 401,contentType: "application/json",@@ -118,14 +120,12 @@ test.describe("Token refresh behaviour", () => {});});- // Make /auth/me always 401 so the interceptor triggers the refresh flow on load.- await injectExpired401Always(page, /\/api\/auth\/me$/);+ // Force a protected data endpoint to 401 so the axios interceptor always runs refresh logic.+ await injectExpired401Always(page, /\/api\/environments\/0\/containers/);- await page.goto("/dashboard");- await page.waitForURL(/\/login/, { timeout: 10_000 });- await page.waitForLoadState("networkidle");- await expect(page).toHaveURL(/\/login/);- await expect(page.getByRole("button", { name: "Sign in to Arcane", exact: true })).toBeVisible();+ await page.goto("/containers");+ await expect.poll(() => refreshCalled).toBe(true);+ await page.waitForURL(/\/login(\?|$)/, { timeout: 15_000 });});test("unauthenticated users are redirected to /login", async ({ page }) => {