@simbo/git-changes 1.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @simbo/git-changes
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 0ab1038: Initial release
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2025 Simon Lepel <simbo@simbo.de> (https://simbo.de)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Git Changes
2
+
3
+ 📦 [**`@simbo/git-changes`**](https://npmjs.com/package/@simbo/git-changes)
4
+
5
+ A library to read, parse and provide Git changes information for a local
6
+ repository.
7
+
8
+ ## Installation
9
+
10
+ Install `@simbo/git-changes` from the npm registry:
11
+
12
+ ```bash
13
+ npm i [-D] @simbo/git-changes
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import { getGitChanges } from '@simbo/git-changes';
20
+
21
+ // get a map of changed files in the repository located at /path/to/repo
22
+ const changes = await getGitChanges('/path/to/repo');
23
+ ```
24
+
25
+ For a complete API reference, see the
26
+ [documentation](https://simbo.codes/packages/modules/_simbo_git-changes/).
27
+
28
+ ## License
29
+
30
+ [MIT © Simon Lepel](http://simbo.mit-license.org/2025/)
@@ -0,0 +1,8 @@
1
+ import type { GitChange } from './git-change.interface.js';
2
+ /**
3
+ * Gets the uncommitted Git changes in the specified working directory.
4
+ *
5
+ * @param workingDir - The working directory of the Git repository. Defaults to the current working directory.
6
+ * @returns A ReadonlyMap of file paths to their corresponding GitChange objects.
7
+ */
8
+ export declare function getGitChanges(workingDir?: string): Promise<ReadonlyMap<string, GitChange>>;
@@ -0,0 +1,44 @@
1
+ import { cwd } from 'node:process';
2
+ import { findGitRepositoryRoot } from '@simbo/find-git-repository-root';
3
+ import { execa, ExecaError } from 'execa';
4
+ import { parseGitStatusOutput } from './parse-git-status-output.js';
5
+ /**
6
+ * Gets the uncommitted Git changes in the specified working directory.
7
+ *
8
+ * @param workingDir - The working directory of the Git repository. Defaults to the current working directory.
9
+ * @returns A ReadonlyMap of file paths to their corresponding GitChange objects.
10
+ */
11
+ export async function getGitChanges(workingDir = cwd()) {
12
+ const repoRoot = await findGitRepositoryRoot(workingDir);
13
+ if (!repoRoot) {
14
+ throw new Error(`The directory "${workingDir}" is not part of a Git repository.`);
15
+ }
16
+ try {
17
+ /**
18
+ * This command provides a machine-readable, null-separated output of the
19
+ * current status of the Git repository, including staged and unstaged changes,
20
+ * as well as untracked files.
21
+ *
22
+ * Example output:
23
+ * '?? untracked.ts\0'
24
+ * ' M unstaged-modified.ts\0'
25
+ * 'M staged-modified.ts\0'
26
+ * 'MM both-modified.ts\0'
27
+ * ' D unstaged-deleted.ts\0'
28
+ * 'A staged-added.ts\0'
29
+ * 'R old.ts\0new.ts\0'
30
+ * 'C source.ts\0copied.ts\0'
31
+ */
32
+ const { stdout: output } = await execa({ cwd: repoRoot }) `git status --porcelain --short --null`;
33
+ return parseGitStatusOutput(output);
34
+ }
35
+ catch (error) {
36
+ const reason = error instanceof ExecaError
37
+ ? error.shortMessage
38
+ : error instanceof Error
39
+ ? error.message
40
+ : `Unknown error (${String(error)})`;
41
+ throw new Error(`Failed to get Git changes: ${reason}`);
42
+ }
43
+ }
44
+ //# sourceMappingURL=get-git-changes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-git-changes.js","sourceRoot":"","sources":["../src/get-git-changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,UAAU,GAAG,GAAG,EAAE;IACpD,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,UAAU,CAAC,CAAC;IAEzD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,kBAAkB,UAAU,oCAAoC,CAAC,CAAC;IACpF,CAAC;IAED,IAAI,CAAC;QACH;;;;;;;;;;;;;;WAcG;QACH,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAA,uCAAuC,CAAC;QAEjG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GACV,KAAK,YAAY,UAAU;YACzB,CAAC,CAAC,KAAK,CAAC,YAAY;YACpB,CAAC,CAAC,KAAK,YAAY,KAAK;gBACtB,CAAC,CAAC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,kBAAkB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,EAAE,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Enum representing the possible statuses of a change in a Git repository.
3
+ * Each status corresponds to a single character used in the output of `git status`.
4
+ */
5
+ export declare enum GitChangeStatus {
6
+ Added = "A",
7
+ Modified = "M",
8
+ Deleted = "D",
9
+ Renamed = "R",
10
+ Copied = "C",
11
+ Untracked = "?"
12
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Enum representing the possible statuses of a change in a Git repository.
3
+ * Each status corresponds to a single character used in the output of `git status`.
4
+ */
5
+ export var GitChangeStatus;
6
+ (function (GitChangeStatus) {
7
+ GitChangeStatus["Added"] = "A";
8
+ GitChangeStatus["Modified"] = "M";
9
+ GitChangeStatus["Deleted"] = "D";
10
+ GitChangeStatus["Renamed"] = "R";
11
+ GitChangeStatus["Copied"] = "C";
12
+ GitChangeStatus["Untracked"] = "?";
13
+ })(GitChangeStatus || (GitChangeStatus = {}));
14
+ //# sourceMappingURL=git-change-status.enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-change-status.enum.js","sourceRoot":"","sources":["../src/git-change-status.enum.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAN,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,8BAAW,CAAA;IACX,iCAAc,CAAA;IACd,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,+BAAY,CAAA;IACZ,kCAAe,CAAA;AACjB,CAAC,EAPW,eAAe,KAAf,eAAe,QAO1B"}
@@ -0,0 +1,25 @@
1
+ import type { GitChangeStatus } from './git-change-status.enum.js';
2
+ /**
3
+ * Represents a change in a Git repository.
4
+ */
5
+ export interface GitChange {
6
+ /**
7
+ * The file path of the change.
8
+ */
9
+ path: string;
10
+ /**
11
+ * The origin file path if the change is a rename or copy.
12
+ * This is only set for changes that involve renaming or copying files.
13
+ */
14
+ originPath?: string;
15
+ /**
16
+ * The status of the change when it is staged.
17
+ * This can be one of the GitChangeStatus values or undefined if not staged.
18
+ */
19
+ staged?: GitChangeStatus.Added | GitChangeStatus.Modified | GitChangeStatus.Deleted | GitChangeStatus.Renamed | GitChangeStatus.Copied;
20
+ /**
21
+ * The status of the change when it is unstaged.
22
+ * This can be one of the GitChangeStatus values or undefined if not unstaged.
23
+ */
24
+ unstaged?: GitChangeStatus.Untracked | GitChangeStatus.Modified | GitChangeStatus.Deleted | GitChangeStatus.Renamed | GitChangeStatus.Copied;
25
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=git-change.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-change.interface.js","sourceRoot":"","sources":["../src/git-change.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The separator used in the output of the git status command.
3
+ * This is a null character, which is used to separate entries in the output.
4
+ */
5
+ export declare const ENTRY_SEPARATOR = "\0";
6
+ /**
7
+ * The index in the Git change entry where the staged status is located.
8
+ */
9
+ export declare const ENTRY_STATUS_INDEX = 0;
10
+ /**
11
+ * The length of the status string in a Git change entry.
12
+ */
13
+ export declare const ENTRY_STATUS_LENGTH = 2;
14
+ /**
15
+ * The index in the Git change entry where the file path starts.
16
+ */
17
+ export declare const ENTRY_PATH_INDEX: number;
18
+ /**
19
+ * A set of known GitChangeStatus values for validation purposes.
20
+ */
21
+ export declare const KNOWN_GIT_CHANGE_STATUSES: ReadonlySet<string>;
@@ -0,0 +1,23 @@
1
+ import { GitChangeStatus } from './git-change-status.enum.js';
2
+ /**
3
+ * The separator used in the output of the git status command.
4
+ * This is a null character, which is used to separate entries in the output.
5
+ */
6
+ export const ENTRY_SEPARATOR = '\0';
7
+ /**
8
+ * The index in the Git change entry where the staged status is located.
9
+ */
10
+ export const ENTRY_STATUS_INDEX = 0;
11
+ /**
12
+ * The length of the status string in a Git change entry.
13
+ */
14
+ export const ENTRY_STATUS_LENGTH = 2;
15
+ /**
16
+ * The index in the Git change entry where the file path starts.
17
+ */
18
+ export const ENTRY_PATH_INDEX = ENTRY_STATUS_INDEX + ENTRY_STATUS_LENGTH + 1;
19
+ /**
20
+ * A set of known GitChangeStatus values for validation purposes.
21
+ */
22
+ export const KNOWN_GIT_CHANGE_STATUSES = new Set(Object.values(GitChangeStatus));
23
+ //# sourceMappingURL=git-status-constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-status-constants.js","sourceRoot":"","sources":["../src/git-status-constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,GAAG,mBAAmB,GAAG,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAwB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './get-git-changes.js';
2
+ export * from './git-change-status.enum.js';
3
+ export type * from './git-change.interface.js';
4
+ export * from './git-status-constants.js';
5
+ export * from './parse-git-change-status.js';
6
+ export * from './parse-git-status-output.js';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from './get-git-changes.js';
2
+ export * from './git-change-status.enum.js';
3
+ export * from './git-status-constants.js';
4
+ export * from './parse-git-change-status.js';
5
+ export * from './parse-git-status-output.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { GitChange } from './git-change.interface.js';
2
+ /**
3
+ * Parses a Git change status string into staged and unstaged statuses.
4
+ *
5
+ * The status string is expected to be at least two characters long, where:
6
+ * - The first character represents the staged status.
7
+ * - The second character represents the unstaged status.
8
+ *
9
+ * If the status is '??', it indicates an untracked file.
10
+ *
11
+ * This should match the output of `git status --porcelain`.
12
+ *
13
+ * @param status - A two-character string representing the Git change status.
14
+ * @returns An object containing the staged and unstaged statuses.
15
+ */
16
+ export declare function parseGitChangeStatus(status: string): {
17
+ staged: GitChange['staged'];
18
+ unstaged: GitChange['unstaged'];
19
+ };
@@ -0,0 +1,27 @@
1
+ import { GitChangeStatus } from './git-change-status.enum.js';
2
+ import { KNOWN_GIT_CHANGE_STATUSES } from './git-status-constants.js';
3
+ /**
4
+ * Parses a Git change status string into staged and unstaged statuses.
5
+ *
6
+ * The status string is expected to be at least two characters long, where:
7
+ * - The first character represents the staged status.
8
+ * - The second character represents the unstaged status.
9
+ *
10
+ * If the status is '??', it indicates an untracked file.
11
+ *
12
+ * This should match the output of `git status --porcelain`.
13
+ *
14
+ * @param status - A two-character string representing the Git change status.
15
+ * @returns An object containing the staged and unstaged statuses.
16
+ */
17
+ export function parseGitChangeStatus(status) {
18
+ if (typeof status !== 'string' || status.length < 2) {
19
+ return { staged: undefined, unstaged: undefined };
20
+ }
21
+ if (status.startsWith('??')) {
22
+ return { staged: undefined, unstaged: GitChangeStatus.Untracked };
23
+ }
24
+ const [staged, unstaged] = [status[0], status[1]].map(char => char && char !== '?' && KNOWN_GIT_CHANGE_STATUSES.has(char) ? char : undefined);
25
+ return { staged, unstaged };
26
+ }
27
+ //# sourceMappingURL=parse-git-change-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-git-change-status.js","sourceRoot":"","sources":["../src/parse-git-change-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IACpD,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,CAAC;IACpE,CAAC;IAED,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAC3D,IAAI,IAAI,IAAI,KAAK,GAAG,IAAI,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAC/B,CAAC;IAElD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { GitChange } from './git-change.interface.js';
2
+ /**
3
+ * Parses the output of the git status command and returns a map of Git changes.
4
+ *
5
+ * @param output - The output string from the git status command.
6
+ * @returns A ReadonlyMap of file paths to their corresponding GitChange objects.
7
+ */
8
+ export declare function parseGitStatusOutput(output: string): ReadonlyMap<string, GitChange>;
@@ -0,0 +1,40 @@
1
+ import { GitChangeStatus } from './git-change-status.enum.js';
2
+ import { ENTRY_PATH_INDEX, ENTRY_SEPARATOR, ENTRY_STATUS_INDEX, ENTRY_STATUS_LENGTH } from './git-status-constants.js';
3
+ import { parseGitChangeStatus } from './parse-git-change-status.js';
4
+ /**
5
+ * Parses the output of the git status command and returns a map of Git changes.
6
+ *
7
+ * @param output - The output string from the git status command.
8
+ * @returns A ReadonlyMap of file paths to their corresponding GitChange objects.
9
+ */
10
+ export function parseGitStatusOutput(output) {
11
+ const changes = new Map();
12
+ const entries = output.split(ENTRY_SEPARATOR);
13
+ let index = 0;
14
+ while (index < entries.length) {
15
+ const entry = entries[index++];
16
+ if (!entry) {
17
+ continue;
18
+ }
19
+ const { staged, unstaged } = parseGitChangeStatus(entry.slice(ENTRY_STATUS_INDEX, ENTRY_STATUS_LENGTH));
20
+ const path = entry.slice(ENTRY_PATH_INDEX);
21
+ if ((!staged && !unstaged) || !path) {
22
+ continue;
23
+ }
24
+ // For entries that are renamed or copied, the current entry contains the old path,
25
+ // and the next entry contains the new path.
26
+ if (staged === GitChangeStatus.Renamed ||
27
+ staged === GitChangeStatus.Copied ||
28
+ unstaged === GitChangeStatus.Renamed ||
29
+ unstaged === GitChangeStatus.Copied) {
30
+ if (entries[index]) {
31
+ const targetPath = entries[index++];
32
+ changes.set(targetPath, { path: targetPath, originPath: path, staged, unstaged });
33
+ }
34
+ continue;
35
+ }
36
+ changes.set(path, { path, staged, unstaged });
37
+ }
38
+ return changes;
39
+ }
40
+ //# sourceMappingURL=parse-git-status-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse-git-status-output.js","sourceRoot":"","sources":["../src/parse-git-status-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACvH,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAE9C,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,OAAO,KAAK,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAS;QACX,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC,CAAC;QAExG,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAE3C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACpC,SAAS;QACX,CAAC;QAED,mFAAmF;QACnF,4CAA4C;QAC5C,IACE,MAAM,KAAK,eAAe,CAAC,OAAO;YAClC,MAAM,KAAK,eAAe,CAAC,MAAM;YACjC,QAAQ,KAAK,eAAe,CAAC,OAAO;YACpC,QAAQ,KAAK,eAAe,CAAC,MAAM,EACnC,CAAC;YACD,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnB,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;gBACpC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;YACpF,CAAC;YACD,SAAS;QACX,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@simbo/git-changes",
3
+ "description": "A library to read, parse and provide Git changes information from `git status` for a local repository.",
4
+ "version": "1.0.0",
5
+ "keywords": [
6
+ "git",
7
+ "changes",
8
+ "diff",
9
+ "commits",
10
+ "repository",
11
+ "read",
12
+ "parse",
13
+ "utility",
14
+ "node",
15
+ "typescript"
16
+ ],
17
+ "author": "Simon Lepel <simbo@simbo.de> (https://simbo.de/)",
18
+ "license": "MIT",
19
+ "homepage": "http://github.com/simbo/packages/tree/main/packages/git-changes",
20
+ "repository": "github:simbo/packages",
21
+ "bugs": "https://github.com/simbo/packages/issues",
22
+ "engines": {
23
+ "node": ">=20"
24
+ },
25
+ "type": "module",
26
+ "exports": {
27
+ ".": "./dist/index.js"
28
+ },
29
+ "files": [
30
+ "CHANGELOG.md",
31
+ "dist",
32
+ "LICENSE.md",
33
+ "README.md"
34
+ ],
35
+ "scripts": {
36
+ "build": "tsc --project tsconfig.build.json",
37
+ "check": "pnpm run check:eslint && pnpm run check:format && pnpm run check:types",
38
+ "check:eslint": "eslint --config ./eslint.config.ts --max-warnings 0",
39
+ "check:format": "prettier --check .",
40
+ "check:types": "tsc --noEmit",
41
+ "clean": "pnpm run clean:dist && pnpm run clean:coverage && pnpm run clean:turbo && pnpm run clean:node_modules",
42
+ "clean:dist": "rm -rf dist",
43
+ "clean:node_modules": "rm -rf node_modules",
44
+ "clean:turbo": "rm -rf .turbo",
45
+ "clean:coverage": "rm -rf coverage",
46
+ "fix:eslint": "pnpm run check:eslint --fix",
47
+ "fix:format": "prettier --write .",
48
+ "test": "vitest run --coverage",
49
+ "test:ui": "pnpm run test:watch --ui",
50
+ "test:watch": "vitest dev --coverage"
51
+ },
52
+ "dependencies": {
53
+ "@simbo/find-git-repository-root": "workspace:*",
54
+ "execa": "^9.6.1"
55
+ },
56
+ "devDependencies": {
57
+ "@ianvs/prettier-plugin-sort-imports": "^4.7.0",
58
+ "@simbo/eslint-config": "workspace:*",
59
+ "@simbo/prettier-config": "workspace:*",
60
+ "@simbo/tsconfig": "workspace:*",
61
+ "@types/node": "^24.10.4",
62
+ "@vitest/coverage-v8": "^3.2.4",
63
+ "@vitest/ui": "^3.2.4",
64
+ "baseline-browser-mapping": "^2.9.8",
65
+ "eslint": "^9.39.2",
66
+ "jiti": "^2.6.1",
67
+ "prettier": "^3.7.4",
68
+ "typescript": "^5.9.3",
69
+ "vitest": "^3.2.4"
70
+ }
71
+ }