git-impact 0.1.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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +305 -0
  3. package/dist/cli/index.d.ts +3 -0
  4. package/dist/cli/index.d.ts.map +1 -0
  5. package/dist/cli/index.js +267 -0
  6. package/dist/cli/index.js.map +1 -0
  7. package/dist/init/installer.d.ts +31 -0
  8. package/dist/init/installer.d.ts.map +1 -0
  9. package/dist/init/installer.js +225 -0
  10. package/dist/init/installer.js.map +1 -0
  11. package/dist/init/templates.d.ts +12 -0
  12. package/dist/init/templates.d.ts.map +1 -0
  13. package/dist/init/templates.js +258 -0
  14. package/dist/init/templates.js.map +1 -0
  15. package/dist/mcp/prompts.d.ts +4 -0
  16. package/dist/mcp/prompts.d.ts.map +1 -0
  17. package/dist/mcp/prompts.js +242 -0
  18. package/dist/mcp/prompts.js.map +1 -0
  19. package/dist/mcp/repo.d.ts +14 -0
  20. package/dist/mcp/repo.d.ts.map +1 -0
  21. package/dist/mcp/repo.js +106 -0
  22. package/dist/mcp/repo.js.map +1 -0
  23. package/dist/mcp/resources.d.ts +4 -0
  24. package/dist/mcp/resources.d.ts.map +1 -0
  25. package/dist/mcp/resources.js +98 -0
  26. package/dist/mcp/resources.js.map +1 -0
  27. package/dist/mcp/server.d.ts +14 -0
  28. package/dist/mcp/server.d.ts.map +1 -0
  29. package/dist/mcp/server.js +61 -0
  30. package/dist/mcp/server.js.map +1 -0
  31. package/dist/mcp/tools.d.ts +12 -0
  32. package/dist/mcp/tools.d.ts.map +1 -0
  33. package/dist/mcp/tools.js +285 -0
  34. package/dist/mcp/tools.js.map +1 -0
  35. package/dist/readers/git.d.ts +23 -0
  36. package/dist/readers/git.d.ts.map +1 -0
  37. package/dist/readers/git.js +120 -0
  38. package/dist/readers/git.js.map +1 -0
  39. package/dist/readers/github.d.ts +22 -0
  40. package/dist/readers/github.d.ts.map +1 -0
  41. package/dist/readers/github.js +94 -0
  42. package/dist/readers/github.js.map +1 -0
  43. package/dist/storage/db.d.ts +31 -0
  44. package/dist/storage/db.d.ts.map +1 -0
  45. package/dist/storage/db.js +170 -0
  46. package/dist/storage/db.js.map +1 -0
  47. package/dist/translator/prompt.d.ts +21 -0
  48. package/dist/translator/prompt.d.ts.map +1 -0
  49. package/dist/translator/prompt.js +117 -0
  50. package/dist/translator/prompt.js.map +1 -0
  51. package/dist/translator/translate.d.ts +36 -0
  52. package/dist/translator/translate.d.ts.map +1 -0
  53. package/dist/translator/translate.js +73 -0
  54. package/dist/translator/translate.js.map +1 -0
  55. package/package.json +55 -0
  56. package/skill/SKILL.md +238 -0
