promptmint 0.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Asim Awdah
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,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: promptmint
3
+ Version: 0.1.0
4
+ Summary: Turn any codebase into an AI-ready prompt context pack.
5
+ Author: Asim Awdah
6
+ License: MIT
7
+ Keywords: ai,prompt,developer-tools,cli,codebase,context
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Topic :: Software Development
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Dynamic: license-file
19
+
20
+ # PromptMint
21
+
22
+ Turn any codebase into an AI-ready prompt.
23
+
24
+ PromptMint scans your project, collects useful source files, dependency manifests, git diff, and optional error logs, then generates a clean Markdown context pack you can paste into ChatGPT, Claude, Gemini, or any coding agent.
25
+
26
+ ## Why?
27
+
28
+ Copying files into AI chats is slow and messy. PromptMint gives you one command that creates a structured, safe context file for debugging, code review, refactoring, and project explanation.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ pip install promptmint
34
+ ```
35
+
36
+ ## Install locally for development
37
+
38
+ ```bash
39
+ git clone https://github.com/YOUR_USERNAME/promptmint.git
40
+ cd promptmint
41
+ python3 -m pip install -e .
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ```bash
47
+ promptmint -g "Fix this bug" -m debug
48
+ ```
49
+
50
+ ```bash
51
+ promptmint --goal "Review this PR" --mode review --output review-context.md
52
+ ```
53
+
54
+ ```bash
55
+ promptmint --goal "Explain this project" --mode explain
56
+ ```
57
+
58
+ ```bash
59
+ promptmint -e error.log -m debug -c
60
+ ```
61
+
62
+ ## CLI Shortcuts
63
+
64
+ - `-g`, `--goal`: task goal
65
+ - `-m`, `--mode`: prompt mode
66
+ - `-e`, `--error`: error log file
67
+ - `-i`, `--include`: include glob, repeatable
68
+ - `-x`, `--exclude`: exclude glob, repeatable
69
+ - `-o`, `--output`: output Markdown file
70
+ - `-c`, `--copy`: copy output to clipboard
71
+ - `-s`, `--max-file-bytes`: skip files larger than this size
72
+
73
+ ## Modes
74
+
75
+ - `debug`: root cause + smallest safe fix
76
+ - `review`: bugs, security, performance, maintainability
77
+ - `explain`: explain how the project works
78
+ - `refactor`: safe refactor plan
79
+
80
+ ## What it includes
81
+
82
+ - Project tree
83
+ - Dependency/manifest files like `package.json`, `pyproject.toml`, `composer.json`, `go.mod`, `pubspec.yaml`
84
+ - Git diff, if available
85
+ - Text source files
86
+ - Optional error log
87
+ - Final instruction tailored to the selected mode
88
+
89
+ ## What it ignores by default
90
+
91
+ - `.git`, `node_modules`, `vendor`, `dist`, `build`, virtual environments, caches
92
+ - `.env` files
93
+ - Binary files
94
+ - Large files over 50KB by default
95
+
96
+ ## Examples
97
+
98
+ ```bash
99
+ promptmint . --include "src/**/*.py" --goal "Find the bug"
100
+ ```
101
+
102
+ ```bash
103
+ promptmint . --exclude "tests/fixtures/**" --max-file-bytes 20000
104
+ ```
105
+
106
+ ## Development
107
+
108
+ ```bash
109
+ python3 -m unittest discover -s tests -v
110
+ ```
111
+
112
+ ## Roadmap
113
+
114
+ - [x] Markdown context pack generator
115
+ - [x] Project tree + file scanner
116
+ - [x] Dependency manifest detection
117
+ - [x] Git diff inclusion
118
+ - [x] Debug/review/explain/refactor modes
119
+ - [ ] Better `.gitignore` support
120
+ - [ ] Token budget smart trimming
121
+ - [ ] Interactive file picker
122
+ - [ ] JSON output
123
+ - [ ] MCP server integration
124
+
125
+ ## License
126
+
127
+ MIT
@@ -0,0 +1,108 @@
1
+ # PromptMint
2
+
3
+ Turn any codebase into an AI-ready prompt.
4
+
5
+ PromptMint scans your project, collects useful source files, dependency manifests, git diff, and optional error logs, then generates a clean Markdown context pack you can paste into ChatGPT, Claude, Gemini, or any coding agent.
6
+
7
+ ## Why?
8
+
9
+ Copying files into AI chats is slow and messy. PromptMint gives you one command that creates a structured, safe context file for debugging, code review, refactoring, and project explanation.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pip install promptmint
15
+ ```
16
+
17
+ ## Install locally for development
18
+
19
+ ```bash
20
+ git clone https://github.com/YOUR_USERNAME/promptmint.git
21
+ cd promptmint
22
+ python3 -m pip install -e .
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```bash
28
+ promptmint -g "Fix this bug" -m debug
29
+ ```
30
+
31
+ ```bash
32
+ promptmint --goal "Review this PR" --mode review --output review-context.md
33
+ ```
34
+
35
+ ```bash
36
+ promptmint --goal "Explain this project" --mode explain
37
+ ```
38
+
39
+ ```bash
40
+ promptmint -e error.log -m debug -c
41
+ ```
42
+
43
+ ## CLI Shortcuts
44
+
45
+ - `-g`, `--goal`: task goal
46
+ - `-m`, `--mode`: prompt mode
47
+ - `-e`, `--error`: error log file
48
+ - `-i`, `--include`: include glob, repeatable
49
+ - `-x`, `--exclude`: exclude glob, repeatable
50
+ - `-o`, `--output`: output Markdown file
51
+ - `-c`, `--copy`: copy output to clipboard
52
+ - `-s`, `--max-file-bytes`: skip files larger than this size
53
+
54
+ ## Modes
55
+
56
+ - `debug`: root cause + smallest safe fix
57
+ - `review`: bugs, security, performance, maintainability
58
+ - `explain`: explain how the project works
59
+ - `refactor`: safe refactor plan
60
+
61
+ ## What it includes
62
+
63
+ - Project tree
64
+ - Dependency/manifest files like `package.json`, `pyproject.toml`, `composer.json`, `go.mod`, `pubspec.yaml`
65
+ - Git diff, if available
66
+ - Text source files
67
+ - Optional error log
68
+ - Final instruction tailored to the selected mode
69
+
70
+ ## What it ignores by default
71
+
72
+ - `.git`, `node_modules`, `vendor`, `dist`, `build`, virtual environments, caches
73
+ - `.env` files
74
+ - Binary files
75
+ - Large files over 50KB by default
76
+
77
+ ## Examples
78
+
79
+ ```bash
80
+ promptmint . --include "src/**/*.py" --goal "Find the bug"
81
+ ```
82
+
83
+ ```bash
84
+ promptmint . --exclude "tests/fixtures/**" --max-file-bytes 20000
85
+ ```
86
+
87
+ ## Development
88
+
89
+ ```bash
90
+ python3 -m unittest discover -s tests -v
91
+ ```
92
+
93
+ ## Roadmap
94
+
95
+ - [x] Markdown context pack generator
96
+ - [x] Project tree + file scanner
97
+ - [x] Dependency manifest detection
98
+ - [x] Git diff inclusion
99
+ - [x] Debug/review/explain/refactor modes
100
+ - [ ] Better `.gitignore` support
101
+ - [ ] Token budget smart trimming
102
+ - [ ] Interactive file picker
103
+ - [ ] JSON output
104
+ - [ ] MCP server integration
105
+
106
+ ## License
107
+
108
+ MIT
@@ -0,0 +1,3 @@
1
+ """PromptMint: turn a codebase into an AI-ready prompt."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,73 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import shutil
5
+ import subprocess
6
+ import sys
7
+ from pathlib import Path
8
+
9
+ from .renderer import MODE_REQUESTS, render_context_pack
10
+ from .scanner import scan_project
11
+ from .tokens import estimate_tokens
12
+
13
+
14
+ def build_parser() -> argparse.ArgumentParser:
15
+ parser = argparse.ArgumentParser(
16
+ prog="promptmint",
17
+ description="Turn any codebase into an AI-ready Markdown prompt pack.",
18
+ )
19
+ parser.add_argument("path", nargs="?", default=".", help="Project directory to scan")
20
+ parser.add_argument("-g", "--goal", default=None, help="Task goal to include in the prompt")
21
+ parser.add_argument("-m", "--mode", choices=sorted(MODE_REQUESTS), default="debug", help="Prompt mode")
22
+ parser.add_argument("-e", "--error", dest="error_file", help="Path to an error log to include")
23
+ parser.add_argument("-i", "--include", action="append", default=[], help="Glob to include; can be repeated")
24
+ parser.add_argument("-x", "--exclude", action="append", default=[], help="Glob to exclude; can be repeated")
25
+ parser.add_argument("-o", "--output", default="promptmint-output.md", help="Output Markdown file")
26
+ parser.add_argument("-c", "--copy", action="store_true", help="Copy output to clipboard if a clipboard tool is available")
27
+ parser.add_argument("-s", "--max-file-bytes", type=int, default=50_000, help="Skip files larger than this size")
28
+ return parser
29
+
30
+
31
+ def main(argv: list[str] | None = None) -> int:
32
+ args = build_parser().parse_args(argv)
33
+ root = Path(args.path).resolve()
34
+ error_log = None
35
+ if args.error_file:
36
+ error_log = Path(args.error_file).read_text(encoding="utf-8", errors="replace")
37
+
38
+ scan = scan_project(
39
+ root,
40
+ include=args.include,
41
+ exclude=args.exclude,
42
+ max_file_bytes=args.max_file_bytes,
43
+ )
44
+ output = render_context_pack(scan, goal=args.goal, mode=args.mode, error_log=error_log)
45
+ output_path = Path(args.output).resolve()
46
+ output_path.write_text(output, encoding="utf-8")
47
+
48
+ if args.copy:
49
+ _copy_to_clipboard(output)
50
+
51
+ print(f"Created: {output_path}")
52
+ print(f"Tokens estimate: {estimate_tokens(output):,}")
53
+ print(f"Files included: {len(scan.files)}")
54
+ return 0
55
+
56
+
57
+ def _copy_to_clipboard(text: str) -> None:
58
+ commands = [
59
+ (["pbcopy"], None),
60
+ (["xclip", "-selection", "clipboard"], None),
61
+ (["xsel", "--clipboard", "--input"], None),
62
+ (["wl-copy"], None),
63
+ ]
64
+ for command, _ in commands:
65
+ if shutil.which(command[0]):
66
+ subprocess.run(command, input=text, text=True, check=False)
67
+ print("Copied to clipboard")
68
+ return
69
+ print("Clipboard tool not found; install pbcopy, xclip, xsel, or wl-copy.", file=sys.stderr)
70
+
71
+
72
+ if __name__ == "__main__":
73
+ raise SystemExit(main())
@@ -0,0 +1,17 @@
1
+ from dataclasses import dataclass, field
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class ProjectFile:
6
+ relative_path: str
7
+ language: str
8
+ content: str
9
+
10
+
11
+ @dataclass(frozen=True)
12
+ class ScanResult:
13
+ root: str
14
+ tree: str
15
+ files: list[ProjectFile] = field(default_factory=list)
16
+ dependency_files: list[ProjectFile] = field(default_factory=list)
17
+ git_diff: str = ""
@@ -0,0 +1,59 @@
1
+ from __future__ import annotations
2
+
3
+ from .models import ProjectFile, ScanResult
4
+
5
+ MODE_REQUESTS = {
6
+ "debug": "Please find the root cause, explain it briefly, and suggest the smallest safe fix.",
7
+ "review": "Please review this code for bugs, security issues, performance, and maintainability.",
8
+ "explain": "Please explain how this project works, focusing on the included files.",
9
+ "refactor": "Please suggest a safe refactor plan and identify the smallest first change.",
10
+ }
11
+
12
+
13
+ def render_context_pack(
14
+ scan: ScanResult,
15
+ goal: str | None = None,
16
+ mode: str = "debug",
17
+ error_log: str | None = None,
18
+ ) -> str:
19
+ mode = mode if mode in MODE_REQUESTS else "debug"
20
+ sections = ["# Project Context Pack", ""]
21
+ sections.extend(["## Goal", goal or "Analyze this project context and help with the task.", ""])
22
+ sections.extend([f"## {mode.title()} Request", MODE_REQUESTS[mode], ""])
23
+ sections.extend(["## Project Root", f"`{scan.root}`", ""])
24
+ sections.extend(["## Project Tree", "```text", scan.tree or "(empty)", "```", ""])
25
+
26
+ if scan.dependency_files:
27
+ sections.append("## Dependency / Manifest Files")
28
+ sections.append("")
29
+ for file in scan.dependency_files:
30
+ sections.extend(_render_file(file))
31
+
32
+ if scan.git_diff:
33
+ sections.extend(["## Git Diff", "```diff", scan.git_diff, "```", ""])
34
+
35
+ relevant_files = [
36
+ file for file in scan.files
37
+ if all(file.relative_path != dep.relative_path for dep in scan.dependency_files)
38
+ ]
39
+ if relevant_files:
40
+ sections.append("## Relevant Files")
41
+ sections.append("")
42
+ for file in relevant_files:
43
+ sections.extend(_render_file(file))
44
+
45
+ if error_log:
46
+ sections.extend(["## Error Log", "```text", error_log.strip(), "```", ""])
47
+
48
+ sections.extend(["## Final Instruction", MODE_REQUESTS[mode], ""])
49
+ return "\n".join(sections).rstrip() + "\n"
50
+
51
+
52
+ def _render_file(file: ProjectFile) -> list[str]:
53
+ return [
54
+ f"### `{file.relative_path}`",
55
+ f"```{file.language}",
56
+ file.content.rstrip(),
57
+ "```",
58
+ "",
59
+ ]
@@ -0,0 +1,206 @@
1
+ from __future__ import annotations
2
+
3
+ import fnmatch
4
+ import subprocess
5
+ from pathlib import Path
6
+
7
+ from .models import ProjectFile, ScanResult
8
+
9
+ DEFAULT_EXCLUDED_DIRS = {
10
+ ".git",
11
+ ".hg",
12
+ ".svn",
13
+ ".idea",
14
+ ".vscode",
15
+ "__pycache__",
16
+ ".pytest_cache",
17
+ ".mypy_cache",
18
+ ".ruff_cache",
19
+ "node_modules",
20
+ "vendor",
21
+ "dist",
22
+ "build",
23
+ "target",
24
+ ".next",
25
+ ".nuxt",
26
+ ".venv",
27
+ "venv",
28
+ }
29
+
30
+ DEFAULT_EXCLUDED_FILES = {
31
+ ".env",
32
+ ".env.local",
33
+ ".env.production",
34
+ ".DS_Store",
35
+ "promptmint-output.md",
36
+ }
37
+
38
+ DEPENDENCY_FILES = {
39
+ "package.json",
40
+ "pnpm-lock.yaml",
41
+ "yarn.lock",
42
+ "package-lock.json",
43
+ "requirements.txt",
44
+ "pyproject.toml",
45
+ "poetry.lock",
46
+ "Pipfile",
47
+ "composer.json",
48
+ "composer.lock",
49
+ "go.mod",
50
+ "go.sum",
51
+ "Cargo.toml",
52
+ "Cargo.lock",
53
+ "pubspec.yaml",
54
+ "pubspec.lock",
55
+ "Dockerfile",
56
+ "docker-compose.yml",
57
+ "docker-compose.yaml",
58
+ }
59
+
60
+ LANGUAGE_BY_SUFFIX = {
61
+ ".py": "python",
62
+ ".js": "javascript",
63
+ ".jsx": "jsx",
64
+ ".ts": "typescript",
65
+ ".tsx": "tsx",
66
+ ".go": "go",
67
+ ".php": "php",
68
+ ".dart": "dart",
69
+ ".rs": "rust",
70
+ ".java": "java",
71
+ ".c": "c",
72
+ ".h": "c",
73
+ ".cpp": "cpp",
74
+ ".hpp": "cpp",
75
+ ".cs": "csharp",
76
+ ".rb": "ruby",
77
+ ".sh": "bash",
78
+ ".bash": "bash",
79
+ ".zsh": "zsh",
80
+ ".md": "markdown",
81
+ ".json": "json",
82
+ ".yaml": "yaml",
83
+ ".yml": "yaml",
84
+ ".toml": "toml",
85
+ ".xml": "xml",
86
+ ".html": "html",
87
+ ".css": "css",
88
+ ".scss": "scss",
89
+ ".sql": "sql",
90
+ }
91
+
92
+ TEXT_SUFFIXES = set(LANGUAGE_BY_SUFFIX) | {
93
+ ".txt",
94
+ ".ini",
95
+ ".cfg",
96
+ ".conf",
97
+ ".gitignore",
98
+ ".dockerignore",
99
+ }
100
+
101
+
102
+ def scan_project(
103
+ root: str | Path,
104
+ include: list[str] | None = None,
105
+ exclude: list[str] | None = None,
106
+ max_file_bytes: int = 50_000,
107
+ ) -> ScanResult:
108
+ root_path = Path(root).resolve()
109
+ exclude_patterns = exclude or []
110
+ include_patterns = include or []
111
+
112
+ files: list[ProjectFile] = []
113
+ dependency_files: list[ProjectFile] = []
114
+ tree_paths: list[str] = []
115
+
116
+ for path in sorted(root_path.rglob("*")):
117
+ rel = path.relative_to(root_path).as_posix()
118
+ if _is_excluded(path, rel, root_path, exclude_patterns):
119
+ continue
120
+ if path.is_dir():
121
+ tree_paths.append(rel + "/")
122
+ continue
123
+ if include_patterns and not _matches_any(rel, include_patterns):
124
+ continue
125
+ if not _is_text_file(path):
126
+ continue
127
+ if path.stat().st_size > max_file_bytes:
128
+ continue
129
+
130
+ project_file = ProjectFile(
131
+ relative_path=rel,
132
+ language=_language_for(path),
133
+ content=path.read_text(encoding="utf-8", errors="replace"),
134
+ )
135
+ files.append(project_file)
136
+ if path.name in DEPENDENCY_FILES:
137
+ dependency_files.append(project_file)
138
+ tree_paths.append(rel)
139
+
140
+ return ScanResult(
141
+ root=str(root_path),
142
+ tree=_render_tree(tree_paths),
143
+ files=files,
144
+ dependency_files=dependency_files,
145
+ git_diff=_git_diff(root_path),
146
+ )
147
+
148
+
149
+ def _is_excluded(path: Path, rel: str, root: Path, extra_patterns: list[str]) -> bool:
150
+ parts = set(path.relative_to(root).parts)
151
+ if parts & DEFAULT_EXCLUDED_DIRS:
152
+ return True
153
+ if path.name in DEFAULT_EXCLUDED_FILES:
154
+ return True
155
+ return _matches_any(rel, extra_patterns)
156
+
157
+
158
+ def _matches_any(rel: str, patterns: list[str]) -> bool:
159
+ path = Path(rel)
160
+ for pattern in patterns:
161
+ pattern = pattern.strip()
162
+ if not pattern:
163
+ continue
164
+ if fnmatch.fnmatch(rel, pattern) or path.match(pattern):
165
+ return True
166
+ if "**/" in pattern and fnmatch.fnmatch(rel, pattern.replace("**/", "")):
167
+ return True
168
+ return False
169
+
170
+
171
+ def _is_text_file(path: Path) -> bool:
172
+ if path.name in DEPENDENCY_FILES or path.name in {"README", "LICENSE", "Makefile"}:
173
+ return True
174
+ if path.suffix in TEXT_SUFFIXES:
175
+ return True
176
+ try:
177
+ chunk = path.read_bytes()[:1024]
178
+ except OSError:
179
+ return False
180
+ return b"\0" not in chunk and path.suffix == ""
181
+
182
+
183
+ def _language_for(path: Path) -> str:
184
+ if path.name == "Dockerfile":
185
+ return "dockerfile"
186
+ return LANGUAGE_BY_SUFFIX.get(path.suffix, "text")
187
+
188
+
189
+ def _render_tree(paths: list[str]) -> str:
190
+ return "\n".join(paths)
191
+
192
+
193
+ def _git_diff(root: Path) -> str:
194
+ try:
195
+ result = subprocess.run(
196
+ ["git", "diff", "--no-ext-diff"],
197
+ cwd=str(root),
198
+ text=True,
199
+ stdout=subprocess.PIPE,
200
+ stderr=subprocess.DEVNULL,
201
+ timeout=10,
202
+ check=False,
203
+ )
204
+ except (OSError, subprocess.TimeoutExpired):
205
+ return ""
206
+ return result.stdout.strip()
@@ -0,0 +1,9 @@
1
+ def estimate_tokens(text: str) -> int:
2
+ """Return a simple dependency-free token estimate.
3
+
4
+ Most English/code prompts average around 3-5 chars per token. We use 4 and
5
+ round up so the estimate is useful without requiring tiktoken.
6
+ """
7
+ if not text:
8
+ return 0
9
+ return (len(text) + 3) // 4
@@ -0,0 +1,127 @@
1
+ Metadata-Version: 2.4
2
+ Name: promptmint
3
+ Version: 0.1.0
4
+ Summary: Turn any codebase into an AI-ready prompt context pack.
5
+ Author: Asim Awdah
6
+ License: MIT
7
+ Keywords: ai,prompt,developer-tools,cli,codebase,context
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Topic :: Software Development
15
+ Requires-Python: >=3.10
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Dynamic: license-file
19
+
20
+ # PromptMint
21
+
22
+ Turn any codebase into an AI-ready prompt.
23
+
24
+ PromptMint scans your project, collects useful source files, dependency manifests, git diff, and optional error logs, then generates a clean Markdown context pack you can paste into ChatGPT, Claude, Gemini, or any coding agent.
25
+
26
+ ## Why?
27
+
28
+ Copying files into AI chats is slow and messy. PromptMint gives you one command that creates a structured, safe context file for debugging, code review, refactoring, and project explanation.
29
+
30
+ ## Install
31
+
32
+ ```bash
33
+ pip install promptmint
34
+ ```
35
+
36
+ ## Install locally for development
37
+
38
+ ```bash
39
+ git clone https://github.com/YOUR_USERNAME/promptmint.git
40
+ cd promptmint
41
+ python3 -m pip install -e .
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ```bash
47
+ promptmint -g "Fix this bug" -m debug
48
+ ```
49
+
50
+ ```bash
51
+ promptmint --goal "Review this PR" --mode review --output review-context.md
52
+ ```
53
+
54
+ ```bash
55
+ promptmint --goal "Explain this project" --mode explain
56
+ ```
57
+
58
+ ```bash
59
+ promptmint -e error.log -m debug -c
60
+ ```
61
+
62
+ ## CLI Shortcuts
63
+
64
+ - `-g`, `--goal`: task goal
65
+ - `-m`, `--mode`: prompt mode
66
+ - `-e`, `--error`: error log file
67
+ - `-i`, `--include`: include glob, repeatable
68
+ - `-x`, `--exclude`: exclude glob, repeatable
69
+ - `-o`, `--output`: output Markdown file
70
+ - `-c`, `--copy`: copy output to clipboard
71
+ - `-s`, `--max-file-bytes`: skip files larger than this size
72
+
73
+ ## Modes
74
+
75
+ - `debug`: root cause + smallest safe fix
76
+ - `review`: bugs, security, performance, maintainability
77
+ - `explain`: explain how the project works
78
+ - `refactor`: safe refactor plan
79
+
80
+ ## What it includes
81
+
82
+ - Project tree
83
+ - Dependency/manifest files like `package.json`, `pyproject.toml`, `composer.json`, `go.mod`, `pubspec.yaml`
84
+ - Git diff, if available
85
+ - Text source files
86
+ - Optional error log
87
+ - Final instruction tailored to the selected mode
88
+
89
+ ## What it ignores by default
90
+
91
+ - `.git`, `node_modules`, `vendor`, `dist`, `build`, virtual environments, caches
92
+ - `.env` files
93
+ - Binary files
94
+ - Large files over 50KB by default
95
+
96
+ ## Examples
97
+
98
+ ```bash
99
+ promptmint . --include "src/**/*.py" --goal "Find the bug"
100
+ ```
101
+
102
+ ```bash
103
+ promptmint . --exclude "tests/fixtures/**" --max-file-bytes 20000
104
+ ```
105
+
106
+ ## Development
107
+
108
+ ```bash
109
+ python3 -m unittest discover -s tests -v
110
+ ```
111
+
112
+ ## Roadmap
113
+
114
+ - [x] Markdown context pack generator
115
+ - [x] Project tree + file scanner
116
+ - [x] Dependency manifest detection
117
+ - [x] Git diff inclusion
118
+ - [x] Debug/review/explain/refactor modes
119
+ - [ ] Better `.gitignore` support
120
+ - [ ] Token budget smart trimming
121
+ - [ ] Interactive file picker
122
+ - [ ] JSON output
123
+ - [ ] MCP server integration
124
+
125
+ ## License
126
+
127
+ MIT
@@ -0,0 +1,18 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ promptmint/__init__.py
5
+ promptmint/cli.py
6
+ promptmint/models.py
7
+ promptmint/renderer.py
8
+ promptmint/scanner.py
9
+ promptmint/tokens.py
10
+ promptmint.egg-info/PKG-INFO
11
+ promptmint.egg-info/SOURCES.txt
12
+ promptmint.egg-info/dependency_links.txt
13
+ promptmint.egg-info/entry_points.txt
14
+ promptmint.egg-info/top_level.txt
15
+ tests/test_cli.py
16
+ tests/test_renderer.py
17
+ tests/test_scanner.py
18
+ tests/test_tokens.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ promptmint = promptmint.cli:main
@@ -0,0 +1 @@
1
+ promptmint
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "promptmint"
7
+ version = "0.1.0"
8
+ description = "Turn any codebase into an AI-ready prompt context pack."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = {text = "MIT"}
12
+ authors = [{name = "Asim Awdah"}]
13
+ keywords = ["ai", "prompt", "developer-tools", "cli", "codebase", "context"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Environment :: Console",
17
+ "Intended Audience :: Developers",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.10",
20
+ "Programming Language :: Python :: 3.11",
21
+ "Topic :: Software Development",
22
+ ]
23
+
24
+ [project.scripts]
25
+ promptmint = "promptmint.cli:main"
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["."]
29
+ include = ["promptmint*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,51 @@
1
+ import tempfile
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+ from promptmint.cli import main
6
+
7
+
8
+ class CliTest(unittest.TestCase):
9
+ def test_cli_creates_output_file_with_goal(self):
10
+ with tempfile.TemporaryDirectory() as tmp:
11
+ root = Path(tmp)
12
+ (root / "app.py").write_text("print('hello')\n", encoding="utf-8")
13
+ output = root / "context.md"
14
+
15
+ exit_code = main([str(root), "--goal", "Explain app", "--output", str(output)])
16
+
17
+ self.assertEqual(exit_code, 0)
18
+ text = output.read_text(encoding="utf-8")
19
+ self.assertIn("Explain app", text)
20
+ self.assertIn("app.py", text)
21
+
22
+ def test_cli_supports_short_options(self):
23
+ with tempfile.TemporaryDirectory() as tmp:
24
+ root = Path(tmp)
25
+ error = root / "error.log"
26
+ output = root / "short.md"
27
+ (root / "app.py").write_text("print('hello')\n", encoding="utf-8")
28
+ (root / "notes.md").write_text("# Notes\n", encoding="utf-8")
29
+ error.write_text("Traceback example\n", encoding="utf-8")
30
+
31
+ exit_code = main([
32
+ str(root),
33
+ "-g", "Fix bug",
34
+ "-m", "debug",
35
+ "-e", str(error),
36
+ "-i", "app.py",
37
+ "-x", "notes.md",
38
+ "-o", str(output),
39
+ "-s", "1000",
40
+ ])
41
+
42
+ self.assertEqual(exit_code, 0)
43
+ text = output.read_text(encoding="utf-8")
44
+ self.assertIn("Fix bug", text)
45
+ self.assertIn("Traceback example", text)
46
+ self.assertIn("app.py", text)
47
+ self.assertNotIn("notes.md", text)
48
+
49
+
50
+ if __name__ == "__main__":
51
+ unittest.main()
@@ -0,0 +1,30 @@
1
+ import unittest
2
+
3
+ from promptmint.models import ProjectFile, ScanResult
4
+ from promptmint.renderer import render_context_pack
5
+
6
+
7
+ class RenderContextPackTest(unittest.TestCase):
8
+ def test_render_context_pack_contains_goal_mode_tree_files_diff_and_error(self):
9
+ scan = ScanResult(
10
+ root="/project",
11
+ tree="src/\n app.py",
12
+ files=[ProjectFile(relative_path="src/app.py", language="python", content="print('hello')\n")],
13
+ dependency_files=[ProjectFile(relative_path="pyproject.toml", language="toml", content="[project]\n")],
14
+ git_diff="diff --git a/src/app.py b/src/app.py\n",
15
+ )
16
+
17
+ output = render_context_pack(scan, goal="Fix bug", mode="debug", error_log="Traceback here")
18
+
19
+ self.assertIn("# Project Context Pack", output)
20
+ self.assertIn("Fix bug", output)
21
+ self.assertIn("Debug Request", output)
22
+ self.assertIn("src/app.py", output)
23
+ self.assertIn("```python", output)
24
+ self.assertIn("pyproject.toml", output)
25
+ self.assertIn("diff --git", output)
26
+ self.assertIn("Traceback here", output)
27
+
28
+
29
+ if __name__ == "__main__":
30
+ unittest.main()
@@ -0,0 +1,46 @@
1
+ import tempfile
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+ from promptmint.scanner import scan_project
6
+
7
+
8
+ class ScanProjectTest(unittest.TestCase):
9
+ def test_scan_project_includes_source_and_manifest_but_excludes_secrets_and_vendor(self):
10
+ with tempfile.TemporaryDirectory() as tmp:
11
+ root = Path(tmp)
12
+ (root / "src").mkdir()
13
+ (root / "node_modules").mkdir()
14
+ (root / ".git").mkdir()
15
+ (root / "src" / "app.py").write_text("print('hello')\n", encoding="utf-8")
16
+ (root / "package.json").write_text('{"scripts":{"test":"echo ok"}}\n', encoding="utf-8")
17
+ (root / ".env").write_text("TOKEN=secret\n", encoding="utf-8")
18
+ (root / "node_modules" / "lib.js").write_text("ignored\n", encoding="utf-8")
19
+ (root / "image.png").write_bytes(b"\x89PNG\x00\x01")
20
+
21
+ result = scan_project(root)
22
+ paths = [f.relative_path for f in result.files]
23
+
24
+ self.assertIn("src/app.py", paths)
25
+ self.assertIn("package.json", paths)
26
+ self.assertNotIn(".env", paths)
27
+ self.assertNotIn("node_modules/lib.js", paths)
28
+ self.assertNotIn("image.png", paths)
29
+ self.assertIn("src/", result.tree)
30
+
31
+ def test_scan_project_respects_include_globs(self):
32
+ with tempfile.TemporaryDirectory() as tmp:
33
+ root = Path(tmp)
34
+ (root / "src").mkdir()
35
+ (root / "docs").mkdir()
36
+ (root / "src" / "app.py").write_text("print('hello')\n", encoding="utf-8")
37
+ (root / "docs" / "guide.md").write_text("# Guide\n", encoding="utf-8")
38
+
39
+ result = scan_project(root, include=["docs/**/*.md"])
40
+ paths = [f.relative_path for f in result.files]
41
+
42
+ self.assertEqual(paths, ["docs/guide.md"])
43
+
44
+
45
+ if __name__ == "__main__":
46
+ unittest.main()
@@ -0,0 +1,14 @@
1
+ import unittest
2
+
3
+ from promptmint.tokens import estimate_tokens
4
+
5
+
6
+ class EstimateTokensTest(unittest.TestCase):
7
+ def test_estimate_tokens_is_roughly_one_token_per_four_characters_minimum_one(self):
8
+ self.assertEqual(estimate_tokens(""), 0)
9
+ self.assertEqual(estimate_tokens("abcd"), 1)
10
+ self.assertEqual(estimate_tokens("abcde"), 2)
11
+
12
+
13
+ if __name__ == "__main__":
14
+ unittest.main()