From 2781b29f5a62a37dd8980b5fa2714a06591b35b0 Mon Sep 17 00:00:00 2001 From: Nils-Johan Gynther Date: Thu, 23 Apr 2026 21:50:52 +0200 Subject: [PATCH] chore: remove archived AI features and microservice-todo documentation --- ...copilot_move_recipe-document-converter.txt | 1 - .../microservice-ai/AI-FUNKTIONER.md | 0 .../microservice-todo.md | 0 .../recipe-document-converter/package.json | 13 -- .../recipe-document-converter/src/index.ts | 2 - .../recipe-document-converter/src/parser.ts | 146 ------------------ .../recipe-document-converter/tsconfig.json | 13 -- 7 files changed, 175 deletions(-) delete mode 100644 _archive/.copilot_move_recipe-document-converter.txt rename AI-FUNKTIONER.md => _archive/microservice-ai/AI-FUNKTIONER.md (100%) rename _archive/{ => microservice-todo}/microservice-todo.md (100%) delete mode 100644 _archive/recipe-document-converter/package.json delete mode 100644 _archive/recipe-document-converter/src/index.ts delete mode 100644 _archive/recipe-document-converter/src/parser.ts delete mode 100644 _archive/recipe-document-converter/tsconfig.json diff --git a/_archive/.copilot_move_recipe-document-converter.txt b/_archive/.copilot_move_recipe-document-converter.txt deleted file mode 100644 index 40a9e481..00000000 --- a/_archive/.copilot_move_recipe-document-converter.txt +++ /dev/null @@ -1 +0,0 @@ -Flytta manuellt mappen recipe-document-converter till _archive/recipe-document-converter. Verktyget kan inte flytta kataloger automatiskt i denna miljö. \ No newline at end of file diff --git a/AI-FUNKTIONER.md b/_archive/microservice-ai/AI-FUNKTIONER.md similarity index 100% rename from AI-FUNKTIONER.md rename to _archive/microservice-ai/AI-FUNKTIONER.md diff --git a/_archive/microservice-todo.md b/_archive/microservice-todo/microservice-todo.md similarity index 100% rename from _archive/microservice-todo.md rename to _archive/microservice-todo/microservice-todo.md diff --git a/_archive/recipe-document-converter/package.json b/_archive/recipe-document-converter/package.json deleted file mode 100644 index 242f1357..00000000 --- a/_archive/recipe-document-converter/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "recipe-document-converter", - "version": "1.0.0", - "private": true, - "main": "dist/index.js", - "types": "dist/index.d.ts", - "scripts": { - "build": "tsc" - }, - "devDependencies": { - "typescript": "^5.4.5" - } -} diff --git a/_archive/recipe-document-converter/src/index.ts b/_archive/recipe-document-converter/src/index.ts deleted file mode 100644 index e3c710a4..00000000 --- a/_archive/recipe-document-converter/src/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { parseRecipeMarkdown } from './parser'; -export type { ParsedIngredient, ParsedRecipe } from './parser'; diff --git a/_archive/recipe-document-converter/src/parser.ts b/_archive/recipe-document-converter/src/parser.ts deleted file mode 100644 index dde9fe29..00000000 --- a/_archive/recipe-document-converter/src/parser.ts +++ /dev/null @@ -1,146 +0,0 @@ -export interface ParsedIngredient { - rawName: string; - quantity: number; - unit: string; - note: string | null; -} - -export interface ParsedRecipe { - name: string; - description: string; - instructions: string; - ingredients: ParsedIngredient[]; -} - -/** - * Parsar ett recept i Markdown-format och extraherar namn, beskrivning, - * instruktioner och ingredienser. - * - * Förväntat format: - * # Receptnamn - * Beskrivning (valfritt stycke efter titeln) - * - * ## Ingredienser - * - 400 g kycklingfilé - * - 2 dl grädde (eller crème fraiche) - * - * ## Instruktioner - * 1. Stek kycklingen … - */ -export function parseRecipeMarkdown(markdown: string): ParsedRecipe { - const lines = markdown.split('\n'); - - let name = ''; - let description = ''; - let instructions = ''; - const ingredients: ParsedIngredient[] = []; - - let currentSection: 'none' | 'description' | 'ingredients' | 'instructions' = 'none'; - const descriptionLines: string[] = []; - const instructionLines: string[] = []; - - for (const line of lines) { - const trimmed = line.trim(); - - // H1 — receptnamn - if (/^#\s+/.test(trimmed) && !trimmed.startsWith('##')) { - name = trimmed.replace(/^#\s+/, '').trim(); - currentSection = 'description'; - continue; - } - - // H2 — sektionsrubriker - if (/^##\s+/.test(trimmed)) { - const heading = trimmed.replace(/^##\s+/, '').trim().toLowerCase(); - if (/ingrediens/.test(heading)) { - currentSection = 'ingredients'; - } else if (/instruktion|tillagning|gör så här|steg/.test(heading)) { - currentSection = 'instructions'; - } else { - currentSection = 'none'; - } - continue; - } - - // Samla rader beroende på sektion - switch (currentSection) { - case 'description': - if (trimmed.length > 0) { - descriptionLines.push(trimmed); - } - break; - - case 'ingredients': - if (/^[-*]\s+/.test(trimmed)) { - const ingredientText = trimmed.replace(/^[-*]\s+/, ''); - ingredients.push(parseIngredientLine(ingredientText)); - } - break; - - case 'instructions': - if (trimmed.length > 0) { - instructionLines.push(trimmed); - } - break; - } - } - - description = descriptionLines.join('\n'); - instructions = instructionLines.join('\n'); - - return { name, description, instructions, ingredients }; -} - -/** - * Parsar en ingrediensrad, t.ex.: - * "400 g kycklingfilé" - * "2 dl grädde (eller crème fraiche)" - * "1 kruka basilika" - * "salt" - */ -function parseIngredientLine(text: string): ParsedIngredient { - const trimmed = text.trim(); - - // Extrahera eventuell parentes-not i slutet - let note: string | null = null; - let main = trimmed; - const parenMatch = trimmed.match(/\(([^)]+)\)\s*$/); - if (parenMatch) { - note = parenMatch[1].trim(); - main = trimmed.slice(0, parenMatch.index).trim(); - } - - // Försök matcha "kvantitet enhet namn" — t.ex. "400 g kycklingfilé" eller "2.5 dl grädde" - const fullMatch = main.match(/^(\d+(?:[.,]\d+)?)\s+(\S+)\s+(.+)$/); - if (fullMatch) { - return { - quantity: parseNumber(fullMatch[1]), - unit: fullMatch[2], - rawName: fullMatch[3].trim(), - note, - }; - } - - // Försök matcha "kvantitet namn" utan enhet — t.ex. "3 ägg" - const noUnitMatch = main.match(/^(\d+(?:[.,]\d+)?)\s+(.+)$/); - if (noUnitMatch) { - return { - quantity: parseNumber(noUnitMatch[1]), - unit: 'st', - rawName: noUnitMatch[2].trim(), - note, - }; - } - - // Bara ett namn, ingen kvantitet — t.ex. "salt" - return { - quantity: 0, - unit: '', - rawName: main, - note, - }; -} - -function parseNumber(s: string): number { - return parseFloat(s.replace(',', '.')); -} diff --git a/_archive/recipe-document-converter/tsconfig.json b/_archive/recipe-document-converter/tsconfig.json deleted file mode 100644 index 522d4031..00000000 --- a/_archive/recipe-document-converter/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2021", - "module": "commonjs", - "lib": ["ES2021"], - "declaration": true, - "outDir": "./dist", - "rootDir": "./src", - "strict": true, - "skipLibCheck": true - }, - "include": ["src"] -}