-- 022_cli_tool_seeds.sql
-- Oppgave 24.4: Seed cli_tool-noder med aliases (norske verb) og args_hints
-- (menneskelige argumenter → CLI-flagg). Brukes av script_compiler for å
-- kompilere menneskelig scriptspråk til CLI-kall.
-- Ref: docs/retninger/unix_filosofi.md, docs/concepts/orkestrering.md

BEGIN;

-- =============================================================================
-- 1. synops-transcribe — Whisper-transkribering av lydfiler
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000001',
    'cli_tool',
    'synops-transcribe',
    'discoverable',
    '{
        "binary": "synops-transcribe",
        "aliases": ["transkriber", "transkribering", "transkripsjoner"],
        "description": "Whisper-transkribering av lydfil",
        "args_hints": {
            "lydfilen": "--cas-hash {event.cas_hash}",
            "stor modell": "--model large",
            "medium modell": "--model medium",
            "liten modell": "--model small",
            "på engelsk": "--language en",
            "på norsk": "--language no",
            "lagre resultat": "--write",
            "for noden": "--node-id {event.node_id}"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 2. synops-audio — FFmpeg lydprosessering (EDL, normalisering, EQ)
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000002',
    'cli_tool',
    'synops-audio',
    'discoverable',
    '{
        "binary": "synops-audio",
        "aliases": ["prosesser lyd", "lydprosessering", "mikse", "miksing"],
        "description": "FFmpeg lydprosessering med EDL (klipp, normalisering, EQ)",
        "args_hints": {
            "lydfilen": "--cas-hash {event.cas_hash}",
            "klippelisten": "--edl {event.edl}",
            "som wav": "--output-format wav",
            "som mp3": "--output-format mp3",
            "som flac": "--output-format flac",
            "lagre resultat": "--write",
            "for noden": "--node-id {event.node_id}"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 3. synops-render — Tera HTML-rendering til CAS
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000003',
    'cli_tool',
    'synops-render',
    'discoverable',
    '{
        "binary": "synops-render",
        "aliases": ["render", "rendering", "generer html", "publiser"],
        "description": "Tera HTML-rendering av node til CAS",
        "args_hints": {
            "noden": "--node-id {event.node_id}",
            "med tema": "--theme {arg}",
            "i samlingen": "--collection-id {event.collection_id}",
            "som artikkel": "--render-type article",
            "som indeks": "--render-type index",
            "som om-side": "--render-type about",
            "lagre resultat": "--write"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 4. synops-rss — RSS/Atom-feed generering
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000004',
    'cli_tool',
    'synops-rss',
    'discoverable',
    '{
        "binary": "synops-rss",
        "aliases": ["generer feed", "rss", "rss-feed", "atom-feed"],
        "description": "RSS/Atom-feed generering for samlinger",
        "args_hints": {
            "for samlingen": "--collection-id {event.collection_id}",
            "med slug": "--slug {arg}",
            "som atom": "--format atom",
            "som rss": "--format rss",
            "maks antall": "--max-items {arg}"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 5. synops-tts — Tekst-til-tale via ElevenLabs
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000005',
    'cli_tool',
    'synops-tts',
    'discoverable',
    '{
        "binary": "synops-tts",
        "aliases": ["les opp", "tekst til tale", "tts", "generer tale"],
        "description": "Tekst-til-tale via ElevenLabs",
        "args_hints": {
            "teksten": "--text {event.content}",
            "med stemme": "--voice {arg}",
            "på engelsk": "--language en",
            "på norsk": "--language no",
            "fra noden": "--source-node-id {event.node_id}",
            "lagre resultat": "--write"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 6. synops-summarize — AI-oppsummering via LiteLLM
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000006',
    'cli_tool',
    'synops-summarize',
    'discoverable',
    '{
        "binary": "synops-summarize",
        "aliases": ["oppsummer", "oppsummering", "sammendrag"],
        "description": "AI-oppsummering av kommunikasjonsnode via LiteLLM",
        "args_hints": {
            "samtalen": "--communication-id {event.communication_id}",
            "lagre resultat": "--write"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 7. synops-suggest-edges — AI-foreslåtte edges (emner/omtaler)
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000007',
    'cli_tool',
    'synops-suggest-edges',
    'discoverable',
    '{
        "binary": "synops-suggest-edges",
        "aliases": ["foreslå koblinger", "foreslå edges", "koble", "tagging"],
        "description": "AI-foreslåtte edges (emner, omtaler) for en node",
        "args_hints": {
            "noden": "--node-id {event.node_id}",
            "lagre resultat": "--write"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 8. synops-respond — Claude chat-svar
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000008',
    'cli_tool',
    'synops-respond',
    'discoverable',
    '{
        "binary": "synops-respond",
        "aliases": ["svar", "besvar", "claude-svar"],
        "description": "Claude chat-svar i kommunikasjonsnode",
        "args_hints": {
            "samtalen": "--communication-id {event.communication_id}",
            "meldingen": "--message-id {event.message_id}",
            "agent": "--agent-node-id {event.agent_node_id}",
            "avsender": "--sender-node-id {event.sender_node_id}",
            "lagre resultat": "--write"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 9. synops-prune — CAS-opprydding (TTL + diskplass)
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000009',
    'cli_tool',
    'synops-prune',
    'discoverable',
    '{
        "binary": "synops-prune",
        "aliases": ["rydd", "opprydding", "slett gamle filer", "prune"],
        "description": "CAS-opprydding: sletter filer etter TTL og diskplass-nød",
        "args_hints": {
            "tørrkjøring": "--dry-run",
            "lagre resultat": "--write",
            "lyd-ttl dager": "--audio-ttl {arg}",
            "bilde-ttl dager": "--image-ttl {arg}",
            "video-ttl dager": "--video-ttl {arg}"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 10. synops-context — Hent samtalekontekst
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000010',
    'cli_tool',
    'synops-context',
    'discoverable',
    '{
        "binary": "synops-context",
        "aliases": ["hent kontekst", "samtalekontekst", "kontekst"],
        "description": "Hent samtalekontekst som markdown",
        "args_hints": {
            "samtalen": "--communication-id {event.communication_id}",
            "maks meldinger": "--max-messages {arg}"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 11. synops-search — Fulltekstsøk
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000011',
    'cli_tool',
    'synops-search',
    'discoverable',
    '{
        "binary": "synops-search",
        "aliases": ["søk", "finn", "fulltekstsøk"],
        "description": "Fulltekstsøk med norsk stemming",
        "args_hints": {
            "etter": "{arg}",
            "bare type": "--kind {arg}",
            "maks treff": "--limit {arg}"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 12. synops-tasks — Parse tasks.md
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000012',
    'cli_tool',
    'synops-tasks',
    'discoverable',
    '{
        "binary": "synops-tasks",
        "aliases": ["oppgaver", "vis oppgaver", "oppgavestatus"],
        "description": "Parse og vis oppgavestatus fra tasks.md",
        "args_hints": {
            "fase": "--phase {arg}",
            "bare ferdige": "--status done",
            "bare pågående": "--status in_progress",
            "bare ventende": "--status pending"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 13. synops-feature-status — Sjekk feature-status
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000013',
    'cli_tool',
    'synops-feature-status',
    'discoverable',
    '{
        "binary": "synops-feature-status",
        "aliases": ["feature-status", "sjekk feature", "funksjonsstatus"],
        "description": "Sjekk status for en feature basert på spec, oppgaver og commits",
        "args_hints": {
            "feature": "{arg}",
            "antall commits": "--commits {arg}"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

-- =============================================================================
-- 14. synops-node — Hent node med edges
-- =============================================================================
INSERT INTO nodes (id, node_kind, title, visibility, metadata, created_by)
VALUES (
    'f0000000-c100-4000-b000-000000000014',
    'cli_tool',
    'synops-node',
    'discoverable',
    '{
        "binary": "synops-node",
        "aliases": ["vis node", "hent node", "nodeinfo"],
        "description": "Hent og vis en node med edges",
        "args_hints": {
            "noden": "{event.node_id}",
            "med dybde": "--depth {arg}",
            "som json": "--format json",
            "som markdown": "--format md"
        }
    }'::jsonb,
    'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'
);

COMMIT;
