Skip to content

About

Its prompts all the way down

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

daftprompt

Overview

This is a text repository explorer built with Rust and akar (a GPU UI component library) on top of wgpu and glyphon. The application provides an infinite canvas interface for exploring text documents in a visual, card-based layout, with hybrid commit, code, and document search.

Features Implemented

✅ Infinite Canvas

  • Zoom in/out with mouse wheel (0.1x to 5x)
  • Pan with middle mouse button or Cmd/Ctrl + left click
  • Grid background with coordinate indicators
  • Zoom indicator in bottom-right corner

✅ Left Drawer

  • Folder icons with Unicode symbols
  • Hover effects and selection states
  • Expand/collapse animation
  • Document count display

✅ Document Cards

  • Git log cards (real data from the current repo) and search result cards
  • File type icons
  • Title, content preview, and metadata
  • Hover and selection states
  • Viewport culling for performance

✅ Global Search Box

  • Fixed at bottom center of screen
  • Cmd+K / Ctrl+K keyboard shortcut (unified search — all sources)
  • Real-time filtering across git log, code, and documents (hybrid FTS5 + vector KNN via the indexer)
  • Result count display
  • Three result containers on canvas (git log, codebase, documents)
  • Clear button

✅ Code Search Across Five Languages

  • All supported code-search languages are Git-tracked Rust (.rs), TypeScript (.ts), and JavaScript (.js), and all supported dialects are TSX (.tsx) and JSX (.jsx); they share one code index
  • The existing global search box searches all five languages through the same hybrid FTS5 + vector KNN index; no separate language mode is required
  • Tracked generated/vendor/minified files are filtered out centrally (node_modules/, vendor/, dist/, build/, .next/, coverage/, and *.min.js), so production paths stay language-neutral

✅ System Theme Support

  • Dark theme (default, via AKAR_THEME_DARK)
  • Theme-aware colors for all components

Running the Application

# From the daftprompt directory
cargo run

Document Provenance Graph

The separate graph CLI builds a provenance graph from documents you explicitly select, then answers questions with citations into the exact text snapshots used for that build. --source is an authority declaration: selected working-tree documents are treated as human-maintained sources, including untracked files. The selected set is complete for each successful build, so omit a previously selected source to deactivate it. Globs are expanded in sorted order. Code files are never treated as authoritative sources. The current graph extracts supported indexing, search, parser, path-exclusion, and work-item status relations; other PRD statements can yield no claims.

Configure Xiaomi MiMo V2.5 Pro before building or searching. The graph CLI loads .env from the current working directory when present; .env is Git-ignored. Put this line in .env:

XIAOMI_API_KEY="your-key"

Alternatively, run export XIAOMI_API_KEY="your-key" in your shell.

XIAOMI_API_KEY is required. The client and mimo-v2.5-pro model ID come from the GitHub llm-sdk dependency. The key is sent to Xiaomi and is not stored in the graph database or query logs.

Build the graph in the existing per-repository SQLite database, then ask questions:

cargo run --bin graph -- build --repo . \
  --source DEVELOP.md --source README.md --source AGENTS.md \
  --source 'epics/*.md'
cargo run --bin graph -- search --repo . "Which languages can code search find?"
cargo run --bin graph -- search --repo . "Can we search Python code?" --json

Build requires at least one --source; each value is a repository-relative path or quoted glob. The CLI rejects empty matches, unsupported or unreadable text files, and paths (including symlinks) outside the repository. Search requires a completed build and returns yes, no, or unknown, with citations formatted as path:start-end. --json returns outcome, answer, citations, claim_ids, and build_id. A negative answer requires explicit current exclusion evidence or a validated exhaustive supported-language list; missing or conflicting evidence produces unknown.

Each search writes a UTF-8 JSON record under <repo>/.daftprompt/graph-search/. Records include schema version, UTC time, repository path, build ID, question, outcome/error, exact printed response, cited source paths and ranges, and claim IDs. The directory must be Git-ignored in the selected repository. These files are local and may contain sensitive questions; they do not contain API keys, request headers, full prompts, or full source documents.

