llman 0.0.13

A tool for managing LLM application rules(prompts) ...
Documentation
# llman - LLM 规则管理工具

[![Crates.io](https://img.shields.io/crates/v/llman?style=flat-square)](https://crates.io/crates/llman)
[![Downloads](https://img.shields.io/crates/d/llman?style=flat-square)](https://crates.io/crates/llman)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://github.com/StrayDragon/llman/blob/main/LICENSE)
[![CI](https://github.com/StrayDragon/llman/actions/workflows/ci.yaml/badge.svg)](https://github.com/StrayDragon/llman/actions/workflows/ci.yaml)


一个用于管理 LLM 应用(如 Cursor)规则文件的命令行工具。 `llman` 旨在简化和标准化您的开发项目规则配置流程。

## 🌟 功能特性

### Prompt管理
- 生成和管理prompt规则文件
- 支持多种模板和应用类型
- 交互式界面便于操作

### x Cursor

#### 对话导出 (new)
导出和管理Cursor编辑器的AI对话记录,同时支持 Chat 和 Composer 两种模式的历史:

- 🔍 **智能搜索**: 在对话标题和内容中搜索
- 📝 **多种导出格式**: 控制台输出、单独文件、合并文件
- 🎯 **交互式选择**: 友好的界面选择要导出的对话
- 📁 **自动检测**: 自动找到最新的Cursor工作区数据
- 💾 **Markdown格式**: 导出为可读性良好的Markdown文档

## 📦 安装

### 从 crates.io 安装

```bash
cargo install llman
```

### 从代码安装

```bash
git clone https://github.com/StrayDragon/llman.git
cd llman
cargo install --path .
```

### 从仓库地址安装

```bash
cargo install --git https://github.com/StrayDragon/llman.git
```

## 🛠️ 使用示例

### Prompt管理

```bash
# 更新(增加)prompt规则
llman prompts upsert --app cursor --name rust --content "This is example rules of rust"

# 生成新的prompt规则
llman prompts gen --app cursor --template rust

# 交互式生成(快捷)
llman prompts

# 交互式生成
llman prompts gen -i # --interactive

# 列出所有规则
llman prompts list

# 列出特定应用的规则
llman prompts list --app cursor

# 兼容别名(等价于 llman prompts)
llman prompt list

# Codex / Claude Code 注入(先 upsert 存模板,再 gen 注入)
llman prompts upsert --app codex --name draftpr --file draftpr.md
llman prompts gen --app codex --scope project --template draftpr
llman prompts gen --app codex --scope user --template draftpr

llman prompts upsert --app claude-code --name project-rules --file claude_rules.md
llman prompts gen --app claude-code --scope all --template project-rules
```

### Cursor对话导出

```bash
# 交互式导出对话
llman x cursor export -i # --interactive
```

### Spec-driven 开发 (SDD)

```bash
# 初始化 llmanspec 目录与模板
llman sdd init

# 更新 llmanspec 指令与模板
llman sdd update

# 生成/更新 llman sdd skills(Claude Code / Codex)
llman sdd update-skills --all

# 列出变更或 specs
llman sdd list
llman sdd list --specs

# 查看变更或 spec(支持 --json)
llman sdd show <id>
llman sdd show <id> --type change
llman sdd show <id> --type spec

# 校验变更或 spec(支持 --json / --strict)
llman sdd validate --all
llman sdd validate <id>

# 归档变更并合并 specs(支持 --skip-specs / --dry-run)
llman sdd archive <id>
```

Spec 文件需要 YAML frontmatter,示例:

```markdown
---
llman_spec_valid_scope:
  - src/
  - tests/
llman_spec_valid_commands:
  - cargo test
llman_spec_evidence:
  - "CI run #12345"
---

## Purpose
...
```

llmanspec 项目配置位于 `llmanspec/config.yaml`,用于设置 locale 与 skills 输出路径。

### YAML schema(LSP)

llman 提供配置文件 JSON schema,用于 YAML LSP 补全与校验。schema 文件位于:

```
artifacts/schema/configs/en/
  llman-config.schema.json
  llman-project-config.schema.json
  llmanspec-config.schema.json
```

使用 `llman self schema generate` 生成 schema,`llman self schema check` 校验,`llman self schema apply` 写入 `yaml-language-server` 头注释:
- 全局配置:`~/.config/llman/config.yaml`(或 `LLMAN_CONFIG_DIR/config.yaml`- 项目配置:`.llman/config.yaml`
- llmanspec 配置:`llmanspec/config.yaml`

示例(raw URL):

```
# yaml-language-server: $schema=https://raw.githubusercontent.com/StrayDragon/llman/main/artifacts/schema/configs/en/llman-config.schema.json
```

### Shell completion

生成或安装 shell 自动补全脚本:

```
llman self completion --shell bash
llman self completion --shell bash --install
```


## 🛠️ 开发与贡献

0. 确保安装了 [Rust]https://www.rust-lang.org[just]https://github.com/casey/just 工具
1. 拉取该仓库
2. 查看 [justfile]./justfile 中 搜索 "(dev)" 相关的命令进行开发