Pablan, as it stands

Self-hosted knowledge management for SMEs: a split-screen Markdown editor
whose sections an LLM refines while you write, and RAG question answering
over the documents that result. FastAPI + Postgres/pgvector on the back,
SvelteKit on the front, everything OpenAI-compatible and self-hostable.

Squashed into a single commit; the development history stays local.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CA43ZJda8Rbp2hKXNy8f6b
This commit is contained in:
ProfessorNova
2026-09-04 08:36:17 +02:00
co-authored by Claude Opus 5
commit 97dbff309c
346 changed files with 43430 additions and 0 deletions
@@ -0,0 +1,87 @@
"""Review requests: an open question about a document, not a status
Publishing becomes the author's own action, so `pending_approval` disappears
and the delegated-approver column with it. What replaces both is a request
that can sit on a draft OR on a published document: "please check this", with
the question attached.
Revision ID: b8e14d7c05a3
Revises: f3c8d5a92b47
"""
from collections.abc import Sequence
from typing import Union
import sqlalchemy as sa
from alembic import op
revision: str = "b8e14d7c05a3"
down_revision: Union[str, Sequence[str], None] = "f3c8d5a92b47"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
"review_requests",
sa.Column("id", sa.Uuid(), nullable=False),
sa.Column("document_id", sa.Uuid(), nullable=False),
sa.Column("requester_id", sa.Uuid(), nullable=True),
sa.Column("reviewer_id", sa.Uuid(), nullable=True),
sa.Column("question", sa.Text(), nullable=True),
sa.Column("resolved_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("resolved_by_id", sa.Uuid(), nullable=True),
sa.Column(
"created_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.Column(
"updated_at",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=False,
),
sa.ForeignKeyConstraint(["document_id"], ["documents.id"], ondelete="CASCADE"),
sa.ForeignKeyConstraint(["requester_id"], ["users.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(["reviewer_id"], ["users.id"], ondelete="SET NULL"),
sa.ForeignKeyConstraint(["resolved_by_id"], ["users.id"], ondelete="SET NULL"),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
"ix_review_requests_document_id", "review_requests", ["document_id"]
)
op.create_index(
"ix_review_requests_reviewer_id", "review_requests", ["reviewer_id"]
)
# A document waiting for approval is simply an unpublished draft now; the
# ask that used to be implied by the status is an explicit request.
op.execute(
"UPDATE documents SET status = 'draft' WHERE status = 'pending_approval'"
)
op.drop_column("documents", "reviewer_id")
# The audit trail keeps its shape: approving WAS publishing, and
# submitting has no counterpart in a world where the author publishes.
op.execute(
"UPDATE document_events SET action = 'published' WHERE action = 'approved'"
)
op.execute("DELETE FROM document_events WHERE action = 'submitted'")
def downgrade() -> None:
op.add_column("documents", sa.Column("reviewer_id", sa.Uuid(), nullable=True))
op.create_foreign_key(
"documents_reviewer_id_fkey",
"documents",
"users",
["reviewer_id"],
["id"],
ondelete="SET NULL",
)
op.drop_index("ix_review_requests_reviewer_id", table_name="review_requests")
op.drop_index("ix_review_requests_document_id", table_name="review_requests")
op.drop_table("review_requests")