askmycode 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.
- askmycode-0.1.0/.askmycode.toml +12 -0
- askmycode-0.1.0/.claude/settings.local.json +7 -0
- askmycode-0.1.0/.github/workflows/askmycode.yml +77 -0
- askmycode-0.1.0/.gitignore +15 -0
- askmycode-0.1.0/PKG-INFO +287 -0
- askmycode-0.1.0/README.md +260 -0
- askmycode-0.1.0/askmycode/__init__.py +1 -0
- askmycode-0.1.0/askmycode/cli.py +324 -0
- askmycode-0.1.0/askmycode/config.py +56 -0
- askmycode-0.1.0/askmycode/embedder.py +26 -0
- askmycode-0.1.0/askmycode/indexer.py +180 -0
- askmycode-0.1.0/askmycode/llm.py +177 -0
- askmycode-0.1.0/askmycode/manifest.py +34 -0
- askmycode-0.1.0/askmycode/project_config.py +33 -0
- askmycode-0.1.0/askmycode/reranker.py +28 -0
- askmycode-0.1.0/askmycode/retriever.py +35 -0
- askmycode-0.1.0/askmycode/store.py +54 -0
- askmycode-0.1.0/demo.gif +0 -0
- askmycode-0.1.0/demo.tape +44 -0
- askmycode-0.1.0/pyproject.toml +39 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# askmycode project configuration
|
|
2
|
+
# Commit this file to share settings with your team.
|
|
3
|
+
|
|
4
|
+
[askmycode]
|
|
5
|
+
# LLM provider: gemini (default), openai, anthropic, ollama
|
|
6
|
+
# provider = "gemini"
|
|
7
|
+
|
|
8
|
+
# Model override (leave blank for provider default)
|
|
9
|
+
# model = "gemini-2.5-flash-lite"
|
|
10
|
+
|
|
11
|
+
# Number of code chunks retrieved per question (default: 8)
|
|
12
|
+
# n_results = 8
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: askmycode — Answer PR questions
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
answer:
|
|
9
|
+
# Trigger only on PR comments that start with /ask
|
|
10
|
+
if: >
|
|
11
|
+
github.event.issue.pull_request != null &&
|
|
12
|
+
startsWith(github.event.comment.body, '/ask ')
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
pull-requests: write
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- name: Checkout PR branch
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
ref: ${{ github.event.pull_request.head.sha }}
|
|
23
|
+
fetch-depth: 0
|
|
24
|
+
|
|
25
|
+
- name: Set up Python
|
|
26
|
+
uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.11"
|
|
29
|
+
|
|
30
|
+
- name: Install askmycode
|
|
31
|
+
run: pip install askmycode
|
|
32
|
+
|
|
33
|
+
- name: Index codebase
|
|
34
|
+
env:
|
|
35
|
+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
|
36
|
+
run: askmycode index .
|
|
37
|
+
|
|
38
|
+
- name: Extract question from comment
|
|
39
|
+
id: question
|
|
40
|
+
run: |
|
|
41
|
+
COMMENT="${{ github.event.comment.body }}"
|
|
42
|
+
QUESTION="${COMMENT#/ask }"
|
|
43
|
+
echo "question=$QUESTION" >> "$GITHUB_OUTPUT"
|
|
44
|
+
|
|
45
|
+
- name: Ask question
|
|
46
|
+
id: answer
|
|
47
|
+
env:
|
|
48
|
+
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
|
|
49
|
+
run: |
|
|
50
|
+
ANSWER=$(askmycode ask "${{ steps.question.outputs.question }}" --sources)
|
|
51
|
+
# Store multi-line output safely
|
|
52
|
+
{
|
|
53
|
+
echo "answer<<EOF"
|
|
54
|
+
echo "$ANSWER"
|
|
55
|
+
echo "EOF"
|
|
56
|
+
} >> "$GITHUB_OUTPUT"
|
|
57
|
+
|
|
58
|
+
- name: Post answer as PR comment
|
|
59
|
+
uses: actions/github-script@v7
|
|
60
|
+
with:
|
|
61
|
+
script: |
|
|
62
|
+
const question = `${{ steps.question.outputs.question }}`;
|
|
63
|
+
const answer = `${{ steps.answer.outputs.answer }}`;
|
|
64
|
+
const body = [
|
|
65
|
+
`**Q: ${question}**`,
|
|
66
|
+
"",
|
|
67
|
+
answer,
|
|
68
|
+
"",
|
|
69
|
+
"_— answered by [askmycode](https://github.com/NewtYao/askmycode)_"
|
|
70
|
+
].join("\n");
|
|
71
|
+
|
|
72
|
+
await github.rest.issues.createComment({
|
|
73
|
+
owner: context.repo.owner,
|
|
74
|
+
repo: context.repo.repo,
|
|
75
|
+
issue_number: context.issue.number,
|
|
76
|
+
body
|
|
77
|
+
});
|
askmycode-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: askmycode
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Ask questions about any codebase using AI — your code stays private
|
|
5
|
+
Project-URL: Homepage, https://github.com/NewtYao/askmycode
|
|
6
|
+
Project-URL: Issues, https://github.com/NewtYao/askmycode/issues
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: ai,cli,codebase,developer-tools,embeddings,qa,rag
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Requires-Dist: chromadb>=0.5.0
|
|
20
|
+
Requires-Dist: google-genai>=2.0.0
|
|
21
|
+
Requires-Dist: pathspec>=0.12.0
|
|
22
|
+
Requires-Dist: rich>=13.0.0
|
|
23
|
+
Requires-Dist: sentence-transformers>=3.0.0
|
|
24
|
+
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
|
|
25
|
+
Requires-Dist: typer>=0.12.0
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# askmycode
|
|
29
|
+
|
|
30
|
+
**Ask questions about any codebase in plain English. Your code never leaves your machine.**
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
$ askmycode ask "how does authentication work?"
|
|
34
|
+
|
|
35
|
+
Authentication is handled in src/auth/middleware.py (lines 12–45).
|
|
36
|
+
The require_auth decorator validates a JWT from the Authorization header,
|
|
37
|
+
looks up the user in the session store (Redis), and attaches the user object
|
|
38
|
+
to the request context. Unauthenticated requests are rejected with a 401...
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
[](https://pypi.org/project/askmycode/)
|
|
44
|
+
[](https://www.python.org/)
|
|
45
|
+
[](LICENSE)
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Why askmycode?
|
|
50
|
+
|
|
51
|
+
Most AI coding tools send your entire codebase to a remote server. **askmycode doesn't.**
|
|
52
|
+
|
|
53
|
+
- **Your code stays local.** Only the question + a few relevant snippets reach the AI.
|
|
54
|
+
- **Works on any codebase** — Python, Go, TypeScript, Rust, Java, and more.
|
|
55
|
+
- **No more grepping.** Ask "where is the rate limiter?" instead of `grep -r "rate" .`
|
|
56
|
+
- **Onboarding superpower.** New to a repo? Ask questions instead of reading every file.
|
|
57
|
+
- **Multi-provider.** Gemini (free tier), OpenAI, Claude, or fully offline via Ollama.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## How it works
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
Your code ──► chunked locally ──► embedded locally ──► stored in local vector DB
|
|
65
|
+
│
|
|
66
|
+
Your question ──► embed locally ──► find top chunks ──► send to AI ──► Answer
|
|
67
|
+
↑
|
|
68
|
+
only ~500 lines of relevant code
|
|
69
|
+
travel to the AI, not your whole repo
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Embeddings run on your machine via `sentence-transformers`. Only the retrieved snippets and your question are sent to the LLM.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Install
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install askmycode
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Or from source:
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/NewtYao/askmycode
|
|
85
|
+
cd askmycode
|
|
86
|
+
pip install -e .
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Quick start
|
|
92
|
+
|
|
93
|
+
**1. Set your API key**
|
|
94
|
+
```bash
|
|
95
|
+
askmycode config set-key YOUR_GEMINI_KEY # get a free key at aistudio.google.com
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**2. Initialise your project** *(optional — sets up .gitignore and suggests starter questions)*
|
|
99
|
+
```bash
|
|
100
|
+
cd your-project/
|
|
101
|
+
askmycode init .
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**3. Index your codebase** *(run once; re-run after big changes)*
|
|
105
|
+
```bash
|
|
106
|
+
askmycode index .
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**4. Ask questions**
|
|
110
|
+
```bash
|
|
111
|
+
askmycode ask "where is the database connection configured?"
|
|
112
|
+
askmycode ask "how does the retry logic work?"
|
|
113
|
+
askmycode ask "what does UserService do?"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Commands
|
|
119
|
+
|
|
120
|
+
### `askmycode ask`
|
|
121
|
+
```bash
|
|
122
|
+
askmycode ask "your question"
|
|
123
|
+
--sources, -s Show which files and lines were used to answer
|
|
124
|
+
--results, -n INT Chunks to retrieve (default: 8)
|
|
125
|
+
--provider TEXT gemini | openai | anthropic | ollama
|
|
126
|
+
--model TEXT Model name override
|
|
127
|
+
--project, -p PATH Path to indexed project (default: .)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Show sources alongside the answer
|
|
132
|
+
askmycode ask "how is caching implemented?" --sources
|
|
133
|
+
|
|
134
|
+
# Use a different provider for one question
|
|
135
|
+
askmycode ask "what does this codebase do?" --provider openai
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### `askmycode chat`
|
|
139
|
+
Multi-turn conversation — follow-up questions remember previous answers.
|
|
140
|
+
```bash
|
|
141
|
+
askmycode chat
|
|
142
|
+
|
|
143
|
+
You: how does auth work?
|
|
144
|
+
Assistant: ...
|
|
145
|
+
|
|
146
|
+
You: what about the refresh token flow? # remembers the previous answer
|
|
147
|
+
Assistant: ...
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### `askmycode index`
|
|
151
|
+
```bash
|
|
152
|
+
askmycode index . # index current directory
|
|
153
|
+
askmycode index /path/to/project # index a specific path
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Re-indexing is **incremental** — only changed files are re-embedded.
|
|
157
|
+
|
|
158
|
+
### `askmycode stats`
|
|
159
|
+
```bash
|
|
160
|
+
askmycode stats
|
|
161
|
+
|
|
162
|
+
Files indexed: 42
|
|
163
|
+
Total chunks: 187
|
|
164
|
+
Last indexed: 2026-05-23 14:30:01
|
|
165
|
+
Index location: /your/project/.askmycode
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### `askmycode init`
|
|
169
|
+
```bash
|
|
170
|
+
askmycode init .
|
|
171
|
+
```
|
|
172
|
+
Detects your project type (Python, Go, Node, Rust...), adds `.askmycode/` to `.gitignore`, and prints suggested first questions.
|
|
173
|
+
|
|
174
|
+
### `askmycode config`
|
|
175
|
+
```bash
|
|
176
|
+
askmycode config set-key YOUR_API_KEY
|
|
177
|
+
askmycode config set-provider gemini # gemini | openai | anthropic | ollama
|
|
178
|
+
askmycode config set-model gpt-4o # optional model override
|
|
179
|
+
askmycode config show
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Multiple providers
|
|
185
|
+
|
|
186
|
+
| Provider | Command | Notes |
|
|
187
|
+
|---|---|---|
|
|
188
|
+
| **Gemini** (default) | `config set-provider gemini` | Free tier at aistudio.google.com |
|
|
189
|
+
| **OpenAI** | `config set-provider openai` | Requires `OPENAI_API_KEY` |
|
|
190
|
+
| **Claude** | `config set-provider anthropic` | Requires `ANTHROPIC_API_KEY` |
|
|
191
|
+
| **Ollama** | `config set-provider ollama` | 100% offline, no API key |
|
|
192
|
+
|
|
193
|
+
### Fully offline with Ollama
|
|
194
|
+
```bash
|
|
195
|
+
# 1. Install Ollama: https://ollama.com
|
|
196
|
+
# 2. Pull a model
|
|
197
|
+
ollama pull llama3
|
|
198
|
+
|
|
199
|
+
# 3. Use it
|
|
200
|
+
askmycode config set-provider ollama
|
|
201
|
+
askmycode config set-model llama3
|
|
202
|
+
askmycode ask "how does this work?" # zero internet required
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Per-project config
|
|
208
|
+
|
|
209
|
+
Commit an `.askmycode.toml` to share settings with your team:
|
|
210
|
+
|
|
211
|
+
```toml
|
|
212
|
+
[askmycode]
|
|
213
|
+
provider = "gemini"
|
|
214
|
+
model = "gemini-2.5-flash-lite"
|
|
215
|
+
n_results = 10
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## GitHub Action
|
|
221
|
+
|
|
222
|
+
Add AI-powered Q&A directly to your pull requests. Team members comment `/ask <question>` and get an instant answer.
|
|
223
|
+
|
|
224
|
+
**Setup:**
|
|
225
|
+
1. Add your API key as a repository secret: `GEMINI_API_KEY`
|
|
226
|
+
2. Create `.github/workflows/askmycode.yml` (see [example](.github/workflows/askmycode.yml))
|
|
227
|
+
|
|
228
|
+
**Usage in a PR:**
|
|
229
|
+
```
|
|
230
|
+
/ask where is error handling for the payment flow?
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The bot replies with the answer + source file references, inline in the PR.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Privacy
|
|
238
|
+
|
|
239
|
+
| What happens | Where it goes |
|
|
240
|
+
|---|---|
|
|
241
|
+
| Your full codebase | **Stays on your machine** |
|
|
242
|
+
| Embeddings (vector index) | **Stored in `.askmycode/` in your project** |
|
|
243
|
+
| Your question + ~500 lines of relevant code | Sent to the LLM API |
|
|
244
|
+
|
|
245
|
+
Use `--provider ollama` for zero data leaving your machine.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Supported file types
|
|
250
|
+
|
|
251
|
+
Python · JavaScript · TypeScript · Go · Rust · Java · C/C++ · Ruby · PHP · Swift · Kotlin · Scala · Shell · SQL · YAML · JSON · TOML · Markdown · HTML · CSS · Vue · Svelte
|
|
252
|
+
|
|
253
|
+
Python files are chunked at **function and class boundaries** using AST parsing, giving higher-quality retrieval than fixed-size splitting.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## How retrieval works (technical)
|
|
258
|
+
|
|
259
|
+
1. **Index:** Files are chunked (AST-aware for Python, sliding window for others), embedded with `all-MiniLM-L6-v2`, and stored in a local ChromaDB.
|
|
260
|
+
2. **Query:** Your question is embedded. The top `n × 3` candidates are fetched by cosine similarity, then re-ranked with a cross-encoder (`ms-marco-MiniLM-L-6-v2`) for higher precision.
|
|
261
|
+
3. **Answer:** The top N chunks + a project file tree are sent to the LLM with a developer-focused system prompt. The answer streams back in real time.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Roadmap
|
|
266
|
+
|
|
267
|
+
- [ ] VS Code extension
|
|
268
|
+
- [ ] Watch mode (auto re-index on file save)
|
|
269
|
+
- [ ] Semantic diff Q&A (`askmycode ask` about uncommitted changes)
|
|
270
|
+
- [ ] Kotlin / Swift AST chunking
|
|
271
|
+
- [ ] Web UI
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Contributing
|
|
276
|
+
|
|
277
|
+
PRs welcome. Run the tool against itself to test:
|
|
278
|
+
```bash
|
|
279
|
+
askmycode index .
|
|
280
|
+
askmycode ask "how does the indexer work?"
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## License
|
|
286
|
+
|
|
287
|
+
MIT
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
# askmycode
|
|
2
|
+
|
|
3
|
+
**Ask questions about any codebase in plain English. Your code never leaves your machine.**
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
$ askmycode ask "how does authentication work?"
|
|
7
|
+
|
|
8
|
+
Authentication is handled in src/auth/middleware.py (lines 12–45).
|
|
9
|
+
The require_auth decorator validates a JWT from the Authorization header,
|
|
10
|
+
looks up the user in the session store (Redis), and attaches the user object
|
|
11
|
+
to the request context. Unauthenticated requests are rejected with a 401...
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
[](https://pypi.org/project/askmycode/)
|
|
17
|
+
[](https://www.python.org/)
|
|
18
|
+
[](LICENSE)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Why askmycode?
|
|
23
|
+
|
|
24
|
+
Most AI coding tools send your entire codebase to a remote server. **askmycode doesn't.**
|
|
25
|
+
|
|
26
|
+
- **Your code stays local.** Only the question + a few relevant snippets reach the AI.
|
|
27
|
+
- **Works on any codebase** — Python, Go, TypeScript, Rust, Java, and more.
|
|
28
|
+
- **No more grepping.** Ask "where is the rate limiter?" instead of `grep -r "rate" .`
|
|
29
|
+
- **Onboarding superpower.** New to a repo? Ask questions instead of reading every file.
|
|
30
|
+
- **Multi-provider.** Gemini (free tier), OpenAI, Claude, or fully offline via Ollama.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## How it works
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Your code ──► chunked locally ──► embedded locally ──► stored in local vector DB
|
|
38
|
+
│
|
|
39
|
+
Your question ──► embed locally ──► find top chunks ──► send to AI ──► Answer
|
|
40
|
+
↑
|
|
41
|
+
only ~500 lines of relevant code
|
|
42
|
+
travel to the AI, not your whole repo
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Embeddings run on your machine via `sentence-transformers`. Only the retrieved snippets and your question are sent to the LLM.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install askmycode
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Or from source:
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/NewtYao/askmycode
|
|
58
|
+
cd askmycode
|
|
59
|
+
pip install -e .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Quick start
|
|
65
|
+
|
|
66
|
+
**1. Set your API key**
|
|
67
|
+
```bash
|
|
68
|
+
askmycode config set-key YOUR_GEMINI_KEY # get a free key at aistudio.google.com
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**2. Initialise your project** *(optional — sets up .gitignore and suggests starter questions)*
|
|
72
|
+
```bash
|
|
73
|
+
cd your-project/
|
|
74
|
+
askmycode init .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**3. Index your codebase** *(run once; re-run after big changes)*
|
|
78
|
+
```bash
|
|
79
|
+
askmycode index .
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**4. Ask questions**
|
|
83
|
+
```bash
|
|
84
|
+
askmycode ask "where is the database connection configured?"
|
|
85
|
+
askmycode ask "how does the retry logic work?"
|
|
86
|
+
askmycode ask "what does UserService do?"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Commands
|
|
92
|
+
|
|
93
|
+
### `askmycode ask`
|
|
94
|
+
```bash
|
|
95
|
+
askmycode ask "your question"
|
|
96
|
+
--sources, -s Show which files and lines were used to answer
|
|
97
|
+
--results, -n INT Chunks to retrieve (default: 8)
|
|
98
|
+
--provider TEXT gemini | openai | anthropic | ollama
|
|
99
|
+
--model TEXT Model name override
|
|
100
|
+
--project, -p PATH Path to indexed project (default: .)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Show sources alongside the answer
|
|
105
|
+
askmycode ask "how is caching implemented?" --sources
|
|
106
|
+
|
|
107
|
+
# Use a different provider for one question
|
|
108
|
+
askmycode ask "what does this codebase do?" --provider openai
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### `askmycode chat`
|
|
112
|
+
Multi-turn conversation — follow-up questions remember previous answers.
|
|
113
|
+
```bash
|
|
114
|
+
askmycode chat
|
|
115
|
+
|
|
116
|
+
You: how does auth work?
|
|
117
|
+
Assistant: ...
|
|
118
|
+
|
|
119
|
+
You: what about the refresh token flow? # remembers the previous answer
|
|
120
|
+
Assistant: ...
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### `askmycode index`
|
|
124
|
+
```bash
|
|
125
|
+
askmycode index . # index current directory
|
|
126
|
+
askmycode index /path/to/project # index a specific path
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Re-indexing is **incremental** — only changed files are re-embedded.
|
|
130
|
+
|
|
131
|
+
### `askmycode stats`
|
|
132
|
+
```bash
|
|
133
|
+
askmycode stats
|
|
134
|
+
|
|
135
|
+
Files indexed: 42
|
|
136
|
+
Total chunks: 187
|
|
137
|
+
Last indexed: 2026-05-23 14:30:01
|
|
138
|
+
Index location: /your/project/.askmycode
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### `askmycode init`
|
|
142
|
+
```bash
|
|
143
|
+
askmycode init .
|
|
144
|
+
```
|
|
145
|
+
Detects your project type (Python, Go, Node, Rust...), adds `.askmycode/` to `.gitignore`, and prints suggested first questions.
|
|
146
|
+
|
|
147
|
+
### `askmycode config`
|
|
148
|
+
```bash
|
|
149
|
+
askmycode config set-key YOUR_API_KEY
|
|
150
|
+
askmycode config set-provider gemini # gemini | openai | anthropic | ollama
|
|
151
|
+
askmycode config set-model gpt-4o # optional model override
|
|
152
|
+
askmycode config show
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Multiple providers
|
|
158
|
+
|
|
159
|
+
| Provider | Command | Notes |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| **Gemini** (default) | `config set-provider gemini` | Free tier at aistudio.google.com |
|
|
162
|
+
| **OpenAI** | `config set-provider openai` | Requires `OPENAI_API_KEY` |
|
|
163
|
+
| **Claude** | `config set-provider anthropic` | Requires `ANTHROPIC_API_KEY` |
|
|
164
|
+
| **Ollama** | `config set-provider ollama` | 100% offline, no API key |
|
|
165
|
+
|
|
166
|
+
### Fully offline with Ollama
|
|
167
|
+
```bash
|
|
168
|
+
# 1. Install Ollama: https://ollama.com
|
|
169
|
+
# 2. Pull a model
|
|
170
|
+
ollama pull llama3
|
|
171
|
+
|
|
172
|
+
# 3. Use it
|
|
173
|
+
askmycode config set-provider ollama
|
|
174
|
+
askmycode config set-model llama3
|
|
175
|
+
askmycode ask "how does this work?" # zero internet required
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Per-project config
|
|
181
|
+
|
|
182
|
+
Commit an `.askmycode.toml` to share settings with your team:
|
|
183
|
+
|
|
184
|
+
```toml
|
|
185
|
+
[askmycode]
|
|
186
|
+
provider = "gemini"
|
|
187
|
+
model = "gemini-2.5-flash-lite"
|
|
188
|
+
n_results = 10
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## GitHub Action
|
|
194
|
+
|
|
195
|
+
Add AI-powered Q&A directly to your pull requests. Team members comment `/ask <question>` and get an instant answer.
|
|
196
|
+
|
|
197
|
+
**Setup:**
|
|
198
|
+
1. Add your API key as a repository secret: `GEMINI_API_KEY`
|
|
199
|
+
2. Create `.github/workflows/askmycode.yml` (see [example](.github/workflows/askmycode.yml))
|
|
200
|
+
|
|
201
|
+
**Usage in a PR:**
|
|
202
|
+
```
|
|
203
|
+
/ask where is error handling for the payment flow?
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The bot replies with the answer + source file references, inline in the PR.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Privacy
|
|
211
|
+
|
|
212
|
+
| What happens | Where it goes |
|
|
213
|
+
|---|---|
|
|
214
|
+
| Your full codebase | **Stays on your machine** |
|
|
215
|
+
| Embeddings (vector index) | **Stored in `.askmycode/` in your project** |
|
|
216
|
+
| Your question + ~500 lines of relevant code | Sent to the LLM API |
|
|
217
|
+
|
|
218
|
+
Use `--provider ollama` for zero data leaving your machine.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Supported file types
|
|
223
|
+
|
|
224
|
+
Python · JavaScript · TypeScript · Go · Rust · Java · C/C++ · Ruby · PHP · Swift · Kotlin · Scala · Shell · SQL · YAML · JSON · TOML · Markdown · HTML · CSS · Vue · Svelte
|
|
225
|
+
|
|
226
|
+
Python files are chunked at **function and class boundaries** using AST parsing, giving higher-quality retrieval than fixed-size splitting.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## How retrieval works (technical)
|
|
231
|
+
|
|
232
|
+
1. **Index:** Files are chunked (AST-aware for Python, sliding window for others), embedded with `all-MiniLM-L6-v2`, and stored in a local ChromaDB.
|
|
233
|
+
2. **Query:** Your question is embedded. The top `n × 3` candidates are fetched by cosine similarity, then re-ranked with a cross-encoder (`ms-marco-MiniLM-L-6-v2`) for higher precision.
|
|
234
|
+
3. **Answer:** The top N chunks + a project file tree are sent to the LLM with a developer-focused system prompt. The answer streams back in real time.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Roadmap
|
|
239
|
+
|
|
240
|
+
- [ ] VS Code extension
|
|
241
|
+
- [ ] Watch mode (auto re-index on file save)
|
|
242
|
+
- [ ] Semantic diff Q&A (`askmycode ask` about uncommitted changes)
|
|
243
|
+
- [ ] Kotlin / Swift AST chunking
|
|
244
|
+
- [ ] Web UI
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Contributing
|
|
249
|
+
|
|
250
|
+
PRs welcome. Run the tool against itself to test:
|
|
251
|
+
```bash
|
|
252
|
+
askmycode index .
|
|
253
|
+
askmycode ask "how does the indexer work?"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## License
|
|
259
|
+
|
|
260
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|