Implement Knowledge City platform, organizer and DAV integration

Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming.

Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
This commit is contained in:
Anya Tokugawa committed 2026-09-27 14:44:43 +09:00
1 parent 288e6e94ac
commit c1175d389f
699 files changed
+110197 -4117

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
@font-face { font-family: PagesWikiHack; src: url('./HackNerdFont-Regular.ttf') format('truetype'); font-weight:400; font-style:normal; font-display:block; }
:root { color-scheme: dark; font-family: PagesWikiHack, ui-monospace, monospace; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #282c34; }
body { display: block; }
main { position: relative; width: 100%; height: 100%; }
#vim-canvas { display: block; width: 100%; height: 100%; }
#vim-input { position: fixed; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#error { position: fixed; inset: 1rem 1rem auto; z-index: 2; padding: 1rem; white-space: pre-wrap; color: #ffd7d7; background: #721c24; border-radius: 6px; }
+110
View File
@@ -0,0 +1,110 @@
import {VimWasm, checkBrowserCompatibility} from "./vendor/vimwasm.js"
const errorBox = document.getElementById("error")
const fail = error => {
errorBox.hidden = false
errorBox.textContent = error instanceof Error ? error.message : String(error)
}
const compatibilityError = checkBrowserCompatibility()
if (compatibilityError || !crossOriginIsolated) {
fail(compatibilityError || "Cross-origin isolation is not active. Check COOP/COEP headers.")
} else {
try {
const response = await fetch("./api/session", {cache: "no-store", credentials: "same-origin"})
if (!response.ok) throw new Error(`Workspace request failed: HTTP ${response.status}`)
const workspace = await response.json()
const files = {}
const directories = new Set(["/work"])
for (const file of workspace.files || []) {
const path = `/work/${file.path}`
files[path] = file.content
const parts = path.split("/").slice(1, -1)
let directory = ""
for (const part of parts) {
directory += `/${part}`
directories.add(directory)
}
}
const vimrcResponse = await fetch("./vimrc", {cache: "no-store"})
if (!vimrcResponse.ok) throw new Error(`vimrc request failed: HTTP ${vimrcResponse.status}`)
// The pinned runtime creates files with wx+ and silently skips the
// bundled /.vim/vimrc. Use a new path and an explicit -u argument.
files["/pageswiki.vimrc"] = await vimrcResponse.text()
// Font metrics must be final before Vim sizes its canvas/cell grid.
await document.fonts.load('16px PagesWikiHack')
const pluginResponse = await fetch('./pageswiki.vim', {cache: 'no-store'})
if (!pluginResponse.ok) throw new Error(`Plugin request failed: HTTP ${pluginResponse.status}`)
files['/.vim/plugin/pageswiki.vim'] = await pluginResponse.text()
directories.add('/.vim')
directories.add('/.vim/plugin')
const safeMode = new URLSearchParams(location.search).get('safe') === '1'
const settings = safeMode ? {} : (workspace.vim_settings || {})
const fontSize = Number.isInteger(settings.font_size) && settings.font_size >= 10 && settings.font_size <= 32 ? settings.font_size : 16
let userConfig = `\nset guifont=PagesWikiHack:h${fontSize}\n`
if (settings.enabled) {
if (settings.colorscheme) {
directories.add('/pageswiki-config')
directories.add('/pageswiki-config/colors')
files['/pageswiki-config/colors/pageswiki_custom.vim'] = settings.colorscheme
if (/^[A-Za-z0-9_-]+\.vim$/.test(settings.color_name || '')) {
files[`/pageswiki-config/colors/${settings.color_name}`] = settings.colorscheme
}
userConfig += 'set runtimepath^=/pageswiki-config\n'
}
if (settings.vimrc) {
files['/pageswiki-user.vimrc'] = settings.vimrc
userConfig += 'source /pageswiki-user.vimrc\n'
}
if (settings.colorscheme) userConfig += 'colorscheme pageswiki_custom\n'
}
files['/pageswiki.vimrc'] += userConfig
const vim = new VimWasm({
canvas: document.getElementById("vim-canvas"),
input: document.getElementById("vim-input"),
workerScriptPath: "./vendor/vim.js"
})
vim.onVimInit = () => {
vim.focus()
}
vim.onVimExit = () => {
window.close()
document.body.textContent = "Vim exited. You may close this tab."
}
vim.onTitleUpdate = title => { document.title = `${title} · vim.wasm` }
vim.onError = fail
vim.onFileExport = async (fullpath, contents) => {
try {
const bytes = new Uint8Array(contents)
let binary = ""
for (let offset = 0; offset < bytes.length; offset += 0x8000) {
binary += String.fromCharCode(...bytes.subarray(offset, offset + 0x8000))
}
const save = await fetch("./api/save", {
method: "PUT",
credentials: "same-origin",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({path: fullpath, content_base64: btoa(binary)})
})
if (!save.ok) throw new Error((await save.text()).trim() || `Save failed: HTTP ${save.status}`)
} catch (error) {
fail(error)
await vim.showError(String(error))
}
}
const paths = (workspace.files || []).map(file => `/work/${file.path}`).sort()
const initial = `/work/${workspace.initial}`
const cmdArgs = ['-u', '/pageswiki.vimrc', initial, ...paths.filter(path => path !== initial)]
vim.start({
dirs: Array.from(directories).sort((a, b) => a.split("/").length - b.split("/").length),
files,
clipboard: Boolean(navigator.clipboard),
cmdArgs
})
} catch (error) {
fail(error)
}
}
+17
View File
@@ -0,0 +1,17 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Pages Wiki · vim.wasm</title>
<link rel="stylesheet" href="app.css">
</head>
<body>
<main>
<canvas id="vim-canvas"></canvas>
<input id="vim-input" autocomplete="off" autofocus aria-label="Vim keyboard input">
</main>
<div id="error" role="alert" hidden></div>
<script type="module" src="app.js"></script>
</body>
</html>
+12
View File
@@ -0,0 +1,12 @@
" Small, bundled, pure Vimscript workspace navigation. No shell or network.
if exists('g:loaded_pageswiki') | finish | endif
let g:loaded_pageswiki = 1
set path=/work/**
set wildignore+=*.swp,*.bak
command! Files call feedkeys(':find ', 'n')
nnoremap <silent> <leader>f :Files<CR>
nnoremap <leader>b :ls<CR>:buffer<Space>
nnoremap <silent> ]b :bnext<CR>
nnoremap <silent> [b :bprevious<CR>
nnoremap <silent> <leader>w :write<CR>
nnoremap <silent> <leader>/ :nohlsearch<CR>
+55
View File
@@ -0,0 +1,55 @@
set nocompatible
set runtimepath^=/.vim
set number
set guifont=PagesWikiHack:h16
set background=dark
set cursorline
set laststatus=2
set showcmd
set ruler
set scrolloff=4
set sidescrolloff=4
set noswapfile
set nobackup
set nowritebackup
set display+=lastline
set linebreak
set listchars=tab:»\ ,trail:·,extends:›,precedes:‹
let mapleader = " "
set hidden
set encoding=utf-8
set fileencoding=utf-8
set mouse=a
set backspace=indent,eol,start
set wildmenu
set wildmode=longest:full,full
set incsearch
set hlsearch
set ignorecase
set smartcase
set autoindent
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
syntax enable
filetype plugin indent on
highlight Normal guifg=#e6edf3 guibg=#1e222a
highlight LineNr guifg=#8994a6 guibg=#1e222a
highlight CursorLine guibg=#2b3240
highlight StatusLine guifg=#e6edf3 guibg=#35415a gui=NONE
" Close the hosted Vim session with :q even when the argument list contains
" more files. Unsaved buffers still require :q! explicitly.
cnoreabbrev <expr> q getcmdtype() ==# ':' && getcmdline() ==# 'q' ? 'qa' : 'q'
cnoreabbrev <expr> q! getcmdtype() ==# ':' && getcmdline() ==# 'q!' ? 'qa!' : 'q!'
" Pages Wiki writes each exported buffer as a new Revision.
augroup pageswiki
autocmd!
autocmd BufWritePost /work/* execute 'export ' . expand('%:p')
augroup END
" Pure Vimscript plugins are preloaded into /.vim/plugin by app.js.
" vim-plug installation and fzf's native executable do not work in MEMFS.
" Vendoring fzf.vim alone does not remove that native dependency.
+21
View File
@@ -0,0 +1,21 @@
{
"name": "pageswiki-vimwasm-adapter",
"version": "0.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "pageswiki-vimwasm-adapter",
"version": "0.1.0",
"dependencies": {
"vim-wasm": "0.0.13"
}
},
"node_modules/vim-wasm": {
"version": "0.0.13",
"resolved": "https://registry.npmjs.org/vim-wasm/-/vim-wasm-0.0.13.tgz",
"integrity": "sha512-2EkJ4OfMgvA/bURJeu43wqIQ4tpCJymst++Y4R/AKuQlnrvdI4hTpG2jf0yL5TrLt1ui12leLRghrwPOybyu8w==",
"license": "Vim"
}
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"name": "pageswiki-vimwasm-adapter",
"private": true,
"version": "0.1.0",
"dependencies": {
"vim-wasm": "0.0.13"
}
}