devbrief 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.
- package/LICENSE +21 -0
- package/README.md +101 -0
- package/dist/ai.d.ts +7 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +35 -0
- package/dist/ai.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +394 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +97 -0
- package/dist/config.js.map +1 -0
- package/dist/digest.d.ts +25 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +109 -0
- package/dist/digest.js.map +1 -0
- package/dist/format.d.ts +27 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +189 -0
- package/dist/format.js.map +1 -0
- package/dist/git.d.ts +23 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +150 -0
- package/dist/git.js.map +1 -0
- package/dist/linkedin.d.ts +8 -0
- package/dist/linkedin.d.ts.map +1 -0
- package/dist/linkedin.js +74 -0
- package/dist/linkedin.js.map +1 -0
- package/dist/parser.d.ts +9 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +17 -0
- package/dist/parser.js.map +1 -0
- package/dist/presets.d.ts +8 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/presets.js +16 -0
- package/dist/presets.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ali Abdullah
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# commitlens
|
|
2
|
+
|
|
3
|
+
Offline Git activity reports for your local machine. Scan one repo or every repo under folders you configure, see streaks and highlights, and optionally generate a LinkedIn post with Groq.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```powershell
|
|
8
|
+
npm install -g commitlens
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For local development:
|
|
12
|
+
|
|
13
|
+
```powershell
|
|
14
|
+
npm.cmd install
|
|
15
|
+
npm.cmd run build
|
|
16
|
+
npm.cmd run dev -- report
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
Run inside any Git repository:
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
commitlens report
|
|
25
|
+
commitlens report --week
|
|
26
|
+
commitlens report --month
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Configure machine-wide scanning:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
commitlens init "D:\Work"
|
|
33
|
+
commitlens report --all --week
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Check setup:
|
|
37
|
+
|
|
38
|
+
```powershell
|
|
39
|
+
commitlens doctor
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Reports
|
|
43
|
+
|
|
44
|
+
```powershell
|
|
45
|
+
commitlens report --format text
|
|
46
|
+
commitlens report --format markdown
|
|
47
|
+
commitlens report --format json
|
|
48
|
+
commitlens report --format markdown --save commitlens-reports\latest.md
|
|
49
|
+
commitlens report --all --format json --save
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Filter report data:
|
|
53
|
+
|
|
54
|
+
```powershell
|
|
55
|
+
commitlens report --mine
|
|
56
|
+
commitlens report --author "Your Name"
|
|
57
|
+
commitlens report --exclude-merges --exclude-bots
|
|
58
|
+
commitlens report --no-color
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## LinkedIn Posts
|
|
62
|
+
|
|
63
|
+
Save a Groq API key once:
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
commitlens config set-groq-key your_groq_api_key
|
|
67
|
+
commitlens config show
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Generate or inspect a post:
|
|
71
|
+
|
|
72
|
+
```powershell
|
|
73
|
+
commitlens post
|
|
74
|
+
commitlens post --style technical
|
|
75
|
+
commitlens post --dry-run-prompt
|
|
76
|
+
commitlens post --all --exclude-bots --save commitlens-reports\linkedin-post.txt
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Using `post` sends a digest summary to Groq. Git history scanning stays local.
|
|
80
|
+
|
|
81
|
+
## Config
|
|
82
|
+
|
|
83
|
+
```powershell
|
|
84
|
+
commitlens config add-root "D:\Work"
|
|
85
|
+
commitlens config list-roots
|
|
86
|
+
commitlens config remove-root "D:\Work"
|
|
87
|
+
commitlens config clear-roots
|
|
88
|
+
commitlens config clear-groq-key
|
|
89
|
+
commitlens config path
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Config is stored in your user profile at `.commitlens\config.json`.
|
|
93
|
+
|
|
94
|
+
## Development
|
|
95
|
+
|
|
96
|
+
```powershell
|
|
97
|
+
npm.cmd run build
|
|
98
|
+
npm.cmd test
|
|
99
|
+
npm.cmd run dev -- report
|
|
100
|
+
npm.cmd pack:check
|
|
101
|
+
```
|
package/dist/ai.d.ts
ADDED
package/dist/ai.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAaF,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuCpF"}
|
package/dist/ai.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export async function generateWithGroq(options) {
|
|
2
|
+
const model = options.model ?? "llama-3.3-70b-versatile";
|
|
3
|
+
const response = await fetch("https://api.groq.com/openai/v1/chat/completions", {
|
|
4
|
+
method: "POST",
|
|
5
|
+
headers: {
|
|
6
|
+
"Authorization": `Bearer ${options.apiKey}`,
|
|
7
|
+
"Content-Type": "application/json",
|
|
8
|
+
},
|
|
9
|
+
body: JSON.stringify({
|
|
10
|
+
model,
|
|
11
|
+
messages: [
|
|
12
|
+
{
|
|
13
|
+
role: "system",
|
|
14
|
+
content: "You help developers turn local Git activity into authentic professional updates.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
role: "user",
|
|
18
|
+
content: options.prompt,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
temperature: 0.7,
|
|
22
|
+
max_tokens: 240,
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
const body = (await response.json());
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
throw new Error(body.error?.message ?? `Groq request failed with status ${response.status}`);
|
|
28
|
+
}
|
|
29
|
+
const text = body.choices?.[0]?.message?.content?.trim();
|
|
30
|
+
if (!text) {
|
|
31
|
+
throw new Error("Groq returned an empty response.");
|
|
32
|
+
}
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ai.js.map
|
package/dist/ai.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA4B;IACjE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,yBAAyB,CAAC;IACzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iDAAiD,EAAE;QAC9E,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,eAAe,EAAE,UAAU,OAAO,CAAC,MAAM,EAAE;YAC3C,cAAc,EAAE,kBAAkB;SACnC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,KAAK;YACL,QAAQ,EAAE;gBACR;oBACE,IAAI,EAAE,QAAQ;oBACd,OAAO,EACL,kFAAkF;iBACrF;gBACD;oBACE,IAAI,EAAE,MAAM;oBACZ,OAAO,EAAE,OAAO,CAAC,MAAM;iBACxB;aACF;YACD,WAAW,EAAE,GAAG;YAChB,UAAU,EAAE,GAAG;SAChB,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA+B,CAAC;IAEnE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,mCAAmC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEzD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { generateWithGroq } from "./ai.js";
|
|
4
|
+
import { addRepoRoot, clearGroqApiKey, clearRepoRoots, getConfigPath, getRepoRoots, maskSecret, readConfig, removeRepoRoot, resolveGroqApiKey, saveGroqApiKey, } from "./config.js";
|
|
5
|
+
import { buildDigest, buildDigestFromActivity, } from "./digest.js";
|
|
6
|
+
import { formatReport, isReportFormat, saveReport } from "./format.js";
|
|
7
|
+
import { findGitRepositories, getCommits, getCurrentGitUser, getGitRoot, getRepositoryActivity, isGitRepository, } from "./git.js";
|
|
8
|
+
import { buildLinkedInPostPrompt } from "./linkedin.js";
|
|
9
|
+
import { resolveSinceOption } from "./presets.js";
|
|
10
|
+
const program = new Command();
|
|
11
|
+
program
|
|
12
|
+
.name("commitlens")
|
|
13
|
+
.description("Offline local Git repository activity digest and streak reporter")
|
|
14
|
+
.version("0.1.0");
|
|
15
|
+
program
|
|
16
|
+
.command("report")
|
|
17
|
+
.description("Generate a local activity report for the current Git repository")
|
|
18
|
+
.option("-s, --since <date>", "Only include commits since this date", "30 days ago")
|
|
19
|
+
.option("--week", "Shortcut for --since \"7 days ago\"")
|
|
20
|
+
.option("--month", "Shortcut for --since \"30 days ago\"")
|
|
21
|
+
.option("-l, --limit <number>", "Maximum commits to scan", "50")
|
|
22
|
+
.option("--all", "Scan all repositories under configured machine-wide roots")
|
|
23
|
+
.option("--author <pattern>", "Only include commits matching this git author pattern")
|
|
24
|
+
.option("--mine", "Only include commits by the configured git user")
|
|
25
|
+
.option("--exclude-merges", "Exclude merge commits")
|
|
26
|
+
.option("--exclude-bots", "Exclude common bot authors")
|
|
27
|
+
.option("-f, --format <format>", "Output format: text, markdown, or json", "text")
|
|
28
|
+
.option("--save [path]", "Save the printed report. Optionally provide an output path")
|
|
29
|
+
.option("--no-color", "Disable colored terminal output")
|
|
30
|
+
.addHelpText("after", `
|
|
31
|
+
|
|
32
|
+
Examples:
|
|
33
|
+
$ commitlens report --since "7 days ago"
|
|
34
|
+
$ commitlens report --all --exclude-bots
|
|
35
|
+
$ commitlens report --author "Ali Abdullah" --format markdown --save
|
|
36
|
+
`)
|
|
37
|
+
.action(async (options) => {
|
|
38
|
+
const since = resolveSinceOrFail(options);
|
|
39
|
+
if (!since) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
options.since = since;
|
|
43
|
+
if (!isReportFormat(options.format)) {
|
|
44
|
+
console.error("Invalid format. Use one of: text, markdown, json.");
|
|
45
|
+
process.exitCode = 1;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const commitOptions = await resolveCommitOptions(options);
|
|
49
|
+
if (!commitOptions) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (options.all) {
|
|
53
|
+
await printAllReposReport(options, commitOptions);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (!(await isGitRepository())) {
|
|
57
|
+
console.error("commitlens must be run inside a Git repository.");
|
|
58
|
+
process.exitCode = 1;
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const root = await getGitRoot();
|
|
62
|
+
const commits = await getCommits({
|
|
63
|
+
cwd: root,
|
|
64
|
+
...commitOptions,
|
|
65
|
+
});
|
|
66
|
+
const digest = buildDigest(commits);
|
|
67
|
+
await printAndMaybeSaveReport({
|
|
68
|
+
title: "CommitLens",
|
|
69
|
+
scope: "current repository",
|
|
70
|
+
range: `since ${options.since}`,
|
|
71
|
+
repo: root,
|
|
72
|
+
digest,
|
|
73
|
+
}, options.format, options.save, options.color);
|
|
74
|
+
});
|
|
75
|
+
program
|
|
76
|
+
.command("post")
|
|
77
|
+
.description("Generate a LinkedIn post from the local Git activity report using Groq")
|
|
78
|
+
.option("-s, --since <date>", "Only include commits since this date", "30 days ago")
|
|
79
|
+
.option("--week", "Shortcut for --since \"7 days ago\"")
|
|
80
|
+
.option("--month", "Shortcut for --since \"30 days ago\"")
|
|
81
|
+
.option("-l, --limit <number>", "Maximum commits to scan", "50")
|
|
82
|
+
.option("--style <style>", "Post style: humble, punchy, or technical", "humble")
|
|
83
|
+
.option("--model <model>", "Groq model to use", "llama-3.3-70b-versatile")
|
|
84
|
+
.option("--all", "Scan all repositories under configured machine-wide roots")
|
|
85
|
+
.option("--author <pattern>", "Only include commits matching this git author pattern")
|
|
86
|
+
.option("--mine", "Only include commits by the configured git user")
|
|
87
|
+
.option("--exclude-merges", "Exclude merge commits")
|
|
88
|
+
.option("--exclude-bots", "Exclude common bot authors")
|
|
89
|
+
.option("--dry-run-prompt", "Print the prompt that would be sent to Groq without calling Groq")
|
|
90
|
+
.option("--save [path]", "Save the generated post. Optionally provide an output path")
|
|
91
|
+
.addHelpText("after", `
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
$ commitlens post --style humble
|
|
95
|
+
$ commitlens post --all --exclude-bots
|
|
96
|
+
$ commitlens post --dry-run-prompt
|
|
97
|
+
`)
|
|
98
|
+
.action(async (options) => {
|
|
99
|
+
const since = resolveSinceOrFail(options);
|
|
100
|
+
if (!since) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
options.since = since;
|
|
104
|
+
if (!isLinkedInPostStyle(options.style)) {
|
|
105
|
+
console.error("Invalid style. Use one of: humble, punchy, technical.");
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const commitOptions = await resolveCommitOptions(options);
|
|
110
|
+
if (!commitOptions) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
let report;
|
|
114
|
+
if (options.all) {
|
|
115
|
+
const activity = await collectAllRepoActivity(options.since, commitOptions);
|
|
116
|
+
if (!activity) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
report = {
|
|
120
|
+
title: "CommitLens",
|
|
121
|
+
scope: "all configured repositories",
|
|
122
|
+
range: `since ${options.since}`,
|
|
123
|
+
repositoriesScanned: activity.length,
|
|
124
|
+
digest: buildDigestFromActivity(activity),
|
|
125
|
+
repositories: activity.filter((repo) => repo.commits.length > 0),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
if (!(await isGitRepository())) {
|
|
130
|
+
console.error("commitlens must be run inside a Git repository.");
|
|
131
|
+
process.exitCode = 1;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const root = await getGitRoot();
|
|
135
|
+
const commits = await getCommits({
|
|
136
|
+
cwd: root,
|
|
137
|
+
...commitOptions,
|
|
138
|
+
});
|
|
139
|
+
report = {
|
|
140
|
+
title: "CommitLens",
|
|
141
|
+
scope: "current repository",
|
|
142
|
+
range: `since ${options.since}`,
|
|
143
|
+
repo: root,
|
|
144
|
+
digest: buildDigest(commits),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const prompt = buildLinkedInPostPrompt({
|
|
148
|
+
report,
|
|
149
|
+
style: options.style,
|
|
150
|
+
});
|
|
151
|
+
if (options.dryRunPrompt) {
|
|
152
|
+
console.log(prompt);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const apiKey = await resolveGroqApiKey();
|
|
156
|
+
if (!apiKey) {
|
|
157
|
+
printMissingGroqKeyMessage();
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
console.error("CommitLens will send this digest summary to Groq to generate the post.");
|
|
161
|
+
try {
|
|
162
|
+
const post = await generateWithGroq({
|
|
163
|
+
apiKey,
|
|
164
|
+
model: options.model,
|
|
165
|
+
prompt,
|
|
166
|
+
});
|
|
167
|
+
console.log(post);
|
|
168
|
+
if (options.save !== undefined) {
|
|
169
|
+
const outputPath = await saveReport({
|
|
170
|
+
content: `${post}\n`,
|
|
171
|
+
format: "text",
|
|
172
|
+
outputPath: options.save,
|
|
173
|
+
filenamePrefix: "linkedin-post",
|
|
174
|
+
});
|
|
175
|
+
console.log("");
|
|
176
|
+
console.log(`Saved post to ${outputPath}`);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
console.error(formatGroqError(error));
|
|
181
|
+
process.exitCode = 1;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
const config = program.command("config").description("Manage commitlens user configuration");
|
|
185
|
+
config
|
|
186
|
+
.command("set-groq-key <apiKey>")
|
|
187
|
+
.description("Save a Groq API key for future commitlens post commands")
|
|
188
|
+
.action(async (apiKey) => {
|
|
189
|
+
const configPath = await saveGroqApiKey(apiKey);
|
|
190
|
+
console.log(`Saved Groq API key to ${configPath}`);
|
|
191
|
+
});
|
|
192
|
+
program
|
|
193
|
+
.command("init [root]")
|
|
194
|
+
.description("Set up commitlens for this machine by adding a repo scan root")
|
|
195
|
+
.option("--current", "Use the current directory as the machine-wide scan root")
|
|
196
|
+
.action(async (root, options) => {
|
|
197
|
+
const scanRoot = root ?? (options.current ? process.cwd() : await resolveDefaultInitRoot());
|
|
198
|
+
const configPath = await addRepoRoot(scanRoot);
|
|
199
|
+
console.log(`Added repo scan root: ${scanRoot}`);
|
|
200
|
+
console.log(`Config updated at ${configPath}`);
|
|
201
|
+
console.log("");
|
|
202
|
+
console.log("Try:");
|
|
203
|
+
console.log("npm.cmd run dev -- report --all --week");
|
|
204
|
+
console.log("npm.cmd run dev -- post --dry-run-prompt --all");
|
|
205
|
+
});
|
|
206
|
+
program
|
|
207
|
+
.command("doctor")
|
|
208
|
+
.description("Check local commitlens setup")
|
|
209
|
+
.action(async () => {
|
|
210
|
+
await printDoctorReport();
|
|
211
|
+
});
|
|
212
|
+
config
|
|
213
|
+
.command("clear-groq-key")
|
|
214
|
+
.description("Remove the saved Groq API key from user configuration")
|
|
215
|
+
.action(async () => {
|
|
216
|
+
const configPath = await clearGroqApiKey();
|
|
217
|
+
console.log(`Removed saved Groq API key from ${configPath}`);
|
|
218
|
+
});
|
|
219
|
+
config
|
|
220
|
+
.command("add-root <path>")
|
|
221
|
+
.description("Add a machine-wide folder to scan for Git repositories")
|
|
222
|
+
.action(async (path) => {
|
|
223
|
+
const configPath = await addRepoRoot(path);
|
|
224
|
+
console.log(`Added repo scan root. Config updated at ${configPath}`);
|
|
225
|
+
});
|
|
226
|
+
config
|
|
227
|
+
.command("remove-root <path>")
|
|
228
|
+
.description("Remove a machine-wide repo scan folder")
|
|
229
|
+
.action(async (path) => {
|
|
230
|
+
const configPath = await removeRepoRoot(path);
|
|
231
|
+
console.log(`Removed repo scan root. Config updated at ${configPath}`);
|
|
232
|
+
});
|
|
233
|
+
config
|
|
234
|
+
.command("list-roots")
|
|
235
|
+
.description("List machine-wide repo scan folders")
|
|
236
|
+
.action(async () => {
|
|
237
|
+
const roots = await getRepoRoots();
|
|
238
|
+
if (roots.length === 0) {
|
|
239
|
+
console.log("No repo roots configured.");
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
for (const root of roots) {
|
|
243
|
+
console.log(root);
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
config
|
|
247
|
+
.command("clear-roots")
|
|
248
|
+
.description("Remove all machine-wide repo scan folders")
|
|
249
|
+
.action(async () => {
|
|
250
|
+
const configPath = await clearRepoRoots();
|
|
251
|
+
console.log(`Cleared repo scan roots. Config updated at ${configPath}`);
|
|
252
|
+
});
|
|
253
|
+
config
|
|
254
|
+
.command("show")
|
|
255
|
+
.description("Show configured commitlens settings without revealing secrets")
|
|
256
|
+
.action(async () => {
|
|
257
|
+
const configPath = getConfigPath();
|
|
258
|
+
const currentConfig = await readConfig();
|
|
259
|
+
console.log(`config: ${configPath}`);
|
|
260
|
+
console.log(`groqApiKey: ${currentConfig.groqApiKey ? maskSecret(currentConfig.groqApiKey) : "not set"}`);
|
|
261
|
+
console.log("repoRoots:");
|
|
262
|
+
for (const root of currentConfig.repoRoots ?? []) {
|
|
263
|
+
console.log(`- ${root}`);
|
|
264
|
+
}
|
|
265
|
+
if (!currentConfig.repoRoots?.length) {
|
|
266
|
+
console.log("- not set");
|
|
267
|
+
}
|
|
268
|
+
console.log(`GROQ_API_KEY env override: ${process.env.GROQ_API_KEY ? "set" : "not set"}`);
|
|
269
|
+
});
|
|
270
|
+
config
|
|
271
|
+
.command("path")
|
|
272
|
+
.description("Print the commitlens config file path")
|
|
273
|
+
.action(() => {
|
|
274
|
+
console.log(getConfigPath());
|
|
275
|
+
});
|
|
276
|
+
program.parse();
|
|
277
|
+
function isLinkedInPostStyle(style) {
|
|
278
|
+
return style === "humble" || style === "punchy" || style === "technical";
|
|
279
|
+
}
|
|
280
|
+
async function printAllReposReport(options, commitOptions) {
|
|
281
|
+
const activity = await collectAllRepoActivity(options.since, commitOptions);
|
|
282
|
+
if (!activity) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const digest = buildDigestFromActivity(activity);
|
|
286
|
+
await printAndMaybeSaveReport({
|
|
287
|
+
title: "CommitLens",
|
|
288
|
+
scope: "all configured repositories",
|
|
289
|
+
range: `since ${options.since}`,
|
|
290
|
+
repositoriesScanned: activity.length,
|
|
291
|
+
digest,
|
|
292
|
+
repositories: activity,
|
|
293
|
+
}, options.format, options.save, options.color);
|
|
294
|
+
}
|
|
295
|
+
function resolveSinceOrFail(options) {
|
|
296
|
+
try {
|
|
297
|
+
return resolveSinceOption(options);
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
301
|
+
process.exitCode = 1;
|
|
302
|
+
return undefined;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async function collectAllRepoActivity(since, commitOptions) {
|
|
306
|
+
const repoRoots = await getRepoRoots();
|
|
307
|
+
if (repoRoots.length === 0) {
|
|
308
|
+
console.error("No machine-wide repo roots configured.");
|
|
309
|
+
console.error("Add one first, for example:");
|
|
310
|
+
console.error('npm.cmd run dev -- config add-root "D:\\Work"');
|
|
311
|
+
process.exitCode = 1;
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
const repositories = (await Promise.all(repoRoots.map((root) => findGitRepositories(root)))).flat();
|
|
315
|
+
if (repositories.length === 0) {
|
|
316
|
+
console.error("No Git repositories found under configured roots.");
|
|
317
|
+
process.exitCode = 1;
|
|
318
|
+
return undefined;
|
|
319
|
+
}
|
|
320
|
+
return getRepositoryActivity(repositories, { ...commitOptions, since });
|
|
321
|
+
}
|
|
322
|
+
async function printAndMaybeSaveReport(document, format, savePath, color = true) {
|
|
323
|
+
const output = formatReport(document, format, { color });
|
|
324
|
+
console.log(output.trimEnd());
|
|
325
|
+
if (savePath !== undefined) {
|
|
326
|
+
const outputPath = await saveReport({
|
|
327
|
+
content: output,
|
|
328
|
+
format,
|
|
329
|
+
outputPath: savePath,
|
|
330
|
+
});
|
|
331
|
+
console.log("");
|
|
332
|
+
console.log(`Saved report to ${outputPath}`);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
async function resolveCommitOptions(options) {
|
|
336
|
+
const limit = Number.parseInt(options.limit, 10);
|
|
337
|
+
let author = options.author;
|
|
338
|
+
if (options.mine) {
|
|
339
|
+
author = await getCurrentGitUser();
|
|
340
|
+
if (!author) {
|
|
341
|
+
console.error("Could not resolve the current git user. Set git config user.email or user.name.");
|
|
342
|
+
process.exitCode = 1;
|
|
343
|
+
return undefined;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return {
|
|
347
|
+
since: options.since,
|
|
348
|
+
limit: Number.isFinite(limit) ? limit : 50,
|
|
349
|
+
author,
|
|
350
|
+
excludeMerges: options.excludeMerges,
|
|
351
|
+
excludeBots: options.excludeBots,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
function printMissingGroqKeyMessage() {
|
|
355
|
+
console.error("Missing Groq API key.");
|
|
356
|
+
console.error("Save it permanently:");
|
|
357
|
+
console.error("npm.cmd run dev -- config set-groq-key your_groq_api_key");
|
|
358
|
+
console.error("");
|
|
359
|
+
console.error("Or set it for this PowerShell session:");
|
|
360
|
+
console.error('$env:GROQ_API_KEY="your_groq_api_key"');
|
|
361
|
+
process.exitCode = 1;
|
|
362
|
+
}
|
|
363
|
+
function formatGroqError(error) {
|
|
364
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
365
|
+
if (message.includes("fetch failed") || message.includes("EACCES") || message.includes("ENOTFOUND")) {
|
|
366
|
+
return "Could not reach Groq. Check your internet connection, firewall, or API access.";
|
|
367
|
+
}
|
|
368
|
+
return `Groq request failed: ${message}`;
|
|
369
|
+
}
|
|
370
|
+
async function resolveDefaultInitRoot() {
|
|
371
|
+
if (await isGitRepository()) {
|
|
372
|
+
return getGitRoot();
|
|
373
|
+
}
|
|
374
|
+
return process.cwd();
|
|
375
|
+
}
|
|
376
|
+
async function printDoctorReport() {
|
|
377
|
+
const config = await readConfig();
|
|
378
|
+
const apiKey = await resolveGroqApiKey();
|
|
379
|
+
const inGitRepository = await isGitRepository();
|
|
380
|
+
const gitUser = await getCurrentGitUser().catch(() => undefined);
|
|
381
|
+
console.log("CommitLens doctor");
|
|
382
|
+
console.log("=================");
|
|
383
|
+
console.log(`Git repository: ${inGitRepository ? "ok" : "not detected"}`);
|
|
384
|
+
console.log(`Git user: ${gitUser ?? "not configured"}`);
|
|
385
|
+
console.log(`Config path: ${getConfigPath()}`);
|
|
386
|
+
console.log(`Groq API key: ${apiKey ? "configured" : "not configured"}`);
|
|
387
|
+
console.log(`Repo roots: ${config.repoRoots?.length ?? 0}`);
|
|
388
|
+
if (config.repoRoots?.length) {
|
|
389
|
+
for (const root of config.repoRoots) {
|
|
390
|
+
console.log(`- ${root}`);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EACL,WAAW,EACX,eAAe,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,UAAU,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,WAAW,EACX,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAA0C,MAAM,aAAa,CAAC;AAC/G,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,qBAAqB,EACrB,eAAe,GAEhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,YAAY,CAAC;KAClB,WAAW,CAAC,kEAAkE,CAAC;KAC/E,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,iEAAiE,CAAC;KAC9E,MAAM,CAAC,oBAAoB,EAAE,sCAAsC,EAAE,aAAa,CAAC;KACnF,MAAM,CAAC,QAAQ,EAAE,qCAAqC,CAA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,CAAC;IAEjE,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,mBAAmB,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,aAAa,OAAO,IAAI,gBAAgB,EAAE,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,gBAAgB,aAAa,EAAE,EAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,eAAe,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC,CAAC;IAE5D,IAAI,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;QAC7B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;YACpC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type CommitlensConfig = {
|
|
2
|
+
groqApiKey?: string;
|
|
3
|
+
repoRoots?: string[];
|
|
4
|
+
};
|
|
5
|
+
export declare function getConfigPath(configDir?: string): string;
|
|
6
|
+
export declare function readConfig(configDir?: string): Promise<CommitlensConfig>;
|
|
7
|
+
export declare function saveGroqApiKey(groqApiKey: string, configDir?: string): Promise<string>;
|
|
8
|
+
export declare function addRepoRoot(repoRoot: string, configDir?: string): Promise<string>;
|
|
9
|
+
export declare function getRepoRoots(configDir?: string): Promise<string[]>;
|
|
10
|
+
export declare function removeRepoRoot(repoRoot: string, configDir?: string): Promise<string>;
|
|
11
|
+
export declare function clearRepoRoots(configDir?: string): Promise<string>;
|
|
12
|
+
export declare function clearGroqApiKey(configDir?: string): Promise<string>;
|
|
13
|
+
export declare function resolveGroqApiKey(env?: NodeJS.ProcessEnv, configDir?: string): Promise<string | undefined>;
|
|
14
|
+
export declare function maskSecret(secret: string): string;
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,wBAAgB,aAAa,CAAC,SAAS,SAAqB,GAAG,MAAM,CAEpE;AAED,wBAAsB,UAAU,CAAC,SAAS,SAAqB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAW1F;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,SAAS,SAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,SAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAanG;AAED,wBAAsB,YAAY,CAAC,SAAS,SAAqB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEpF;AAyBD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,SAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,CAWjB;AAED,wBAAsB,cAAc,CAAC,SAAS,SAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAUpF;AAED,wBAAsB,eAAe,CAAC,SAAS,SAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAUrF;AAED,wBAAsB,iBAAiB,CACrC,GAAG,GAAE,MAAM,CAAC,UAAwB,EACpC,SAAS,SAAqB,GAC7B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAE7B;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD"}
|