reprompt-cli 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reprompt_cli-0.1.1/.editorconfig +18 -0
- reprompt_cli-0.1.1/.github/ISSUE_TEMPLATE/bug_report.yml +29 -0
- reprompt_cli-0.1.1/.github/ISSUE_TEMPLATE/feature_request.yml +39 -0
- reprompt_cli-0.1.1/.github/PULL_REQUEST_TEMPLATE.md +13 -0
- reprompt_cli-0.1.1/.github/dependabot.yml +16 -0
- reprompt_cli-0.1.1/.github/workflows/ci.yml +36 -0
- reprompt_cli-0.1.1/.github/workflows/publish.yml +23 -0
- reprompt_cli-0.1.1/.gitignore +36 -0
- reprompt_cli-0.1.1/CHANGELOG.md +34 -0
- reprompt_cli-0.1.1/CONTRIBUTING.md +71 -0
- reprompt_cli-0.1.1/LICENSE +21 -0
- reprompt_cli-0.1.1/PKG-INFO +198 -0
- reprompt_cli-0.1.1/README.md +158 -0
- reprompt_cli-0.1.1/SECURITY.md +20 -0
- reprompt_cli-0.1.1/pyproject.toml +69 -0
- reprompt_cli-0.1.1/src/reprompt/__init__.py +5 -0
- reprompt_cli-0.1.1/src/reprompt/adapters/__init__.py +3 -0
- reprompt_cli-0.1.1/src/reprompt/adapters/base.py +25 -0
- reprompt_cli-0.1.1/src/reprompt/adapters/claude_code.py +140 -0
- reprompt_cli-0.1.1/src/reprompt/adapters/openclaw.py +79 -0
- reprompt_cli-0.1.1/src/reprompt/cli.py +177 -0
- reprompt_cli-0.1.1/src/reprompt/config.py +44 -0
- reprompt_cli-0.1.1/src/reprompt/core/__init__.py +1 -0
- reprompt_cli-0.1.1/src/reprompt/core/analyzer.py +68 -0
- reprompt_cli-0.1.1/src/reprompt/core/dedup.py +89 -0
- reprompt_cli-0.1.1/src/reprompt/core/library.py +91 -0
- reprompt_cli-0.1.1/src/reprompt/core/models.py +24 -0
- reprompt_cli-0.1.1/src/reprompt/core/pipeline.py +172 -0
- reprompt_cli-0.1.1/src/reprompt/embeddings/__init__.py +3 -0
- reprompt_cli-0.1.1/src/reprompt/embeddings/base.py +21 -0
- reprompt_cli-0.1.1/src/reprompt/embeddings/ollama.py +54 -0
- reprompt_cli-0.1.1/src/reprompt/embeddings/tfidf.py +22 -0
- reprompt_cli-0.1.1/src/reprompt/output/__init__.py +1 -0
- reprompt_cli-0.1.1/src/reprompt/output/json_out.py +11 -0
- reprompt_cli-0.1.1/src/reprompt/output/markdown.py +46 -0
- reprompt_cli-0.1.1/src/reprompt/output/terminal.py +65 -0
- reprompt_cli-0.1.1/src/reprompt/py.typed +0 -0
- reprompt_cli-0.1.1/src/reprompt/storage/__init__.py +1 -0
- reprompt_cli-0.1.1/src/reprompt/storage/db.py +314 -0
- reprompt_cli-0.1.1/tests/__init__.py +0 -0
- reprompt_cli-0.1.1/tests/conftest.py +13 -0
- reprompt_cli-0.1.1/tests/fixtures/claude_session.jsonl +6 -0
- reprompt_cli-0.1.1/tests/fixtures/openclaw_session.jsonl +6 -0
- reprompt_cli-0.1.1/tests/test_adapter_claude.py +122 -0
- reprompt_cli-0.1.1/tests/test_adapter_openclaw.py +64 -0
- reprompt_cli-0.1.1/tests/test_analyzer.py +54 -0
- reprompt_cli-0.1.1/tests/test_cli.py +96 -0
- reprompt_cli-0.1.1/tests/test_config.py +22 -0
- reprompt_cli-0.1.1/tests/test_db.py +108 -0
- reprompt_cli-0.1.1/tests/test_dedup.py +113 -0
- reprompt_cli-0.1.1/tests/test_e2e.py +257 -0
- reprompt_cli-0.1.1/tests/test_embeddings_ollama.py +104 -0
- reprompt_cli-0.1.1/tests/test_install_hook.py +73 -0
- reprompt_cli-0.1.1/tests/test_library.py +68 -0
- reprompt_cli-0.1.1/tests/test_markdown.py +83 -0
- reprompt_cli-0.1.1/tests/test_models.py +32 -0
- reprompt_cli-0.1.1/tests/test_output.py +83 -0
- reprompt_cli-0.1.1/tests/test_pipeline.py +227 -0
- reprompt_cli-0.1.1/uv.lock +2227 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = space
|
|
5
|
+
indent_size = 4
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
charset = utf-8
|
|
8
|
+
trim_trailing_whitespace = true
|
|
9
|
+
insert_final_newline = true
|
|
10
|
+
|
|
11
|
+
[*.{js,ts,jsx,tsx,json,yaml,yml,css,html,svelte}]
|
|
12
|
+
indent_size = 2
|
|
13
|
+
|
|
14
|
+
[*.md]
|
|
15
|
+
trim_trailing_whitespace = false
|
|
16
|
+
|
|
17
|
+
[Makefile]
|
|
18
|
+
indent_style = tab
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Report a bug in reprompt
|
|
3
|
+
labels: [bug]
|
|
4
|
+
body:
|
|
5
|
+
- type: textarea
|
|
6
|
+
id: description
|
|
7
|
+
attributes:
|
|
8
|
+
label: Description
|
|
9
|
+
description: What happened?
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: steps
|
|
14
|
+
attributes:
|
|
15
|
+
label: Steps to reproduce
|
|
16
|
+
description: How can we reproduce this?
|
|
17
|
+
- type: input
|
|
18
|
+
id: version
|
|
19
|
+
attributes:
|
|
20
|
+
label: reprompt version
|
|
21
|
+
description: "Output of `reprompt --version` (if available)"
|
|
22
|
+
- type: input
|
|
23
|
+
id: python-version
|
|
24
|
+
attributes:
|
|
25
|
+
label: Python version
|
|
26
|
+
- type: input
|
|
27
|
+
id: os
|
|
28
|
+
attributes:
|
|
29
|
+
label: Operating system
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest a new feature or improvement
|
|
3
|
+
labels: ["enhancement"]
|
|
4
|
+
body:
|
|
5
|
+
- type: markdown
|
|
6
|
+
attributes:
|
|
7
|
+
value: |
|
|
8
|
+
Thanks for suggesting an improvement!
|
|
9
|
+
- type: textarea
|
|
10
|
+
id: problem
|
|
11
|
+
attributes:
|
|
12
|
+
label: Problem
|
|
13
|
+
description: What problem does this solve?
|
|
14
|
+
placeholder: "I'm always frustrated when..."
|
|
15
|
+
validations:
|
|
16
|
+
required: true
|
|
17
|
+
- type: textarea
|
|
18
|
+
id: solution
|
|
19
|
+
attributes:
|
|
20
|
+
label: Proposed Solution
|
|
21
|
+
description: How would you like this to work?
|
|
22
|
+
validations:
|
|
23
|
+
required: true
|
|
24
|
+
- type: textarea
|
|
25
|
+
id: alternatives
|
|
26
|
+
attributes:
|
|
27
|
+
label: Alternatives Considered
|
|
28
|
+
description: Any other approaches you've thought about?
|
|
29
|
+
- type: dropdown
|
|
30
|
+
id: component
|
|
31
|
+
attributes:
|
|
32
|
+
label: Component
|
|
33
|
+
options:
|
|
34
|
+
- CLI
|
|
35
|
+
- Adapters (Claude Code, OpenClaw, etc.)
|
|
36
|
+
- Dedup Engine
|
|
37
|
+
- Analyzer / Library
|
|
38
|
+
- Output / Reports
|
|
39
|
+
- Other
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
labels:
|
|
8
|
+
- "dependencies"
|
|
9
|
+
open-pull-requests-limit: 5
|
|
10
|
+
|
|
11
|
+
- package-ecosystem: "github-actions"
|
|
12
|
+
directory: "/"
|
|
13
|
+
schedule:
|
|
14
|
+
interval: "weekly"
|
|
15
|
+
labels:
|
|
16
|
+
- "ci"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ${{ matrix.os }}
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
os: [ubuntu-latest, macos-latest]
|
|
15
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Set up Python
|
|
19
|
+
uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: ${{ matrix.python-version }}
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v4
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: uv pip install --system -e ".[dev]"
|
|
26
|
+
- name: Lint
|
|
27
|
+
run: ruff check src/ tests/
|
|
28
|
+
- name: Format check
|
|
29
|
+
run: ruff format --check src/ tests/
|
|
30
|
+
- name: Test
|
|
31
|
+
run: pytest tests/ -v --cov=reprompt --cov-report=xml
|
|
32
|
+
- name: Upload coverage
|
|
33
|
+
if: matrix.python-version == '3.12' && matrix.os == 'ubuntu-latest'
|
|
34
|
+
uses: codecov/codecov-action@v4
|
|
35
|
+
with:
|
|
36
|
+
file: coverage.xml
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags: ["v*"]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- name: Install build tools
|
|
19
|
+
run: pip install build
|
|
20
|
+
- name: Build
|
|
21
|
+
run: python -m build
|
|
22
|
+
- name: Publish to PyPI
|
|
23
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
*.egg
|
|
8
|
+
dist/
|
|
9
|
+
build/
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
ENV/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
*~
|
|
23
|
+
|
|
24
|
+
# Testing
|
|
25
|
+
.pytest_cache/
|
|
26
|
+
.coverage
|
|
27
|
+
htmlcov/
|
|
28
|
+
.mypy_cache/
|
|
29
|
+
|
|
30
|
+
# OS
|
|
31
|
+
.DS_Store
|
|
32
|
+
Thumbs.db
|
|
33
|
+
|
|
34
|
+
# Project
|
|
35
|
+
*.db
|
|
36
|
+
.env
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.1.1] - 2026-03-10
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- Prevent connection leak in all database methods (try/finally)
|
|
9
|
+
- Fix session marking for incremental scan accuracy
|
|
10
|
+
- Fix purge validation for date format parsing
|
|
11
|
+
- Fix pattern dedup to avoid duplicate entries
|
|
12
|
+
- Improve Ollama error messages when server is unreachable
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `--version` / `-V` flag to CLI
|
|
16
|
+
- mypy strict mode compliance
|
|
17
|
+
|
|
18
|
+
## [0.1.0] - 2026-03-10
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Initial release
|
|
23
|
+
- Claude Code session adapter (JSONL format)
|
|
24
|
+
- OpenClaw session adapter
|
|
25
|
+
- Two-layer deduplication (SHA-256 exact + TF-IDF semantic)
|
|
26
|
+
- TF-IDF hot terms analysis
|
|
27
|
+
- K-means prompt clustering
|
|
28
|
+
- Prompt pattern library with auto-categorization
|
|
29
|
+
- Rich terminal reports with tables and bar charts
|
|
30
|
+
- JSON output for CI/pipeline integration
|
|
31
|
+
- Markdown export for prompt library
|
|
32
|
+
- `install-hook` command for Claude Code automation
|
|
33
|
+
- Ollama embedding backend (optional)
|
|
34
|
+
- Zero-config defaults with env var and TOML override
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Contributing to reprompt
|
|
2
|
+
|
|
3
|
+
## Development Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/reprompt-dev/reprompt
|
|
7
|
+
cd reprompt
|
|
8
|
+
uv venv
|
|
9
|
+
uv pip install -e ".[dev]"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Running Tests
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
uv run pytest tests/ -v
|
|
16
|
+
uv run pytest tests/ -v --cov=reprompt # with coverage
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Code Style
|
|
20
|
+
|
|
21
|
+
We use [ruff](https://docs.astral.sh/ruff/) for linting and formatting:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
uv run ruff check src/ tests/
|
|
25
|
+
uv run ruff format src/ tests/
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Type Checking
|
|
29
|
+
|
|
30
|
+
We use [mypy](https://mypy-lang.org/) in strict mode:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv run mypy src/reprompt/
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Pull Requests
|
|
37
|
+
|
|
38
|
+
1. Fork the repo and create a feature branch
|
|
39
|
+
2. Write tests for new functionality
|
|
40
|
+
3. Ensure all tests pass and coverage doesn't decrease
|
|
41
|
+
4. Run `ruff check` and `ruff format`
|
|
42
|
+
5. Run `mypy src/reprompt/` — must pass clean
|
|
43
|
+
6. Submit a PR with a clear description
|
|
44
|
+
|
|
45
|
+
## Adding Adapters
|
|
46
|
+
|
|
47
|
+
To add support for a new AI coding tool:
|
|
48
|
+
|
|
49
|
+
1. Create `src/reprompt/adapters/your_tool.py`
|
|
50
|
+
2. Subclass `BaseAdapter`
|
|
51
|
+
3. Implement `parse_session()` and `detect_installed()`
|
|
52
|
+
4. Add test fixtures in `tests/fixtures/`
|
|
53
|
+
5. Add tests in `tests/test_adapter_your_tool.py`
|
|
54
|
+
|
|
55
|
+
## Architecture
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
src/reprompt/
|
|
59
|
+
├── cli.py # Typer CLI entry point
|
|
60
|
+
├── config.py # pydantic-settings configuration
|
|
61
|
+
├── core/ # Business logic
|
|
62
|
+
│ ├── models.py # Prompt dataclass
|
|
63
|
+
│ ├── dedup.py # Two-layer deduplication
|
|
64
|
+
│ ├── analyzer.py # TF-IDF + K-means
|
|
65
|
+
│ ├── library.py # Pattern extraction
|
|
66
|
+
│ └── pipeline.py # Orchestrator
|
|
67
|
+
├── adapters/ # AI tool parsers
|
|
68
|
+
├── embeddings/ # Pluggable backends
|
|
69
|
+
├── storage/ # SQLite layer
|
|
70
|
+
└── output/ # Report formatters
|
|
71
|
+
```
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 reprompt-dev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: reprompt-cli
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Discover, analyze, and evolve your best prompts from AI coding sessions
|
|
5
|
+
Project-URL: Homepage, https://github.com/reprompt-dev/reprompt
|
|
6
|
+
Project-URL: Repository, https://github.com/reprompt-dev/reprompt
|
|
7
|
+
Project-URL: Issues, https://github.com/reprompt-dev/reprompt/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/reprompt-dev/reprompt/blob/main/CHANGELOG.md
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: ai,analytics,claude-code,cli,llm,prompt
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Requires-Dist: pydantic-settings>=2.0
|
|
25
|
+
Requires-Dist: rich>=13.0
|
|
26
|
+
Requires-Dist: scikit-learn>=1.4
|
|
27
|
+
Requires-Dist: typer>=0.9
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
33
|
+
Provides-Extra: local
|
|
34
|
+
Requires-Dist: sentence-transformers>=2.0; extra == 'local'
|
|
35
|
+
Provides-Extra: ollama
|
|
36
|
+
Requires-Dist: requests>=2.31; extra == 'ollama'
|
|
37
|
+
Provides-Extra: openai
|
|
38
|
+
Requires-Dist: openai>=1.0; extra == 'openai'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# reprompt
|
|
42
|
+
|
|
43
|
+
[](https://github.com/reprompt-dev/reprompt/actions/workflows/ci.yml)
|
|
44
|
+
[](https://pypi.org/project/reprompt-cli/)
|
|
45
|
+
[](https://pypi.org/project/reprompt-cli/)
|
|
46
|
+
[](https://opensource.org/licenses/MIT)
|
|
47
|
+
|
|
48
|
+
> Discover, analyze, and evolve your best prompts from AI coding sessions.
|
|
49
|
+
|
|
50
|
+
Every developer's AI session history contains reusable prompt patterns -- scattered across hundreds of session files. **reprompt** extracts them, deduplicates, analyzes frequency, and builds a personal prompt library that evolves over time.
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pipx install reprompt-cli
|
|
56
|
+
reprompt scan
|
|
57
|
+
reprompt report
|
|
58
|
+
reprompt library
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Features
|
|
62
|
+
|
|
63
|
+
- **Auto-detection** -- finds Claude Code and OpenClaw sessions automatically
|
|
64
|
+
- **Two-layer dedup** -- SHA-256 exact + TF-IDF semantic similarity
|
|
65
|
+
- **Hot terms analysis** -- TF-IDF discovers your most-used technical terms
|
|
66
|
+
- **K-means clustering** -- groups similar prompts into themes
|
|
67
|
+
- **Prompt library** -- extracts high-frequency patterns, auto-categorizes (debug/implement/test/review/refactor/explain/config)
|
|
68
|
+
- **Rich reports** -- beautiful terminal output with tables and bar charts
|
|
69
|
+
- **Multiple formats** -- terminal, JSON (for pipelines), Markdown (for docs)
|
|
70
|
+
- **Pluggable adapters** -- add support for any AI coding tool
|
|
71
|
+
- **Zero config** -- works out of the box, customize via env vars or TOML
|
|
72
|
+
|
|
73
|
+
## Supported AI Tools
|
|
74
|
+
|
|
75
|
+
| Tool | Status | Session Path |
|
|
76
|
+
|------|--------|-------------|
|
|
77
|
+
| Claude Code | Supported | `~/.claude/projects/` |
|
|
78
|
+
| OpenClaw / OpenCode | Supported | `~/.opencode/sessions/` |
|
|
79
|
+
| Cursor | Planned | -- |
|
|
80
|
+
| Codex CLI | Planned | -- |
|
|
81
|
+
| Gemini CLI | Planned | -- |
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Scan all detected AI tools
|
|
87
|
+
reprompt scan
|
|
88
|
+
|
|
89
|
+
# Scan specific source
|
|
90
|
+
reprompt scan --source claude-code
|
|
91
|
+
|
|
92
|
+
# Scan custom path
|
|
93
|
+
reprompt scan --path ~/custom/sessions
|
|
94
|
+
|
|
95
|
+
# Rich terminal report
|
|
96
|
+
reprompt report
|
|
97
|
+
|
|
98
|
+
# JSON output (for CI/pipelines)
|
|
99
|
+
reprompt report --format json
|
|
100
|
+
|
|
101
|
+
# View your prompt library
|
|
102
|
+
reprompt library
|
|
103
|
+
|
|
104
|
+
# Filter by category
|
|
105
|
+
reprompt library --category debug
|
|
106
|
+
|
|
107
|
+
# Export prompt library as Markdown
|
|
108
|
+
reprompt library prompts.md
|
|
109
|
+
|
|
110
|
+
# Database stats
|
|
111
|
+
reprompt status
|
|
112
|
+
|
|
113
|
+
# Auto-scan after sessions
|
|
114
|
+
reprompt install-hook
|
|
115
|
+
|
|
116
|
+
# Cleanup old data
|
|
117
|
+
reprompt purge --older-than 90d
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Terminal Report
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
reprompt -- AI Session Analytics
|
|
124
|
+
========================================
|
|
125
|
+
|
|
126
|
+
Overview
|
|
127
|
+
Total prompts: 1,247
|
|
128
|
+
Unique (deduped): 832
|
|
129
|
+
Sessions scanned: 156
|
|
130
|
+
Sources: claude-code, openclaw
|
|
131
|
+
|
|
132
|
+
Top Prompt Patterns
|
|
133
|
+
# | Pattern | Count | Category
|
|
134
|
+
1 | fix the failing test... | 42 | debug
|
|
135
|
+
2 | add unit tests for... | 38 | test
|
|
136
|
+
3 | refactor X to use... | 27 | refactor
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Configuration
|
|
140
|
+
|
|
141
|
+
Zero config by default. Customize with environment variables or TOML:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Environment variables (prefix: REPROMPT_)
|
|
145
|
+
REPROMPT_EMBEDDING_BACKEND=ollama reprompt scan
|
|
146
|
+
REPROMPT_DB_PATH=~/custom/reprompt.db reprompt status
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
```toml
|
|
150
|
+
# ~/.config/reprompt/config.toml
|
|
151
|
+
[embedding]
|
|
152
|
+
backend = "tfidf" # tfidf | ollama | local | openai
|
|
153
|
+
|
|
154
|
+
[storage]
|
|
155
|
+
db_path = "~/.local/share/reprompt/reprompt.db"
|
|
156
|
+
|
|
157
|
+
[dedup]
|
|
158
|
+
semantic_threshold = 0.85
|
|
159
|
+
|
|
160
|
+
[library]
|
|
161
|
+
min_frequency = 3
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Optional Backends
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
pip install reprompt-cli[ollama] # Ollama API embeddings
|
|
168
|
+
pip install reprompt-cli[local] # sentence-transformers (CPU)
|
|
169
|
+
pip install reprompt-cli[openai] # OpenAI API embeddings
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Adding an Adapter
|
|
173
|
+
|
|
174
|
+
Create a new adapter by subclassing `BaseAdapter`:
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from reprompt.adapters.base import BaseAdapter
|
|
178
|
+
from reprompt.core.models import Prompt
|
|
179
|
+
|
|
180
|
+
class MyToolAdapter(BaseAdapter):
|
|
181
|
+
name = "my-tool"
|
|
182
|
+
default_session_path = "~/.my-tool/sessions"
|
|
183
|
+
|
|
184
|
+
def parse_session(self, path):
|
|
185
|
+
# Parse session file -> list[Prompt]
|
|
186
|
+
...
|
|
187
|
+
|
|
188
|
+
def detect_installed(self):
|
|
189
|
+
return Path(self.default_session_path).expanduser().exists()
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# reprompt
|
|
2
|
+
|
|
3
|
+
[](https://github.com/reprompt-dev/reprompt/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/reprompt-cli/)
|
|
5
|
+
[](https://pypi.org/project/reprompt-cli/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
> Discover, analyze, and evolve your best prompts from AI coding sessions.
|
|
9
|
+
|
|
10
|
+
Every developer's AI session history contains reusable prompt patterns -- scattered across hundreds of session files. **reprompt** extracts them, deduplicates, analyzes frequency, and builds a personal prompt library that evolves over time.
|
|
11
|
+
|
|
12
|
+
## Quick Start
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pipx install reprompt-cli
|
|
16
|
+
reprompt scan
|
|
17
|
+
reprompt report
|
|
18
|
+
reprompt library
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- **Auto-detection** -- finds Claude Code and OpenClaw sessions automatically
|
|
24
|
+
- **Two-layer dedup** -- SHA-256 exact + TF-IDF semantic similarity
|
|
25
|
+
- **Hot terms analysis** -- TF-IDF discovers your most-used technical terms
|
|
26
|
+
- **K-means clustering** -- groups similar prompts into themes
|
|
27
|
+
- **Prompt library** -- extracts high-frequency patterns, auto-categorizes (debug/implement/test/review/refactor/explain/config)
|
|
28
|
+
- **Rich reports** -- beautiful terminal output with tables and bar charts
|
|
29
|
+
- **Multiple formats** -- terminal, JSON (for pipelines), Markdown (for docs)
|
|
30
|
+
- **Pluggable adapters** -- add support for any AI coding tool
|
|
31
|
+
- **Zero config** -- works out of the box, customize via env vars or TOML
|
|
32
|
+
|
|
33
|
+
## Supported AI Tools
|
|
34
|
+
|
|
35
|
+
| Tool | Status | Session Path |
|
|
36
|
+
|------|--------|-------------|
|
|
37
|
+
| Claude Code | Supported | `~/.claude/projects/` |
|
|
38
|
+
| OpenClaw / OpenCode | Supported | `~/.opencode/sessions/` |
|
|
39
|
+
| Cursor | Planned | -- |
|
|
40
|
+
| Codex CLI | Planned | -- |
|
|
41
|
+
| Gemini CLI | Planned | -- |
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Scan all detected AI tools
|
|
47
|
+
reprompt scan
|
|
48
|
+
|
|
49
|
+
# Scan specific source
|
|
50
|
+
reprompt scan --source claude-code
|
|
51
|
+
|
|
52
|
+
# Scan custom path
|
|
53
|
+
reprompt scan --path ~/custom/sessions
|
|
54
|
+
|
|
55
|
+
# Rich terminal report
|
|
56
|
+
reprompt report
|
|
57
|
+
|
|
58
|
+
# JSON output (for CI/pipelines)
|
|
59
|
+
reprompt report --format json
|
|
60
|
+
|
|
61
|
+
# View your prompt library
|
|
62
|
+
reprompt library
|
|
63
|
+
|
|
64
|
+
# Filter by category
|
|
65
|
+
reprompt library --category debug
|
|
66
|
+
|
|
67
|
+
# Export prompt library as Markdown
|
|
68
|
+
reprompt library prompts.md
|
|
69
|
+
|
|
70
|
+
# Database stats
|
|
71
|
+
reprompt status
|
|
72
|
+
|
|
73
|
+
# Auto-scan after sessions
|
|
74
|
+
reprompt install-hook
|
|
75
|
+
|
|
76
|
+
# Cleanup old data
|
|
77
|
+
reprompt purge --older-than 90d
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Terminal Report
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
reprompt -- AI Session Analytics
|
|
84
|
+
========================================
|
|
85
|
+
|
|
86
|
+
Overview
|
|
87
|
+
Total prompts: 1,247
|
|
88
|
+
Unique (deduped): 832
|
|
89
|
+
Sessions scanned: 156
|
|
90
|
+
Sources: claude-code, openclaw
|
|
91
|
+
|
|
92
|
+
Top Prompt Patterns
|
|
93
|
+
# | Pattern | Count | Category
|
|
94
|
+
1 | fix the failing test... | 42 | debug
|
|
95
|
+
2 | add unit tests for... | 38 | test
|
|
96
|
+
3 | refactor X to use... | 27 | refactor
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Configuration
|
|
100
|
+
|
|
101
|
+
Zero config by default. Customize with environment variables or TOML:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Environment variables (prefix: REPROMPT_)
|
|
105
|
+
REPROMPT_EMBEDDING_BACKEND=ollama reprompt scan
|
|
106
|
+
REPROMPT_DB_PATH=~/custom/reprompt.db reprompt status
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```toml
|
|
110
|
+
# ~/.config/reprompt/config.toml
|
|
111
|
+
[embedding]
|
|
112
|
+
backend = "tfidf" # tfidf | ollama | local | openai
|
|
113
|
+
|
|
114
|
+
[storage]
|
|
115
|
+
db_path = "~/.local/share/reprompt/reprompt.db"
|
|
116
|
+
|
|
117
|
+
[dedup]
|
|
118
|
+
semantic_threshold = 0.85
|
|
119
|
+
|
|
120
|
+
[library]
|
|
121
|
+
min_frequency = 3
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Optional Backends
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pip install reprompt-cli[ollama] # Ollama API embeddings
|
|
128
|
+
pip install reprompt-cli[local] # sentence-transformers (CPU)
|
|
129
|
+
pip install reprompt-cli[openai] # OpenAI API embeddings
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Adding an Adapter
|
|
133
|
+
|
|
134
|
+
Create a new adapter by subclassing `BaseAdapter`:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from reprompt.adapters.base import BaseAdapter
|
|
138
|
+
from reprompt.core.models import Prompt
|
|
139
|
+
|
|
140
|
+
class MyToolAdapter(BaseAdapter):
|
|
141
|
+
name = "my-tool"
|
|
142
|
+
default_session_path = "~/.my-tool/sessions"
|
|
143
|
+
|
|
144
|
+
def parse_session(self, path):
|
|
145
|
+
# Parse session file -> list[Prompt]
|
|
146
|
+
...
|
|
147
|
+
|
|
148
|
+
def detect_installed(self):
|
|
149
|
+
return Path(self.default_session_path).expanduser().exists()
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Contributing
|
|
153
|
+
|
|
154
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
MIT
|