@fentech/gitcontext 0.3.3 → 0.5.0
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.
- package/README.md +392 -0
- package/dist/index.js +1141 -41
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
# @fentech/gitcontext
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@fentech/gitcontext)
|
|
4
|
+
|
|
5
|
+
AI-assisted knowledge capture for developer teams — turns git context (branches, diffs, PRs) into searchable docs: learnings, bugs, conventions, and blockers. Docs live in your repo (`.gitcontext/docs/*.md`) and sync to the [GitContext dashboard](https://app.gitcontext.app).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install -g @fentech/gitcontext
|
|
13
|
+
# or
|
|
14
|
+
bun add -g @fentech/gitcontext
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
# 1. Log in (opens browser for GitHub OAuth)
|
|
23
|
+
gitcontext auth login
|
|
24
|
+
|
|
25
|
+
# 2. Set up your repo (AI platform, doc profile, GitHub App)
|
|
26
|
+
gitcontext init
|
|
27
|
+
|
|
28
|
+
# 3. Capture your first doc
|
|
29
|
+
gitcontext capture "learned that Postgres advisory locks are perfect for distributed job deduplication"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Authentication
|
|
35
|
+
|
|
36
|
+
Login opens a browser for GitHub OAuth and stores a token in `~/.gitcontext/profiles.json`.
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
gitcontext auth login # log in (default "prod" profile)
|
|
40
|
+
gitcontext auth login --profile staging --api-url https://staging.myapp.com
|
|
41
|
+
gitcontext auth status # show current user, org, plan, usage
|
|
42
|
+
gitcontext auth list # list all profiles
|
|
43
|
+
gitcontext auth use staging # switch active profile
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Override profile for a single command:**
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
gitcontext --profile staging analyze
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Profiles file** (`~/.gitcontext/profiles.json`):
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"active": "prod",
|
|
57
|
+
"profiles": {
|
|
58
|
+
"prod": {
|
|
59
|
+
"apiUrl": "https://app.gitcontext.app",
|
|
60
|
+
"userToken": "gct_..."
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Commands
|
|
69
|
+
|
|
70
|
+
### Capture & Edit
|
|
71
|
+
|
|
72
|
+
#### `capture [prompt]`
|
|
73
|
+
|
|
74
|
+
AI-generate a doc from a natural-language prompt. Presents an accept / revise / eject loop before writing anything.
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
gitcontext capture "just fixed a race condition in the job queue"
|
|
78
|
+
gitcontext capture # prompts you interactively
|
|
79
|
+
gitcontext capture "..." --type bug # force a specific doc type
|
|
80
|
+
gitcontext capture "..." --no-commit # write file but skip git commit
|
|
81
|
+
gitcontext capture "..." --json # output result as JSON
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Include code context inline with `@` mentions:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
gitcontext capture "learned that @src/queue/worker.ts uses a mutex to prevent double-processing"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
GitContext resolves `@path/to/file` to the file contents and includes them as context for the AI.
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
#### `analyze`
|
|
95
|
+
|
|
96
|
+
Analyze the current branch diff against a base branch and suggest docs to capture. Shows a checklist — select which ones to save, then commits them in one batch.
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
gitcontext analyze # compares against main
|
|
100
|
+
gitcontext analyze --base develop # compare against a different branch
|
|
101
|
+
gitcontext analyze --no-commit # write files, skip commit
|
|
102
|
+
gitcontext analyze --json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
#### `revise [--doc <id>]`
|
|
108
|
+
|
|
109
|
+
AI-assisted revision of an existing doc. Fuzzy-searches your docs if `--doc` is omitted.
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
gitcontext revise # interactive doc picker
|
|
113
|
+
gitcontext revise --doc abc123 # specify doc ID
|
|
114
|
+
gitcontext revise --doc abc123 --prompt "add more detail about the root cause"
|
|
115
|
+
gitcontext revise --doc abc123 --no-local # update cloud only, skip local file
|
|
116
|
+
gitcontext revise --json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
### Sync
|
|
122
|
+
|
|
123
|
+
#### `push`
|
|
124
|
+
|
|
125
|
+
Upload all local `.gitcontext/docs/*.md` files to the API. Safe to run repeatedly — existing docs are updated, unchanged ones are skipped.
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
gitcontext push
|
|
129
|
+
gitcontext push --json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### Query
|
|
135
|
+
|
|
136
|
+
#### `docs`
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
gitcontext docs list # docs on current branch
|
|
140
|
+
gitcontext docs list --type bug # filter by type
|
|
141
|
+
gitcontext docs list --since 7d --limit 20 # last 7 days, max 20
|
|
142
|
+
gitcontext docs list --branch feature/auth
|
|
143
|
+
gitcontext docs list --json
|
|
144
|
+
|
|
145
|
+
gitcontext docs get <id> # full doc by ID
|
|
146
|
+
gitcontext docs get <id> --json
|
|
147
|
+
|
|
148
|
+
gitcontext docs latest # most recent doc on current branch
|
|
149
|
+
gitcontext docs latest --branch main
|
|
150
|
+
|
|
151
|
+
gitcontext docs search "race condition" # full-text search
|
|
152
|
+
gitcontext docs search "queue" --type bug --limit 10
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
### Branch Health
|
|
158
|
+
|
|
159
|
+
#### `status`
|
|
160
|
+
|
|
161
|
+
Summary of the current branch: doc count by type, open blockers, last capture time, and a link to the dashboard.
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
gitcontext status
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### `blockers`
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
gitcontext blockers # open blockers on current branch
|
|
171
|
+
gitcontext blockers --all # across all branches
|
|
172
|
+
gitcontext blockers --status in_progress
|
|
173
|
+
gitcontext blockers --json
|
|
174
|
+
|
|
175
|
+
gitcontext blockers resolve <id> # mark resolved (prompts for notes)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
### Setup
|
|
181
|
+
|
|
182
|
+
#### `init`
|
|
183
|
+
|
|
184
|
+
Interactive wizard that walks through:
|
|
185
|
+
|
|
186
|
+
1. Authentication (opens browser if not logged in)
|
|
187
|
+
2. AI platform selection (Claude Code, Cursor, Windsurf, VS Code + Copilot, Gemini)
|
|
188
|
+
3. Doc profile selection (Markdown, MDX, Storybook, Docusaurus, Mintlify, Custom)
|
|
189
|
+
4. GitHub App installation
|
|
190
|
+
5. Writing integration files to global or repo locations
|
|
191
|
+
6. Creating `.gitcontext/config.json`
|
|
192
|
+
7. Optional: backfill existing markdown files
|
|
193
|
+
|
|
194
|
+
```sh
|
|
195
|
+
gitcontext init
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
#### `update`
|
|
199
|
+
|
|
200
|
+
Re-sync integration templates (Claude Code, Cursor, etc.) from the installed package version. Run this after upgrading `@fentech/gitcontext` to pick up new agent prompts and slash commands.
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
gitcontext update
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### Knowledge Seeding
|
|
209
|
+
|
|
210
|
+
#### `backfill`
|
|
211
|
+
|
|
212
|
+
Adopt existing markdown files or generate docs from PR history.
|
|
213
|
+
|
|
214
|
+
```sh
|
|
215
|
+
# Adopt existing .md/.mdx files from the repo into .gitcontext/docs/
|
|
216
|
+
gitcontext backfill --local
|
|
217
|
+
|
|
218
|
+
# Generate draft docs from merged PRs (shows token cost estimate before running)
|
|
219
|
+
gitcontext backfill --from-prs
|
|
220
|
+
gitcontext backfill --from-prs --months 3 --max-prs 30
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
### Discovery
|
|
226
|
+
|
|
227
|
+
#### `teach`
|
|
228
|
+
|
|
229
|
+
Pull a random surprising insight from the team's doc base via AI — useful for knowledge sharing and onboarding.
|
|
230
|
+
|
|
231
|
+
```sh
|
|
232
|
+
gitcontext teach
|
|
233
|
+
gitcontext teach --type learning
|
|
234
|
+
gitcontext teach --repo owner/repo --branch main
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### Reference
|
|
240
|
+
|
|
241
|
+
#### `changelog`
|
|
242
|
+
|
|
243
|
+
Display CLI release notes.
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
gitcontext changelog
|
|
247
|
+
gitcontext changelog --limit 5
|
|
248
|
+
gitcontext changelog --json
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## MCP Server
|
|
254
|
+
|
|
255
|
+
GitContext ships an [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server that lets Claude Code, Cursor, and other AI tools call GitContext directly from your editor.
|
|
256
|
+
|
|
257
|
+
```sh
|
|
258
|
+
gitcontext mcp serve # start stdio MCP server
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
`gitcontext init` writes the MCP config automatically for your chosen platform. To configure it manually:
|
|
262
|
+
|
|
263
|
+
**Claude Code** (`~/.claude/mcp.json` or `.claude/mcp.json` in the repo):
|
|
264
|
+
|
|
265
|
+
```json
|
|
266
|
+
{
|
|
267
|
+
"mcpServers": {
|
|
268
|
+
"gitcontext": {
|
|
269
|
+
"command": "gitcontext",
|
|
270
|
+
"args": ["mcp", "serve"]
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Cursor / Windsurf** (`.cursor/mcp.json` / `.windsurf/mcp.json`):
|
|
277
|
+
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"mcpServers": {
|
|
281
|
+
"gitcontext": {
|
|
282
|
+
"command": "gitcontext",
|
|
283
|
+
"args": ["mcp", "serve"]
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### MCP Tools
|
|
290
|
+
|
|
291
|
+
| Tool | Description |
|
|
292
|
+
|---|---|
|
|
293
|
+
| `get_git_context` | Branch, commit hash, repo name, working directory |
|
|
294
|
+
| `get_git_diff` | Diff between current branch and base |
|
|
295
|
+
| `get_status` | Doc count, open blockers, last capture time |
|
|
296
|
+
| `process_doc` | AI-generate a structured doc (stateless) |
|
|
297
|
+
| `write_doc` | Write doc to `.gitcontext/docs/` and optionally commit |
|
|
298
|
+
| `ingest_doc` | Push a doc to the cloud API |
|
|
299
|
+
| `revise_doc` | Fetch a doc and generate a revision (stateless) |
|
|
300
|
+
| `list_docs` | List docs with type/branch/date filters |
|
|
301
|
+
| `list_open_blockers` | Open blockers (optionally filtered by branch) |
|
|
302
|
+
| `resolve_blocker` | Mark a blocker resolved with notes |
|
|
303
|
+
|
|
304
|
+
### MCP Prompts
|
|
305
|
+
|
|
306
|
+
Pre-built guided workflows available in Claude Code's prompt picker:
|
|
307
|
+
|
|
308
|
+
| Prompt | Description |
|
|
309
|
+
|---|---|
|
|
310
|
+
| `capture_learning` | Capture a new insight or technique |
|
|
311
|
+
| `capture_bug` | Document a bug, root cause, and fix |
|
|
312
|
+
| `capture_blocker` | Record something blocking progress |
|
|
313
|
+
| `capture_convention` | Encode a code structure or naming decision |
|
|
314
|
+
| `wrap_conversation` | Summarize an AI-assisted conversation |
|
|
315
|
+
| `doc_from_branch` | Analyze a branch diff and generate 3–10 docs |
|
|
316
|
+
| `analyze_pr` | One-shot PR analysis and doc suggestion |
|
|
317
|
+
| `revise_doc` | Interactive revision of an existing doc |
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Doc Types
|
|
322
|
+
|
|
323
|
+
| Type | When to use |
|
|
324
|
+
|---|---|
|
|
325
|
+
| `learning` | New insight, technique, or understanding |
|
|
326
|
+
| `bug` | Bug found, diagnosed, and fixed (include root cause) |
|
|
327
|
+
| `convention` | Decision about how code should be structured or named |
|
|
328
|
+
| `blocker` | Something blocking progress (open or resolved) |
|
|
329
|
+
| `conversation` | Summary of a significant AI-assisted conversation |
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Storage Modes
|
|
334
|
+
|
|
335
|
+
Each doc type can be stored in the repo, the cloud, or both:
|
|
336
|
+
|
|
337
|
+
| Mode | Behavior |
|
|
338
|
+
|---|---|
|
|
339
|
+
| `repo` | Written to `.gitcontext/docs/*.md` and committed to git |
|
|
340
|
+
| `cloud` | Sent to the API only — not committed to the repo |
|
|
341
|
+
|
|
342
|
+
Configure per doc type in `.gitcontext/config.json` under `docStorageModes`. `gitcontext init` sets this up interactively.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Doc Profiles
|
|
347
|
+
|
|
348
|
+
Render targets for generated docs (chosen during `gitcontext init`):
|
|
349
|
+
|
|
350
|
+
| Profile | Output format |
|
|
351
|
+
|---|---|
|
|
352
|
+
| `markdown` | Standard `.md` (default) |
|
|
353
|
+
| `mdx` | MDX with JSX frontmatter |
|
|
354
|
+
| `storybook-mdx` | Storybook-compatible MDX |
|
|
355
|
+
| `docusaurus` | Docusaurus-compatible MDX with sidebar metadata |
|
|
356
|
+
| `mintlify` | Mintlify-compatible MDX |
|
|
357
|
+
| `custom` | Custom template |
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Repo Config
|
|
362
|
+
|
|
363
|
+
`gitcontext init` writes `.gitcontext/config.json` to the repo root. Example:
|
|
364
|
+
|
|
365
|
+
```json
|
|
366
|
+
{
|
|
367
|
+
"repoName": "owner/repo",
|
|
368
|
+
"platforms": ["claude-code", "cursor"],
|
|
369
|
+
"storageMode": "repo",
|
|
370
|
+
"docStorageModes": {
|
|
371
|
+
"learning": "repo",
|
|
372
|
+
"bug": "repo",
|
|
373
|
+
"blocker": "cloud",
|
|
374
|
+
"convention": "repo",
|
|
375
|
+
"conversation": "cloud"
|
|
376
|
+
},
|
|
377
|
+
"docProfiles": {
|
|
378
|
+
"learning": "markdown",
|
|
379
|
+
"bug": "markdown",
|
|
380
|
+
"blocker": "markdown",
|
|
381
|
+
"convention": "markdown",
|
|
382
|
+
"conversation": "markdown"
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## Links
|
|
390
|
+
|
|
391
|
+
- **Dashboard:** [app.gitcontext.app](https://app.gitcontext.app)
|
|
392
|
+
- **npm:** [npmjs.com/package/@fentech/gitcontext](https://www.npmjs.com/package/@fentech/gitcontext)
|