package/skill/SKILL.md ADDED
@@ -0,0 +1,238 @@
1
+ ---
2
+ name: git-impact
3
+ description: >
4
+ Translates git commits into plain-English business impact bullets — ideal for
5
+ daily standups, manager updates, and end-of-quarter performance reviews.
6
+ Use this skill whenever the user says anything like: "do my standup",
7
+ "what did I work on today", "translate my commits", "summarize my git activity",
8
+ "write my standup update", "what should I say in standup", "git-impact",
9
+ "/git-impact", "show my impact", "translate today's work", "what did I ship",
10
+ "generate a performance review", "what have I done this week/month/quarter",
11
+ "review my commits". Also trigger for "since yesterday", "last 3 days commits",
12
+ or any request to turn technical git output into something a manager can read.
13
+ ---
14
+
15
+ # git-impact
16
+
17
+ Translate git commits into plain-English business impact for standups, manager
18
+ updates, and performance reviews — without an API key. You do the translation
19
+ inline using bash to read git data and a per-repo context file for personalization.
20
+
21
+ ---
22
+
23
+ ## Sub-commands
24
+
25
+ Parse the user's message to determine which mode to run:
26
+
27
+ | What the user says | Mode |
28
+ |---|---|
29
+ | `do my standup`, `today`, `/git-impact`, no args | **today** |
30
+ | `since yesterday`, `since 3d`, `since 2026-05-01` | **since \<when\>** |
31
+ | `review`, `performance review`, `last 30 days`, `Q2 review` | **review** |
32
+ | `init`, `set up context`, `configure for this repo` | **init** |
33
+
34
+ ---
35
+
36
+ ## Step 1 — Find the repo root
37
+
38
+ Run this to find the git root from wherever you are:
39
+
40
+ ```bash
41
+ git rev-parse --show-toplevel 2>/dev/null
42
+ ```
43
+
44
+ If it fails, tell the user: *"No git repository found in the current directory. Open
45
+ a project folder first, or `cd` into a repo."* Stop there.
46
+
47
+ Store the result as `REPO_ROOT`.
48
+
49
+ ---
50
+
51
+ ## Step 2 — Load context (if it exists)
52
+
53
+ ```bash
54
+ cat "$REPO_ROOT/.git-impact/context.json" 2>/dev/null || echo "NONE"
55
+ ```
56
+
57
+ If the file exists, parse it. It looks like:
58
+
59
+ ```json
60
+ {
61
+ "companyDescription": "B2B SaaS for workforce analytics",
62
+ "managerPriorities": "Shipping on time, not breaking prod",
63
+ "glossary": {
64
+ "RLS": "data security layer",
65
+ "TabPFN": "AI predictions",
66
+ "MFA": "login security"
67
+ }
68
+ }
69
+ ```
70
+
71
+ Use this to personalise your translation — apply the glossary and frame impact
72
+ around what the manager cares about. If the file doesn't exist, use general
73
+ technical language and suggest running `init` at the end.
74
+
75
+ ---
76
+
77
+ ## Mode: today / since \<when\>
78
+
79
+ ### Fetch commits
80
+
81
+ For **today**:
82
+ ```bash
83
+ git -C "$REPO_ROOT" log \
84
+ --since="$(date '+%Y-%m-%d') 00:00:00" \
85
+ --format="%h|%s|%b|%an|%ad" \
86
+ --date=short \
87
+ HEAD
88
+ ```
89
+
90
+ For **since \<when\>** — convert the user's input to a git `--since` value:
91
+ - `yesterday` → `--since="yesterday 00:00:00"`
92
+ - `3d` → `--since="3 days ago 00:00:00"`
93
+ - `2026-05-01` → `--since="2026-05-01 00:00:00"`
94
+
95
+ ### Fetch files changed
96
+
97
+ ```bash
98
+ FIRST=$(git -C "$REPO_ROOT" log --since="..." --format="%h" HEAD | tail -1)
99
+ git -C "$REPO_ROOT" diff --stat "$FIRST"^ HEAD 2>/dev/null || \
100
+ git -C "$REPO_ROOT" show --stat "$FIRST" 2>/dev/null
101
+ ```
102
+
103
+ ### Translate
104
+
105
+ If there are no commits, say so clearly and stop.
106
+
107
+ Otherwise translate into **2–5 bullet points**. Follow these rules:
108
+
109
+ 1. **What + why, not what + how.** Each bullet must say what was accomplished
110
+ AND why it matters to the business. "Fixed a bug in the auth middleware" is
111
+ useless to a manager. "Fixed login failures for admin users — unblocks the
112
+ Q2 portal launch" is useful.
113
+
114
+ 2. **Apply the glossary.** Replace every technical term listed in context.json
115
+ with its plain-English equivalent. If no glossary, infer from context.
116
+
117
+ 3. **Never hallucinate impact.** If you can't infer the business reason, say
118
+ "technical foundation work for [area]" rather than inventing an outcome.
119
+
120
+ 4. **Group related commits.** Three commits all touching auth tell one story —
121
+ write one bullet, not three.
122
+
123
+ 5. **WIP / draft commits** get `⏳ In progress:` and state what the expected
124
+ outcome is, not what was done so far.
125
+
126
+ 6. **Be specific.** "Improved performance" is vague. "Reduced login latency
127
+ by ~40%" is specific. Use whatever numbers exist in the commit messages.
128
+
129
+ ### Output format
130
+
131
+ ```
132
+ 📅 [Day, Date]
133
+
134
+ ✅ [Plain-English summary of what was accomplished]
135
+ → [Why it matters — who it unblocks, what risk it reduces, what it enables]
136
+
137
+ ⏳ In progress: [What is being worked on]
138
+ → [Expected outcome when complete]
139
+
140
+ 📁 [N] files changed across [brief description of areas touched]
141
+ [N] commit(s) on [branch name]
142
+ ```
143
+
144
+ ### Save to history
145
+
146
+ After printing the output, silently save to `.git-impact/history.db`:
147
+
148
+ ```bash
149
+ mkdir -p "$REPO_ROOT/.git-impact"
150
+ grep -qxF '.git-impact/history.db' "$REPO_ROOT/.gitignore" 2>/dev/null || \
151
+ printf '\n# git-impact local history (private, per-machine)\n.git-impact/history.db\n' \
152
+ >> "$REPO_ROOT/.gitignore"
153
+
154
+ sqlite3 "$REPO_ROOT/.git-impact/history.db" "
155
+ CREATE TABLE IF NOT EXISTS impact_entries (
156
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
157
+ date TEXT NOT NULL,
158
+ repo_name TEXT NOT NULL,
159
+ total_commits INTEGER NOT NULL DEFAULT 0,
160
+ total_files INTEGER NOT NULL DEFAULT 0,
161
+ items_json TEXT NOT NULL DEFAULT '[]',
162
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
163
+ );
164
+ INSERT INTO impact_entries (date, repo_name, total_commits, total_files, items_json)
165
+ VALUES ('$(date +%Y-%m-%d)', '$(basename $REPO_ROOT)', $COMMIT_COUNT, $FILE_COUNT, '$ITEMS_JSON');
166
+ "
167
+ ```
168
+
169
+ If `sqlite3` is not available, skip silently.
170
+
171
+ ---
172
+
173
+ ## Mode: review
174
+
175
+ Fetch saved history and synthesise a performance review.
176
+
177
+ Parse the period from the user's message:
178
+ - `last 30 days` / `30d` → last 30 days
179
+ - `last 90 days` / `90d` → last 90 days (default)
180
+ - `Q2-2026` → April 1 – June 30, 2026
181
+
182
+ ```bash
183
+ sqlite3 "$REPO_ROOT/.git-impact/history.db" \
184
+ "SELECT date, repo_name, total_commits, items_json
185
+ FROM impact_entries
186
+ WHERE date >= '$FROM' AND date <= '$TO'
187
+ ORDER BY date ASC;" 2>/dev/null
188
+ ```
189
+
190
+ If the DB doesn't exist or returns nothing: *"No saved history found for this
191
+ period. Use the standup mode daily to build up history, then come back."*
192
+
193
+ Otherwise synthesise:
194
+
195
+ ```
196
+ Performance Review — [Period]
197
+
198
+ [One headline sentence — biggest contribution this period]
199
+
200
+ 🚀 [High-impact theme]
201
+ • Specific achievement...
202
+
203
+ ✅ [Medium-impact theme]
204
+ • Specific achievement...
205
+
206
+ 🔧 [Lower-impact theme]
207
+ • ...
208
+
209
+ ---
210
+ 📊 [N] commits across [N] working days
211
+ ```
212
+
213
+ Group by theme (Features shipped, Reliability, Security, Code review,
214
+ Infrastructure). Only include themes that apply.
215
+
216
+ ---
217
+
218
+ ## Mode: init
219
+
220
+ Ask the user three questions one at a time:
221
+
222
+ 1. *"What does your company/product do? (1–2 sentences)"*
223
+ 2. *"What does your manager care most about?"*
224
+ 3. *"Any technical terms to translate? Format: RLS=data security, MFA=login security (leave blank to skip)"*
225
+
226
+ Then write `.git-impact/context.json` and tell the user:
227
+ *"Saved to `.git-impact/context.json`. Commit this to share the glossary with
228
+ your team. history.db is gitignored automatically."*
229
+
230
+ ---
231
+
232
+ ## Tone
233
+
234
+ - Write for a non-technical manager. No jargon that isn't in the glossary.
235
+ - Short sentences. No filler. Skip "this change" / "this commit" constructions.
236
+ - Confident — if you know the impact, state it. If not, use
237
+ "technical foundation work for X", never hedge with "might potentially".
238
+ - 2 accurate bullets beat 5 vague ones.