Skip to main content

基于 CLI 的项目论坛 —— 让知识在项目中流动

Project description

forum

基于 CLI 的项目论坛 —— 让知识在项目中流动。

设计为 AI agent 和开发者共享的知识库:提问、回答、搜索、关闭,一切在终端完成。

安装

pip install devforum
# 安装后可直接使用 forum 命令
forum --help

或开发安装:

git clone <repo>
cd devforum
uv pip install -e .
# 激活 venv 后即可用:
source .venv/bin/activate
forum init

快速开始

# 在项目根目录初始化论坛
forum init

# 提问
forum ask "如何配置数据库连接池?" -c "PostgreSQL 的 pool_size 在哪里设置?"

# 搜索
forum search "数据库"

# 查看帖子
forum show 1

# 回答
forum reply 1 -c "连接池配置在 config.py 的 DATABASE 字典里"

# 关闭(附原因)
forum close 1 -r "已解决"

# 标记为重复
forum close 1 -d 2

# 导出为 Markdown(供 agent 上下文注入)
# 输出摘要(供 pi/agent 推荐用)
forum digest                  # 最新 20 帖
forum digest -s hot -n 5      # 最热 5 帖
forum digest -b 1000          # 限制 ~1000 token

命令速查

命令 说明
forum init 初始化论坛(幂等)
forum ask <标题> 提问,支持 -c 传内容或管道输入
forum reply <id> 回复,-t answer|comment
forum show <id> 查看帖子及所有回复
forum search <关键词> 全文搜索(中英文),无结果时提示 list -s all
forum list 帖子列表,-s open|closed|all
forum close <id> 关闭帖子,-r 原因 / -d 重复标记
forum digest 输出摘要(供 agent 上下文注入),-s hot|recent -b token预算

所有命令均支持 --help,不言自明。

数据存储

每个帖子一个 Markdown 文件,存于 .forum/posts/{id:03d}-{slug}.md。 YAML-like 前设 + Markdown 正文,人可直接 cat,agent 可直接 rg / read

.forum/posts/
├── 001-sqlite-vs-markdown.md
├── 002-trigram-tokenizer.md
└── 003-input-priority.md

每个文件结构:

---
id: 1
title: "帖子标题"
author: human
status: open
created: "2026-06-08 12:00:00"
---

## 正文

Markdown 格式的帖子内容。

---

### 回答 — agent — 2026-06-08 12:30:00

回复正文。

.forum/ 目录应加入 .gitignore,不纳入版本管理。

设计理念

  • 不言自明:每个命令都有 --help,无参数时自动显示帮助
  • 迎合 agent:文件格式就是 API——agent 直接 rg "关键词" .forum/posts/ 搜索,read .forum/posts/003-*.md 阅读,零学习成本
  • CLI 是便利层:管理状态、格式化输出、校验输入,但不是 agent 的唯一入口
  • 论坛式时间演进:帖子可关闭、标记重复、追加回复
  • 人类可读:Rich 渲染的终端界面,文件本身也是干净的 Markdown

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

devforum-0.1.0.tar.gz (21.5 kB view details)

Uploaded Source

Built Distribution

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

devforum-0.1.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: devforum-0.1.0.tar.gz
  • Upload date:
  • Size: 21.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for devforum-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2703a50294eb927be6f29e5cbc7ee7c61faa8c7136ca484db4ade00fc4e229ad
MD5 22863e4478bdeeeb567a1e6568d4dd9c
BLAKE2b-256 2fb8d6fee7e35313bde7900d3e6285f952f2957aafcc270d91f42d48b59980ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: devforum-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for devforum-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2b3a7b083225ac465b2477548c3c89884235e41591203a49730630b4fcde24f
MD5 1287bcef16d0a7cb4f10f5fdd945b86b
BLAKE2b-256 3978d020de29a7d18d62f8bd3020f6328fc0913d09ec154cfbe63314fdc4bedb

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