Controls

  • Zoom: Mouse wheel
  • Pan: Middle mouse button OR Cmd/Ctrl + left mouse button
  • Select Card: Left click on card
  • Select Folder: Left click on folder icon in drawer
  • Open Unified Search: Cmd+K (Mac) or Ctrl+K (Windows/Linux) — searches git log, code, and documents
  • Close Search: Escape key
  • Deselect All: Escape key (when search is closed)

Project Structure

daftprompt/
├── Cargo.toml                    # workspace root + main binary
├── src/
│   ├── main.rs                   # entry point, CLI args, event loop, screenshot flow
│   ├── state.rs                  # application state (CanvasState, AppState)
│   ├── git_log.rs                # git commit reader (gitoxide)
│   └── ui/
│       ├── mod.rs                # module tree (container, render)
│       ├── adapter.rs            # stable card key hashing
│       ├── container.rs          # data model (Container, CardData, DocumentData, ContainerType)
│       └── render.rs             # immediate-mode render functions (canvas, drawer, search, containers)
├── crates/
│   └── daftprompt-indexer/
│       ├── Cargo.toml
│       └── src/
│           ├── lib.rs            # Indexer public API (commits, code, documents, unified search)
│           ├── db.rs             # SQLite schema, FTS5, vec0, queries
│           ├── embed.rs          # model2vec-rs wrapper
│           ├── code.rs           # language registry/router + shared Rust/TypeScript/TSX/JavaScript/JSX query constants
│           ├── documents.rs      # document discovery, chunking, incremental indexing
│           └── schema.sql        # SQL schema definition
└── epics/                        # feature epic specifications

Dependencies

  • akar-core / akar-layout / akar-components / akar-winit — path deps at ~/Projects/akar/crates/akar-*. Owns the wgpu pipeline, taffy layout, components, and winit event routing.
  • wgpu (v29.0.0) — GPU rendering (still a direct dep; akar builds on it)
  • winit (v0.30.12) — Windowing and input handling (still a direct dep; akar-winit augments it)
  • glam — Mathematics library for transforms
  • pollster — Async runtime
  • gix (gitoxide) — Git repository access (crates.io)
  • daftprompt-indexer — in-workspace indexer crate (FTS5 + sqlite-vec + model2vec-rs)
  • tree-sitter / tree-sitter-rust / tree-sitter-typescript / tree-sitter-javascript — tree-sitter parsing pipelines for Rust (.rs), TypeScript (.ts), TSX (.tsx), and JavaScript/JSX (.js/.jsx); tree-sitter-javascript shares one grammar across JS and JSX (Epics 004, 009, 010)
  • png — PNG encoding for --screenshot output
  • clap — CLI argument parsing
  • anyhow / serde_json — error handling and serialization

Next Steps

The previous "Next Steps" list (real-data integration, document parsing, file watching) is now done by Epic 002 (git log column), Epic 003 (commit indexer), Epic 004 (Rust code indexer), Epic 007 (document indexer), Epic 009 (TypeScript and TSX), and Epic 010 (JavaScript and JSX). The remaining genuine follow-ups after Epic 010 are:

  1. Drag-and-drop card repositioning — Cards are positioned in world space; drag-to-move is a follow-up epic.
  2. Context menus — Right-click menus on cards, container headers, and the canvas background.
  3. Plugin system — Third-party extension points for new container types and search backends.
  4. Window/canvas state persistence — Restore pan, zoom, and selected folder across sessions.

Known Limitations

  • Card dragging is not yet implemented (cards are positioned in world space; drag-to-move is a future epic).
  • Per-repo indexer DBs are persisted in the OS cache directory (~/Library/Caches/daftprompt/{slug}.db on macOS), but window state and canvas pan/zoom are not.
  • akar-winit does not expose Cmd/Ctrl modifier state; modifier tracking is done manually in AppState via a WindowEvent::ModifiersChanged arm.

Development

# Check for compilation errors
cargo check --workspace

# Run with debug logging
RUST_LOG=debug cargo run

# Capture one frame to PNG (visual regression)
cargo run --release -- --screenshot /tmp/daftprompt.png --exit

# Run tests
cargo test --workspace

License

This project is a prototype and is not yet licensed for distribution.

About

Its prompts all the way down

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages