#!/usr/bin/env python3 """Create Toora pages in Wiki.js via GraphQL API.""" import json, sys JWT = sys.argv[1] if len(sys.argv) > 1 else "" pages = [ { "title": "Toora Home", "path": "home", "tags": ["home", "toora"], "desc": "Household knowledge base home", "content": ( '
' '
Household Knowledge Base
' '

TOORA

' '

Everything about our home โ€” how things work, what we use, and how to fix it.

' '
' '
' 'Home Notes' '
' '
๐Ÿ“บ Entertainment
TV, streaming, music, and internet services for the home.
' '
๐Ÿ’ก Lights
Lighting controls, switches, and smart bulbs.
' '
๐Ÿณ Kitchen
Composting system, appliances, and kitchen setup.
' '
๐ŸŒฑ Garden
BBQ, fires, and outdoor living.
' '
๐Ÿพ Pets
Dogs and fish โ€” care routines and setups.
' '
๐Ÿงบ Laundry
Washer and drier โ€” usage and maintenance.
' '
' ) }, { "title": "Entertainment", "path": "entertainment", "tags": ["entertainment", "tv", "music", "internet"], "desc": "TV, streaming, music and internet", "content": ( '
' '
Section
' '

ENTERTAINMENT

' '

TV and streaming setup, music systems, and home internet.

' '
' '
' 'Topics' '
' '
๐Ÿ“บ TV & Streaming
Television setup, streaming services, subscriptions, and devices.
' '
๐ŸŽต Music
Music systems, speakers, playlists, and audio setup.
' '
๐ŸŒ Internet
Home internet, WiFi, router, and network services.
' '
' ) }, { "title": "Lights", "path": "lights", "tags": ["lights", "switches"], "desc": "Lighting controls and switches", "content": ( '
' '
Section
' '

LIGHTS

' '

Lighting around the home โ€” controls, switches, and smart options.

' '
' '
' 'Topics' '
' '
๐ŸŽ› Controlling
Smart controls, dimmers, timers, and automation.
' '
๐Ÿ”˜ Switches
Wall switches, smart switches, and wiring notes.
' '
' ) }, { "title": "Kitchen", "path": "kitchen", "tags": ["kitchen", "compost", "appliances"], "desc": "Composting and kitchen appliances", "content": ( '
' '
Section
' '

KITCHEN

' '

Compost system and kitchen appliances.

' '
' '
' 'Topics' '
' '
๐ŸŒฟ Compost
Composting system, what goes in, and maintenance.
' '
๐Ÿ”Œ Appliances
Kitchen appliances, usage, and care.
' '
' ) }, { "title": "Garden", "path": "garden", "tags": ["garden", "bbq", "fires"], "desc": "Outdoor living โ€” BBQ and fires", "content": ( '
' '
Section
' '

GARDEN

' '

Outdoor living โ€” BBQ, fires, and garden setup.

' '
' '
' 'Topics' '
' '
๐Ÿ– BBQ
BBQ setup, care, and usage.
' '
๐Ÿ”ฅ Fires
Fire pits and outdoor heating.
' '
' ) }, { "title": "Pets", "path": "pets", "tags": ["pets", "dogs", "fish"], "desc": "Pet care โ€” dogs and fish", "content": ( '
' '
Section
' '

PETS

' '

Our pets and how we care for them.

' '
' '
' 'Topics' '
' '
๐Ÿ• Dogs
Dog care, feeding, and routines.
' '
๐ŸŸ Fish
Fish tank setup, feeding, and maintenance.
' '
' ) }, { "title": "Laundry", "path": "laundry", "tags": ["laundry", "washer", "drier"], "desc": "Washer and drier notes", "content": ( '
' '
Section
' '

LAUNDRY

' '

Laundry appliances โ€” washer and drier.

' '
' '
' 'Topics' '
' '
๐ŸŒ€ Washer
Washing machine usage, programs, and maintenance.
' '
๐ŸŒฌ Drier
Drier usage, settings, and lint care.
' '
' ) } ] mutations = [] for idx, p in enumerate(pages): content_escaped = p['content'].replace('\\', '\\\\').replace('"', '\\"').replace('\n', '\\n') tag_str = json.dumps(p['tags']) mutation = f''' p{idx}: pages {{ create( title: "{p['title']}" path: "{p['path']}" content: "{content_escaped}" editor: "wysiwyg" isPublished: true isPrivate: false locale: "en" tags: {tag_str} description: "{p['desc']}" ) {{ page {{ id path title }} responseResult {{ succeeded message }} }} }}''' mutations.append(mutation) query = 'mutation {\n' + '\n'.join(mutations) + '\n}' payload = {"query": query} print(json.dumps(payload)) PYEOF