Skip to content

Commit 5727803

Browse files
committed
adding features
1 parent c650269 commit 5727803

5 files changed

Lines changed: 708 additions & 110 deletions

File tree

README.md

Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ This unified "context" is perfect for providing to a Large Language Model (LLM)
88

99
- **Project Structure**: Generates a tree view of the folder and file structure.
1010
- **Smart Filtering**: Automatically ignores common unnecessary directories (e.g., `.git`, `venv`, `node_modules`).
11+
- **Token Optimization (TOON)**: Capable of generating "Semantic Skeletons" (class definitions, function signatures, docstrings) instead of full code to save up to 90% of tokens.
12+
- **Hybrid Focus Mode**: Combine lightweight context for the whole project with full content only for specific files or folders.
1113
- **Configurable**: Customize ignored directories and included extensions via a `.deepbase.toml` file.
12-
- **Extension Selection**: Includes only files with relevant code or configuration extensions.
1314
- **Unified Output**: Combines everything into a single file, easy to copy and paste.
1415
- **PyPI Ready**: Easy to install via `pip`.
1516

@@ -19,111 +20,106 @@ You can install DeepBase directly from PyPI:
1920

2021
```sh
2122
pip install deepbase
22-
2323
```
2424

2525
## How to Use
2626

27-
Once installed, you will have the `deepbase` command available in your terminal.
27+
Once installed, use the `deepbase` command followed by the target (directory or file).
2828

29-
**Basic Usage:**
29+
### 1. Basic Project Analysis
3030

31-
Navigate to your project folder (or a parent folder) and run:
31+
**Structure Only (Default)**
32+
Quickly generate a tree view of your project folders and files. No code content is included.
3233

3334
```sh
3435
deepbase .
3536
```
36-
*The dot `.` indicates the current directory.*
3737

38-
This command will create a file called `llm_context.md` in the current directory.
38+
**Include All Content**
39+
To generate the full context including the code of all significant files, use the `--all` (or `-a`) flag.
40+
*Warning: use this only for small projects.*
41+
42+
```sh
43+
deepbase . --all
44+
```
45+
46+
### 2. Smart Token Optimization (TOON)
3947

40-
**Specify Directory and Output File:**
48+
For large projects, sending all code to an LLM is expensive and inefficient. **TOON (Token Oriented Object Notation)** extracts only the semantic "skeleton" of your code (classes, signatures, docstrings), ignoring implementations.
4149

4250
```sh
43-
deepbase /path/to/your/project -o project_context.txt
51+
deepbase . --toon
52+
# or
53+
deepbase . -t
4454
```
55+
*Result: LLMs understand your architecture using minimal tokens.*
4556

46-
### Advanced Configuration
57+
### 3. Hybrid Mode (Focus)
4758

48-
You can customize DeepBase's behavior by creating a `.deepbase.toml` file in the root of the project you are analyzing.
59+
This is the power user feature. You can provide the TOON skeleton for the entire project (background context) while focusing on specific files (full content).
4960

50-
**Example `.deepbase.toml`:**
51-
```toml
52-
# Add more directories to ignore.
53-
# These will be added to the default ones.
54-
ignore_dirs = [
55-
"my_assets_folder",
56-
"experimental"
57-
]
58-
59-
# Add more extensions or filenames to include.
60-
significant_extensions = [
61-
".cfg",
62-
"Makefile"
63-
]
61+
**Focus via CLI:**
62+
Use `-f` or `--focus` with glob patterns (e.g., `*auth*`, `src/utils/*`).
63+
64+
```sh
65+
deepbase . --toon --focus "server/controllers/*" --focus "client/src/login.js"
66+
```
67+
68+
**Focus via File:**
69+
Instead of typing patterns every time, create a text file (e.g., `context_task.txt`) with the list of files/folders you are working on.
70+
71+
*content of `context_task.txt`:*
72+
```text
73+
server/routes/auth.js
74+
server/models/User.js
75+
client/src/components/LoginForm.jsx
6476
```
6577

66-
### Single File Analysis (New!)
78+
Run deepbase loading the file:
79+
```sh
80+
deepbase . --toon --focus-file context_task.txt
81+
```
82+
83+
### 4. Single File Analysis
6784

6885
DeepBase supports analyzing a single specific file.
6986

70-
**1. Structure Only (Default)**
71-
By default, providing a single file will extract only its outline/structure (headers). This is useful for quickly understanding the organization of a large document without reading everything.
87+
**Structure Only (Default)**
88+
Extracts only the outline/headers. Useful for large documentation files.
7289

7390
```sh
7491
deepbase README.md
75-
# Generates "llm_context.md" containing only the headers tree.
7692
```
7793

78-
**2. Structure + Content**
79-
If you want both the structure outline AND the full file content appended at the end, use the `--all` (or `-a`) flag.
94+
**Structure + Content**
95+
Appends the full content after the structure.
8096

8197
```sh
8298
deepbase README.md --all
83-
# Generates "llm_context.md" containing the outline followed by the full text.
8499
```
85100

86-
*Currently optimized for Markdown files.*
101+
### Configuration (.deepbase.toml)
87102

103+
You can customize behavior by creating a `.deepbase.toml` file in your project root:
88104

89-
## Development Workflow
105+
```toml
106+
ignore_dirs = ["my_assets", "experimental"]
107+
significant_extensions = [".cfg", "Makefile", ".tsx"]
108+
```
90109

91-
If you want to contribute or test the tool locally, follow these steps.
110+
## Development Workflow
92111

93-
### 1. Local Setup & Testing
94-
Clones the repo and installs the package in "editable" mode with development dependencies.
112+
If you want to contribute or test the tool locally:
95113

96114
```sh
97115
# Install in editable mode
98116
pip install -e ".[dev]"
99117

100118
# Run tests
101119
pytest
102-
103-
# Test the tool locally without reinstalling
104-
# You can now use the 'deepbase' command directly and it reflects your code changes immediately.
105-
deepbase ./README.md
106120
```
107121

108-
### 2. Release Process
109-
To create a new release (which triggers the PyPI deployment pipeline):
110-
111-
1. **Update Version**: Bump the version number in `pyproject.toml` (e.g., `1.2.0` -> `1.3.0`).
112-
2. **Commit & Push**:
113-
```sh
114-
git add pyproject.toml
115-
git commit -m "Bump version to 1.3.0"
116-
git push origin main
117-
```
118-
3. **Create a Tag**: This usually triggers the CI/CD pipeline.
119-
```sh
120-
git tag v1.3.0
121-
git push origin v1.3.0
122-
```
123-
4. **GitHub Release**: Go to GitHub releases page and draft a new release from the tag.
124-
125-
*Currently optimized for Markdown files. Support for `.docx` and `.tex` structure extraction is coming soon.*
126-
127122
## License
128123

129-
This project is released under the GPL 3 license. See the `LICENSE` file for details.
124+
This project is released under the GPL 3 license. See the `LICENSE` file for details.
125+
```

context_dirs.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# tests
2+
tests/

0 commit comments

Comments
 (0)