@mcarvin/smart-diff 1.0.3 → 1.0.5
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 +13 -10
- package/dist/index.cjs +372 -281
- package/dist/index.cjs.map +1 -1
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.min.mjs.map +1 -1
- package/dist/index.min.umd.js +1 -1
- package/dist/index.min.umd.js.map +1 -1
- package/dist/index.mjs +372 -281
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +372 -281
- package/dist/index.umd.js.map +1 -1
- package/dist/typings/{src/ai/aiSummary.d.ts → ai/aiConstants.d.ts} +1 -17
- package/dist/typings/ai/aiSummary.d.ts +2 -17
- package/dist/typings/ai/aiTypes.d.ts +21 -0
- package/dist/typings/git/commitMessageFilter.d.ts +2 -0
- package/dist/typings/git/diffGitStatus.d.ts +3 -0
- package/dist/typings/git/diffNameStatusParse.d.ts +8 -0
- package/dist/typings/git/diffNumstatParse.d.ts +4 -0
- package/dist/typings/git/diffPathspecs.d.ts +2 -0
- package/dist/typings/git/diffSummaryBuild.d.ts +2 -0
- package/dist/typings/git/diffSummaryParse.d.ts +2 -0
- package/dist/typings/git/diffTypes.d.ts +31 -0
- package/dist/typings/git/gitDiff.d.ts +5 -33
- package/dist/typings/git/gitDiffOps.d.ts +8 -0
- package/dist/typings/index.d.ts +9 -8
- package/package.json +1 -1
- package/dist/typings/src/ai/openAIConfig.d.ts +0 -21
- package/dist/typings/src/git/gitDiff.d.ts +0 -33
- package/dist/typings/src/index.d.ts +0 -24
- package/dist/typings/test/aiSummary.spec.d.ts +0 -1
- package/dist/typings/test/gitDiff.async.spec.d.ts +0 -1
- package/dist/typings/test/gitDiff.spec.d.ts +0 -1
- package/dist/typings/test/index.spec.d.ts +0 -1
- package/dist/typings/test/openAIConfig.spec.d.ts +0 -1
- package/dist/typings/test/openAiSdk.spec.d.ts +0 -1
- package/dist/typings/test/summarizeGitDiff.spec.d.ts +0 -1
package/README.md
CHANGED
|
@@ -3,15 +3,14 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/@mcarvin/smart-diff)
|
|
4
4
|
[](https://raw.githubusercontent.com/mcarvin8/smart-diff/main/LICENSE.md)
|
|
5
5
|
[](https://npmjs.org/package/@mcarvin/smart-diff)
|
|
6
|
+
[](https://codecov.io/gh/mcarvin8/smart-diff)
|
|
6
7
|
|
|
7
8
|
TypeScript library that turns a **git revision range** into a **Markdown summary** using an OpenAI-compatible Chat Completions API. It uses [`simple-git`](https://github.com/steveukx/git-js) to read the repo, respects **path includes/excludes** and **commit message include/exclude regexes**, and sends commits, paths, structured diff stats, and unified diff text to the model.
|
|
8
9
|
|
|
9
|
-
There is **no local fallback**: you must either configure an LLM gateway via environment variables or pass `openAiClientProvider` (for tests or custom clients).
|
|
10
|
-
|
|
11
10
|
## Requirements
|
|
12
11
|
|
|
13
12
|
- **Node.js** 20+
|
|
14
|
-
- Git Bash
|
|
13
|
+
- [Git Bash](https://git-scm.com/install/)
|
|
15
14
|
|
|
16
15
|
## Installation
|
|
17
16
|
|
|
@@ -19,8 +18,6 @@ There is **no local fallback**: you must either configure an LLM gateway via env
|
|
|
19
18
|
npm install @mcarvin/smart-diff
|
|
20
19
|
```
|
|
21
20
|
|
|
22
|
-
Build the package from source with `npm run build` (Rollup outputs CommonJS and ESM under `dist/`).
|
|
23
|
-
|
|
24
21
|
## LLM configuration
|
|
25
22
|
|
|
26
23
|
The library is considered “configured” when `shouldUseLlmGateway()` is true: API key, base URL, and/or JSON default headers are set. Otherwise `summarizeGitDiff` / `generateSummary` throw with `LLM_GATEWAY_REQUIRED_MESSAGE` unless you pass **`openAiClientProvider`**.
|
|
@@ -35,6 +32,13 @@ The library is considered “configured” when `shouldUseLlmGateway()` is true:
|
|
|
35
32
|
|
|
36
33
|
The client is created with the official [`openai`](https://www.npmjs.com/package/openai) SDK via `createOpenAiLikeClient()`; use a compatible endpoint and model ID for your provider.
|
|
37
34
|
|
|
35
|
+
Example using a company-managed OpenAI-compatible gateway:
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
$env:LLM_DEFAULT_HEADERS = '{"x-company-rbac":"your-rbac-token-here","Authorization":"sk-your-api-key-here"}'
|
|
39
|
+
$env:LLM_BASE_URL = "https://llm-gateway.example.com"
|
|
40
|
+
```
|
|
41
|
+
|
|
38
42
|
## Usage
|
|
39
43
|
|
|
40
44
|
### `summarizeGitDiff`
|
|
@@ -80,12 +84,11 @@ const markdown = await summarizeGitDiff({
|
|
|
80
84
|
|
|
81
85
|
The package also exports helpers such as `createGitClient`, `getCommits`, `getDiff`, `getDiffSummary`, `getChangedFiles`, `filterCommitsByMessageRegexes`, `buildDiffPathspecs`, `generateSummary`, and OpenAI config utilities (`resolveLlmBaseUrl`, `shouldUseLlmGateway`, `createOpenAiLikeClient`, …). Use these if you build a custom pipeline but still want the same git and LLM behavior.
|
|
82
86
|
|
|
83
|
-
##
|
|
87
|
+
## Used By
|
|
84
88
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
+
This package is used by:
|
|
90
|
+
|
|
91
|
+
- [sf-git-ai-meta-insights](https://github.com/mcarvin8/sf-git-ai-meta-insights) = Salesforce metadata wrapper compatible with Salesforce DX projects
|
|
89
92
|
|
|
90
93
|
## License
|
|
91
94
|
|