@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.
Files changed (38) hide show
  1. package/README.md +13 -10
  2. package/dist/index.cjs +372 -281
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.min.cjs +1 -1
  5. package/dist/index.min.cjs.map +1 -1
  6. package/dist/index.min.mjs +1 -1
  7. package/dist/index.min.mjs.map +1 -1
  8. package/dist/index.min.umd.js +1 -1
  9. package/dist/index.min.umd.js.map +1 -1
  10. package/dist/index.mjs +372 -281
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/index.umd.js +372 -281
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/typings/{src/ai/aiSummary.d.ts → ai/aiConstants.d.ts} +1 -17
  15. package/dist/typings/ai/aiSummary.d.ts +2 -17
  16. package/dist/typings/ai/aiTypes.d.ts +21 -0
  17. package/dist/typings/git/commitMessageFilter.d.ts +2 -0
  18. package/dist/typings/git/diffGitStatus.d.ts +3 -0
  19. package/dist/typings/git/diffNameStatusParse.d.ts +8 -0
  20. package/dist/typings/git/diffNumstatParse.d.ts +4 -0
  21. package/dist/typings/git/diffPathspecs.d.ts +2 -0
  22. package/dist/typings/git/diffSummaryBuild.d.ts +2 -0
  23. package/dist/typings/git/diffSummaryParse.d.ts +2 -0
  24. package/dist/typings/git/diffTypes.d.ts +31 -0
  25. package/dist/typings/git/gitDiff.d.ts +5 -33
  26. package/dist/typings/git/gitDiffOps.d.ts +8 -0
  27. package/dist/typings/index.d.ts +9 -8
  28. package/package.json +1 -1
  29. package/dist/typings/src/ai/openAIConfig.d.ts +0 -21
  30. package/dist/typings/src/git/gitDiff.d.ts +0 -33
  31. package/dist/typings/src/index.d.ts +0 -24
  32. package/dist/typings/test/aiSummary.spec.d.ts +0 -1
  33. package/dist/typings/test/gitDiff.async.spec.d.ts +0 -1
  34. package/dist/typings/test/gitDiff.spec.d.ts +0 -1
  35. package/dist/typings/test/index.spec.d.ts +0 -1
  36. package/dist/typings/test/openAIConfig.spec.d.ts +0 -1
  37. package/dist/typings/test/openAiSdk.spec.d.ts +0 -1
  38. package/dist/typings/test/summarizeGitDiff.spec.d.ts +0 -1
package/README.md CHANGED
@@ -3,15 +3,14 @@
3
3
  [![NPM](https://img.shields.io/npm/v/@mcarvin/smart-diff.svg?label=smart-diff)](https://www.npmjs.com/package/@mcarvin/smart-diff)
4
4
  [![License](https://img.shields.io/badge/License-MIT-yellow.svg)](https://raw.githubusercontent.com/mcarvin8/smart-diff/main/LICENSE.md)
5
5
  [![Downloads/week](https://img.shields.io/npm/dw/@mcarvin/smart-diff.svg)](https://npmjs.org/package/@mcarvin/smart-diff)
6
+ [![codecov](https://codecov.io/gh/mcarvin8/smart-diff/graph/badge.svg?token=H3ZWAGG7S9)](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
- ## Development
87
+ ## Used By
84
88
 
85
- ```bash
86
- npm test # Jest + coverage
87
- npm run build # Rollup dist/
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