T.R.U.R.L. — TRURL (is a) Repository Utility for Restructuring Literature
TRURL is a Git-native writing environment for longform narrative work. The repository is the writing studio: manuscripts live as Markdown files, canon is recorded in dedicated story-bible documents, and revision history is preserved through branching and commits.
The goal is not to replace authorship with automation. The goal is to create a structured system where human intent leads, AI assists, and continuity remains trackable at every step.
- Markdown is truth: narrative, canon, notes, and revision context are plain text.
- Git is memory: commits and branches are the authoritative revision engine.
- AI is assistant: AI proposes structured changes through diffs, never opaque overwrite.
- Structure over formatting: semantic organization comes before presentation.
- Refactoring over rewriting: improve manuscripts with traceable transformations.
- Canon over improvisation: continuity and lore integrity are first-class constraints.
docs/spec/MANUSCRIPT_CONVENTIONS.mddocs/spec/STORY_BIBLE_CONVENTIONS.mddocs/spec/FRONTMATTER.mddocs/spec/WORKFLOW.mddocs/spec/SAMPLE_CORPUS.mddocs/architecture/oser-integration.md— planned TRURL ↔ OSER rendering/export architecture boundarydocs/roadmap/trurl-backlog.md— current backlog, priorities, open decisions, and next implementation slices
Run from repository root:
python3 scripts/validate_frontmatter.pypython3 scripts/check_crossrefs.pypython3 scripts/check_manuscript_order.py
Install the app dependencies from the repository root:
npm install --prefix app/backend
npm install --prefix app/frontendStart the backend and frontend together:
npm run trurlThis starts the local backend on http://localhost:4177 and the Vite frontend on http://localhost:5173 unless Vite selects the next available port. The frontend proxies /api requests to the backend.
The same launcher is also available as:
npm run devIndividual development commands are available when needed:
npm run dev:backend
npm run dev:frontend
npm run build
npm run checkFor command-style local usage without global packaging, add a temporary shell alias with your local repository path:
alias trurl='cd /path/to/TRURL && npm run trurl'A real global trurl binary is intentionally deferred to a future packaging step.
Self-hosted VPS/private-server deployment is planned as a secure, private-by-default profile. The first design drafts live in docs/deployment/self-hosting.md and docs/deployment/security.md; Docker, authentication, reverse proxy, and deployment files are intentionally deferred. Publicly exposed instances will require HTTPS plus a private network, identity gate, or equivalent access control.
TRURL can read optional project metadata from .trurl/project.json. The current repository includes a minimal manifest:
{
"schema": "trurl-project/v0",
"title": "TRURL Demo Project",
"defaultDocument": "main",
"documents": [
{
"id": "main",
"title": "Main Manuscript",
"manuscriptPath": "manuscript",
"storyBiblePath": "story-bible",
"notesPath": "notes",
"revisionPath": "revision",
"renderPresets": ["editorial-default"]
}
]
}The formal schema lives at schema/trurl-project.schema.json. It keeps required v0 fields explicit while allowing additional properties for forward compatibility as the manifest evolves.
Projects without this file still load with the existing one-repository/one-project defaults. When a manifest is missing or structurally invalid, TRURL falls back to the safe default project and includes simple project.warnings and project.errors arrays in the workspace payload. Recoverable issues, such as a defaultDocument that does not match any document id, keep the manifest loaded and derive project.currentDocument from the first document. The manifest is a backwards-compatible metadata foundation only; document switching UI, alternate folder loading, multi-project switching UI, databases, and cloud sync are deferred.
Run the lightweight local test suite from the repository root:
npm run testRun tests, backend syntax checks, launcher syntax check, and the frontend production build together:
npm run checkThe test suite uses Node's built-in test runner and avoids browser automation for now.
docs/— project-level documentation, specifications, and architecturedocs/spec/— formal project specification documentsdocs/architecture/— system architecture and component design
manuscript/— chapter/prologue Markdown source filesstory-bible/— canonical world-state referencesstory-bible/characters/— character dossiersstory-bible/locations/— location recordsstory-bible/timeline/— timeline continuity records
notes/— exploratory writing notes, research fragments, ideationrevision/— revision plans, edit logs, and branch-specific change notesai/— AI operating policies, prompts, and guardrail documentsapp/— future web application boundaryapp/frontend/— editor UI and client interfaces (future)app/backend/— API bridge and orchestration services (future)
schema/— JSON schemas for document metadata and canon structuresscripts/— lightweight repository automation tools
- Bootstrap repository architecture
- Define manuscript and canon document conventions
- Establish schema draft and AI rule constraints
- Introduce scriptable AI-assisted refactor workflows
- Enforce branch-only AI operations with diff outputs
- Add canon/frontmatter validation checks
- Build minimal frontend for manuscript and bible browsing/editing
- Add backend bridge for safe Git operations
- Preserve full offline usability through repository-first design