Skip to main content

A lightweight code & document formatting display service

Project description

Peek

A lightweight code & document formatting display service.

Agent(AI)产出 → Peek 格式化 → 人类友好查看

快速开始

安装

pip install peek

启动服务

# 本地开发
peek serve

# 生产部署(指定端口和主机)
peek serve --host 0.0.0.0 --port 8080

服务启动后,访问 http://localhost:8080 即可使用 Web 界面。

命令行用法

创建条目

# 从文件创建
peek create file.txt -s "My document"

# 从多文件创建
peek create src/*.py -s "Python project" -t python -t cli

# 从标准输入创建
echo "print('hello')" | peek create -s "From stdin" --from-stdin

# 指定自定义 slug
peek create README.md -s "Documentation" --slug docs

查看条目

# 查看条目详情
peek get my-entry

# 列出入库(支持分页)
peek list
peek list --page 2 --per-page 50

# 搜索条目(FTS5 全文搜索)
peek list -q "python function"

# 按标签过滤
peek list -t python -t cli

删除条目

# 删除条目(会要求确认)
peek delete my-entry

# 强制删除(无需确认)
peek delete my-entry --force

配置

通过环境变量配置:

变量 默认值 说明
PEEK_DATA_DIR ~/.peek/data 文件存储目录
PEEK_DB_PATH ~/.peek/peek.db SQLite 数据库路径
PEEK_ALLOWED_PATHS [] 允许读取的本地路径列表
PEEK_HOST 127.0.0.1 服务绑定地址
PEEK_PORT 8080 服务端口
PEEK_API_KEY `` API 认证密钥(可选)
PEEK_CORS_ORIGINS http://localhost:5173 CORS 允许来源

配置文件

也可以将配置写入 .env 文件:

PEEK_DATA_DIR=/var/peek/data
PEEK_DB_PATH=/var/peek/peek.db
PEEK_HOST=0.0.0.0
PEEK_PORT=8080
PEEK_API_KEY=your-secret-key

特性

  • 🎨 代码高亮 - 基于 Shiki 的语法高亮,支持 100+ 语言
  • 📝 Markdown 渲染 - 支持 GitHub 风格 Markdown
  • 🔍 全文搜索 - 基于 SQLite FTS5 的高性能搜索
  • 📂 多文件支持 - 单条目支持多文件,树形展示
  • 🌓 主题切换 - 深色/浅色模式,自动跟随系统
  • 📱 移动端适配 - 响应式设计,底部工具栏
  • 🔗 URL 友好 - 支持 slug 和文件路径参数
  • 🔒 安全防护 - 路径遍历防护、API 认证、XSS 过滤

技术栈

  • 后端: FastAPI + SQLModel + SQLite (FTS5)
  • 前端: Vue 3 + Vite + Shiki + TypeScript
  • CLI: Click + Rich

开发

# 克隆仓库
git clone https://github.com/randomgitsrc/peek.git
cd peek/backend

# 安装开发依赖
pip install -e ".[test,dev]"

# 运行测试
make test

# 格式化代码
make format

# 启动开发服务器
make dev

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

peekview-0.1.0.tar.gz (1.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

peekview-0.1.0-py3-none-any.whl (2.0 MB view details)

Uploaded Python 3

File details

Details for the file peekview-0.1.0.tar.gz.

File metadata

  • Download URL: peekview-0.1.0.tar.gz
  • Upload date:
  • Size: 1.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for peekview-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4e710d9833c07f6312d6d4cc2e98de08f118424e11373b29dee8c25512724187
MD5 25650478aaf81c5b8c3861d8650244ab
BLAKE2b-256 5651c8614893c9b3adc1a4909c728536b5f3e64b281a1c7714d95906828124fd

See more details on using hashes here.

File details

Details for the file peekview-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: peekview-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for peekview-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1867f62bb7f4187b10a2121083985838b71dbda4e2092f31dedb1fad2f8505d5
MD5 fa6a210896b2ab476638e3670528f612
BLAKE2b-256 03c63d6015b2c37cd8bbd8a8f4fe8a329210d8ffc33e29f1e7bbc240dac1f169

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page