diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..cdaffd0
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1716730506974
+
+
+ 1716730506974
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/index.js b/index.js
index 4eb5e00..c676689 100644
--- a/index.js
+++ b/index.js
@@ -4,6 +4,8 @@ const Discord = require('discord.js');
const chalk = require('chalk');
const fs = require('node:fs');
const config = require('./configs/config.json');
+const simpleGit = require('simple-git');
+const path = require('node:path');
// Discord Client Constructor
const client = new Discord.Client({
@@ -71,34 +73,25 @@ async function registerSlashCommands() {
// Call the async function to register slash commands
registerSlashCommands();
-// GitHub repository details
-const repositoryOwner = 'DeathbotGaming';
-const repositoryName = 'Ai-Bot';
-const branch = 'main'; // Or the branch where your bot's code resides
-
// Function to update the bot from GitHub repository
async function updateBotFromGitHub() {
+
+ const git = simpleGit(path.resolve(__dirname));
+
try {
console.log('Checking for updates from GitHub...');
- // Fetch latest commit hash of the main branch from GitHub
- const response = await fetch(`https://api.github.com/repos/${repositoryOwner}/${repositoryName}/commits/${branch}`);
- const data = await response.json();
- const latestCommitHash = data.sha;
-
- // Check if the latest commit hash is different from the current one
- const currentCommitHash = fs.readFileSync('.git/refs/heads/main', 'utf-8').trim(); // Adjust the path if your branch is different
- if (latestCommitHash !== currentCommitHash) {
- console.log('Updating bot from GitHub...');
-
- // Pull changes from the GitHub repository
- await exec('git pull origin main'); // Adjust the branch name if necessary
-
- // Restart the bot to apply changes
- process.exit();
- } else {
- console.log('Bot is up to date.');
+ if (!await git.checkIsRepo()) {
+ await git.init().addRemote('origin', 'https://git.shadowhosting.xyz/shadow/AI_botter.git').fetch();
}
+
+ await git.pull('origin', 'main');
+
+ console.log('Bot updated from GitHub. Restarting...');
+
+ // Restart the bot to apply changes
+ process.exit();
+
} catch (error) {
console.error('Error updating bot from GitHub:', error);
}
diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json
index 4099df7..f019cc2 100644
--- a/node_modules/.package-lock.json
+++ b/node_modules/.package-lock.json
@@ -115,6 +115,19 @@
"node": ">=14"
}
},
+ "node_modules/@kwsites/file-exists": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@kwsites/file-exists/-/file-exists-1.1.1.tgz",
+ "integrity": "sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==",
+ "dependencies": {
+ "debug": "^4.1.1"
+ }
+ },
+ "node_modules/@kwsites/promise-deferred": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@kwsites/promise-deferred/-/promise-deferred-1.1.1.tgz",
+ "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw=="
+ },
"node_modules/@sapphire/async-queue": {
"version": "1.5.2",
"resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.5.2.tgz",
@@ -294,6 +307,27 @@
"node": "*"
}
},
+ "node_modules/debug": {
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
+ "dependencies": {
+ "ms": "2.1.2"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/debug/node_modules/ms": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
+ },
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
@@ -574,6 +608,20 @@
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
+ "node_modules/simple-git": {
+ "version": "3.24.0",
+ "resolved": "https://registry.npmjs.org/simple-git/-/simple-git-3.24.0.tgz",
+ "integrity": "sha512-QqAKee9Twv+3k8IFOFfPB2hnk6as6Y6ACUpwCtQvRYBAes23Wv3SZlHVobAzqcE8gfsisCvPw3HGW3HYM+VYYw==",
+ "dependencies": {
+ "@kwsites/file-exists": "^1.1.1",
+ "@kwsites/promise-deferred": "^1.1.1",
+ "debug": "^4.3.4"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/steveukx/git-js?sponsor=1"
+ }
+ },
"node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
diff --git a/node_modules/@kwsites/file-exists/CHANGELOG.md b/node_modules/@kwsites/file-exists/CHANGELOG.md
new file mode 100644
index 0000000..9361ecb
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/CHANGELOG.md
@@ -0,0 +1,12 @@
+
+# Release History
+
+## 1.1.1
+
+- Add dependency on `debug` to log results of the file system checks
+- Add `jest` tests
+
+# 1.0.0
+
+- First public release, a simple typescript library for checking whether a path exists
+ on the file system and optionally whether it points to a file or folder.
diff --git a/node_modules/@kwsites/file-exists/LICENSE b/node_modules/@kwsites/file-exists/LICENSE
new file mode 100644
index 0000000..b123c04
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/LICENSE
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Steve King
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/@kwsites/file-exists/dist/index.d.ts b/node_modules/@kwsites/file-exists/dist/index.d.ts
new file mode 100644
index 0000000..8420b10
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/index.d.ts
@@ -0,0 +1 @@
+export * from './src';
diff --git a/node_modules/@kwsites/file-exists/dist/index.js b/node_modules/@kwsites/file-exists/dist/index.js
new file mode 100644
index 0000000..87332ba
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/index.js
@@ -0,0 +1,7 @@
+"use strict";
+function __export(m) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+Object.defineProperty(exports, "__esModule", { value: true });
+__export(require("./src"));
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/dist/index.js.map b/node_modules/@kwsites/file-exists/dist/index.js.map
new file mode 100644
index 0000000..3b75ca4
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;AACA,2BAAsB"}
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/dist/src/index.d.ts b/node_modules/@kwsites/file-exists/dist/src/index.d.ts
new file mode 100644
index 0000000..3d234cd
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/src/index.d.ts
@@ -0,0 +1,19 @@
+/**
+ * Synchronous validation of a path existing either as a file or as a directory.
+ *
+ * @param {string} path The path to check
+ * @param {number} type One or both of the exported numeric constants
+ */
+export declare function exists(path: string, type?: number): boolean;
+/**
+ * Constant representing a file
+ */
+export declare const FILE = 1;
+/**
+ * Constant representing a folder
+ */
+export declare const FOLDER = 2;
+/**
+ * Constant representing either a file or a folder
+ */
+export declare const READABLE: number;
diff --git a/node_modules/@kwsites/file-exists/dist/src/index.js b/node_modules/@kwsites/file-exists/dist/src/index.js
new file mode 100644
index 0000000..8a41c70
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/src/index.js
@@ -0,0 +1,55 @@
+"use strict";
+var __importDefault = (this && this.__importDefault) || function (mod) {
+ return (mod && mod.__esModule) ? mod : { "default": mod };
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+const fs_1 = require("fs");
+const debug_1 = __importDefault(require("debug"));
+const log = debug_1.default('@kwsites/file-exists');
+function check(path, isFile, isDirectory) {
+ log(`checking %s`, path);
+ try {
+ const stat = fs_1.statSync(path);
+ if (stat.isFile() && isFile) {
+ log(`[OK] path represents a file`);
+ return true;
+ }
+ if (stat.isDirectory() && isDirectory) {
+ log(`[OK] path represents a directory`);
+ return true;
+ }
+ log(`[FAIL] path represents something other than a file or directory`);
+ return false;
+ }
+ catch (e) {
+ if (e.code === 'ENOENT') {
+ log(`[FAIL] path is not accessible: %o`, e);
+ return false;
+ }
+ log(`[FATAL] %o`, e);
+ throw e;
+ }
+}
+/**
+ * Synchronous validation of a path existing either as a file or as a directory.
+ *
+ * @param {string} path The path to check
+ * @param {number} type One or both of the exported numeric constants
+ */
+function exists(path, type = exports.READABLE) {
+ return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
+}
+exports.exists = exists;
+/**
+ * Constant representing a file
+ */
+exports.FILE = 1;
+/**
+ * Constant representing a folder
+ */
+exports.FOLDER = 2;
+/**
+ * Constant representing either a file or a folder
+ */
+exports.READABLE = exports.FILE + exports.FOLDER;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/dist/src/index.js.map b/node_modules/@kwsites/file-exists/dist/src/index.js.map
new file mode 100644
index 0000000..68f2b8a
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/src/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAAA,2BAA8B;AAC9B,kDAA0B;AAE1B,MAAM,GAAG,GAAG,eAAK,CAAC,sBAAsB,CAAC,CAAC;AAE1C,SAAS,KAAK,CAAC,IAAY,EAAE,MAAe,EAAE,WAAoB;IAC/D,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;IAEzB,IAAI;QACD,MAAM,IAAI,GAAG,aAAQ,CAAC,IAAI,CAAC,CAAC;QAE5B,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,MAAM,EAAE;YAC1B,GAAG,CAAC,6BAA6B,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC;SACd;QAED,IAAI,IAAI,CAAC,WAAW,EAAE,IAAI,WAAW,EAAE;YACpC,GAAG,CAAC,kCAAkC,CAAC,CAAC;YACxC,OAAO,IAAI,CAAC;SACd;QAED,GAAG,CAAC,iEAAiE,CAAC,CAAC;QACvE,OAAO,KAAK,CAAC;KACf;IAAC,OAAO,CAAC,EAAE;QACT,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE;YACtB,GAAG,CAAC,mCAAmC,EAAE,CAAC,CAAC,CAAC;YAC5C,OAAO,KAAK,CAAC;SACf;QAED,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;QACrB,MAAM,CAAC,CAAC;KACV;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAgB,MAAM,CAAC,IAAY,EAAE,OAAe,gBAAQ;IACzD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,GAAG,YAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,GAAG,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9D,CAAC;AAFD,wBAEC;AAED;;GAEG;AACU,QAAA,IAAI,GAAG,CAAC,CAAC;AAEtB;;GAEG;AACU,QAAA,MAAM,GAAG,CAAC,CAAC;AAExB;;GAEG;AACU,QAAA,QAAQ,GAAG,YAAI,GAAG,cAAM,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.d.ts b/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.d.ts
new file mode 100644
index 0000000..ab80d33
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.d.ts
@@ -0,0 +1,7 @@
+export declare function statSync(...args: any[]): any;
+export declare function addStatSyncMock(fn: any): void;
+export declare function assertMocksUsed(): void;
+declare const mockFs: {
+ statSync: typeof statSync;
+};
+export default mockFs;
diff --git a/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.js b/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.js
new file mode 100644
index 0000000..cd46c71
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.js
@@ -0,0 +1,26 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+let statSyncMocks = [];
+function statSync(...args) {
+ const mock = statSyncMocks.shift();
+ if (typeof mock !== 'function') {
+ throw new Error(`fs.statSync called without configuring a mock`);
+ }
+ return mock(...args);
+}
+exports.statSync = statSync;
+function addStatSyncMock(fn) {
+ statSyncMocks.push(fn);
+}
+exports.addStatSyncMock = addStatSyncMock;
+function assertMocksUsed() {
+ if (statSyncMocks.length) {
+ throw new Error(`fs.afterEach: statSync has ${statSyncMocks.length} unused mocks`);
+ }
+}
+exports.assertMocksUsed = assertMocksUsed;
+const mockFs = {
+ statSync,
+};
+exports.default = mockFs;
+//# sourceMappingURL=fs.js.map
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.js.map b/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.js.map
new file mode 100644
index 0000000..e2a3d16
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/test/__mocks__/fs.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../test/__mocks__/fs.ts"],"names":[],"mappings":";;AACA,IAAI,aAAa,GAAU,EAAE,CAAC;AAE9B,SAAgB,QAAQ,CAAC,GAAG,IAAW;IACpC,MAAO,IAAI,GAAG,aAAa,CAAC,KAAK,EAAE,CAAC;IACpC,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KACnE;IAED,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,CAAC;AAPD,4BAOC;AAED,SAAgB,eAAe,CAAC,EAAO;IACpC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1B,CAAC;AAFD,0CAEC;AAED,SAAgB,eAAe;IAC5B,IAAI,aAAa,CAAC,MAAM,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,aAAa,CAAC,MAAM,eAAe,CAAC,CAAC;KACrF;AACJ,CAAC;AAJD,0CAIC;AAED,MAAM,MAAM,GAAG;IACZ,QAAQ;CACV,CAAA;AAED,kBAAe,MAAM,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/dist/test/exists.spec.d.ts b/node_modules/@kwsites/file-exists/dist/test/exists.spec.d.ts
new file mode 100644
index 0000000..cb0ff5c
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/test/exists.spec.d.ts
@@ -0,0 +1 @@
+export {};
diff --git a/node_modules/@kwsites/file-exists/dist/test/exists.spec.js b/node_modules/@kwsites/file-exists/dist/test/exists.spec.js
new file mode 100644
index 0000000..a36b549
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/test/exists.spec.js
@@ -0,0 +1,77 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+jest.mock('fs');
+//@ts-ignore
+const fs_1 = require("fs");
+const src_1 = require("../src");
+describe(`exists`, () => {
+ let statSync;
+ let statSyncMock;
+ let path;
+ beforeEach(() => {
+ path = `./path/${Math.random()}`;
+ fs_1.addStatSyncMock(statSyncMock = jest.fn(() => statSync()));
+ });
+ afterEach(() => {
+ fs_1.assertMocksUsed();
+ statSync = statSyncMock = undefined;
+ });
+ describe('known errors', () => {
+ beforeEach(() => givenStatSyncThrows({ code: 'ENOENT' }));
+ it('with type', () => {
+ expect(src_1.exists(path, src_1.READABLE)).toBe(false);
+ });
+ it('with type omitted', () => {
+ expect(src_1.exists(path)).toBe(false);
+ });
+ });
+ describe('unknown errors', () => {
+ let err;
+ beforeEach(() => err = givenStatSyncThrows(new Error('something')));
+ it('with type', () => {
+ expect(() => src_1.exists(path, src_1.READABLE)).toThrow(err);
+ });
+ it('with type omitted', () => {
+ expect(() => src_1.exists(path)).toThrow(err);
+ });
+ });
+ describe('path is a file', () => {
+ beforeEach(() => givenStatSyncIsA('file'));
+ existsReturns(true, false, true);
+ });
+ describe('path is a folder', () => {
+ beforeEach(() => givenStatSyncIsA('folder'));
+ existsReturns(false, true, true);
+ });
+ describe('path is unknown', () => {
+ beforeEach(() => givenStatSyncIsA('unknown'));
+ existsReturns(false, false, false);
+ });
+ function existsReturns(file, folder, readable) {
+ it('when searching for a file', () => {
+ expect(src_1.exists(path, src_1.FILE)).toBe(file);
+ });
+ it('when searching for a folder', () => {
+ expect(src_1.exists(path, src_1.FOLDER)).toBe(folder);
+ });
+ it('when searching for either', () => {
+ expect(src_1.exists(path, src_1.READABLE)).toBe(readable);
+ });
+ it('when searching without a type', () => {
+ expect(src_1.exists(path)).toBe(readable);
+ });
+ }
+ function givenStatSyncThrows(err) {
+ statSync = () => { throw err; };
+ return err;
+ }
+ function givenStatSyncIsA(type) {
+ const mockStat = {
+ isFile() { return type === 'file'; },
+ isDirectory() { return type === 'folder'; },
+ };
+ statSync = () => mockStat;
+ return mockStat;
+ }
+});
+//# sourceMappingURL=exists.spec.js.map
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/dist/test/exists.spec.js.map b/node_modules/@kwsites/file-exists/dist/test/exists.spec.js.map
new file mode 100644
index 0000000..669176a
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/dist/test/exists.spec.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"exists.spec.js","sourceRoot":"","sources":["../../test/exists.spec.ts"],"names":[],"mappings":";;AACA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEhB,YAAY;AACZ,2BAAsD;AACtD,gCAAwD;AAExD,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IAErB,IAAI,QAAa,CAAC;IAClB,IAAI,YAAiB,CAAC;IACtB,IAAI,IAAY,CAAC;IAEjB,UAAU,CAAC,GAAG,EAAE;QACb,IAAI,GAAG,UAAU,IAAI,CAAC,MAAM,EAAE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D,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACtC,MAAM,CAAC,YAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACN,CAAC;IAED,SAAS,mBAAmB,CAAE,GAAQ;QACnC,QAAQ,GAAG,GAAG,EAAE,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;QAChC,OAAO,GAAG,CAAC;IACd,CAAC;IAED,SAAS,gBAAgB,CAAE,IAAmC;QAC3D,MAAM,QAAQ,GAAG;YACd,MAAM,KAAM,OAAO,IAAI,KAAK,MAAM,CAAA,CAAC,CAAC;YACpC,WAAW,KAAM,OAAO,IAAI,KAAK,QAAQ,CAAA,CAAC,CAAC;SAC7C,CAAC;QACF,QAAQ,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC;QAC1B,OAAO,QAAQ,CAAC;IACnB,CAAC;AAEJ,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@kwsites/file-exists/package.json b/node_modules/@kwsites/file-exists/package.json
new file mode 100644
index 0000000..1cf6a80
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/package.json
@@ -0,0 +1,42 @@
+{
+ "name": "@kwsites/file-exists",
+ "version": "1.1.1",
+ "main": "./dist/index.js",
+ "types": "./dist/index.d.ts",
+ "license": "MIT",
+ "repository": "git@github.com:kwsites/file-exists.git",
+ "author": "Steve King ",
+ "contributors": [
+ {
+ "name": "Steve King",
+ "email": "steve@mydev.co"
+ }
+ ],
+ "files": [
+ "dist/**/*.*"
+ ],
+ "scripts": {
+ "clean": "rimraf ./dist",
+ "build": "yarn run clean && tsc",
+ "preversion": "yarn run clean && yarn run build && yarn test",
+ "postversion": "npm publish --access=public && git push && git push --tags",
+ "test": "jest --coverage",
+ "tsc": "tsc"
+ },
+ "devDependencies": {
+ "@babel/core": "^7.10.1",
+ "@babel/preset-env": "^7.10.1",
+ "@babel/preset-typescript": "^7.10.1",
+ "@types/debug": "^4.1.5",
+ "@types/jest": "^26.0.0",
+ "@types/node": "^10.12.0",
+ "babel-jest": "^26.0.1",
+ "jest": "^25.3.0",
+ "rimraf": "^2.6.2",
+ "ts-node": "^8.10.2",
+ "typescript": "^3.1.3"
+ },
+ "dependencies": {
+ "debug": "^4.1.1"
+ }
+}
diff --git a/node_modules/@kwsites/file-exists/readme.md b/node_modules/@kwsites/file-exists/readme.md
new file mode 100644
index 0000000..0db6d0f
--- /dev/null
+++ b/node_modules/@kwsites/file-exists/readme.md
@@ -0,0 +1,41 @@
+# @kwsites/file-exists
+
+Synchronous validation of a path existing either as a file or as a directory.
+
+```
+const { exists, FILE, FOLDER, READABLE } = require('@kwsites/file-exists');
+
+// check for a folder existing
+assert(exists(__dirname, FOLDER));
+assert(!exists(__filename, FOLDER));
+
+// check for a file existing
+assert(!exists(__filename, FILE));
+assert(exists(__filename, FILE));
+
+// when no type is specified, both folders and files are allowed
+assert(exists(__dirname));
+assert(exists(__filename));
+
+// alternatively specify both files and folders
+assert(exists(__dirname, FILE + FOLDER));
+
+// or just that the path is readable (can be either a file or folder)
+assert(exists(__filename, READABLE));
+```
+
+## Troubleshooting
+
+This library uses [debug](https://www.npmjs.com/package/debug) to handle logging,
+to enable logging, use either the environment variable:
+
+```
+"DEBUG=@kwsites/file-exists" node ./your-app.js
+```
+
+Or explicitly enable logging using the `debug` library itself:
+
+```javascript
+require('debug').enable('@kwsites/file-exists');
+```
+
diff --git a/node_modules/@kwsites/promise-deferred/LICENSE b/node_modules/@kwsites/promise-deferred/LICENSE
new file mode 100644
index 0000000..d082eb9
--- /dev/null
+++ b/node_modules/@kwsites/promise-deferred/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 kwsites
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/@kwsites/promise-deferred/dist/index.d.ts b/node_modules/@kwsites/promise-deferred/dist/index.d.ts
new file mode 100644
index 0000000..68fb38a
--- /dev/null
+++ b/node_modules/@kwsites/promise-deferred/dist/index.d.ts
@@ -0,0 +1,49 @@
+/**
+ * The `DeferredPromise` has a `promise` property in an initially pending state,
+ * that will be resolved when the `done` method is called or rejected when the
+ * `fail` method is called.
+ */
+export interface DeferredPromise {
+ done(result: RESOLVES): void;
+ fail(error: REJECTS): void;
+ readonly status: DeferredPromiseStatus;
+ readonly fulfilled: boolean;
+ promise: Promise;
+}
+/**
+ * The three states the DeferredPromise can be in - initially pending then either
+ * resolved or rejected when it is fulfilled.
+ *
+ * ```typescript
+ import {createDeferred, DeferredPromiseStatus} from '@kwsites/promise-deferred`;
+
+ const pending: DeferredPromiseStatus = 'pending';
+ expect(createDeferred()).toHaveProperty('status', pending);
+ ```
+ */
+export declare type DeferredPromiseStatus = 'pending' | 'resolved' | 'rejected';
+/**
+ * Creates a new `DeferredPromise`
+ *
+ * ```typescript
+ import {deferred} from '@kwsites/promise-deferred`;
+ ```
+ */
+export declare function deferred(): DeferredPromise;
+/**
+ * Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the
+ * local variable name rather than the factory import name, without needing to rename on import.
+ *
+ * ```typescript
+ import {createDeferred} from '@kwsites/promise-deferred`;
+ ```
+ */
+export declare const createDeferred: typeof deferred;
+/**
+ * Default export allows use as:
+ *
+ * ```typescript
+ import deferred from '@kwsites/promise-deferred`;
+ ```
+ */
+export default deferred;
diff --git a/node_modules/@kwsites/promise-deferred/dist/index.js b/node_modules/@kwsites/promise-deferred/dist/index.js
new file mode 100644
index 0000000..1ffefe6
--- /dev/null
+++ b/node_modules/@kwsites/promise-deferred/dist/index.js
@@ -0,0 +1,59 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.createDeferred = exports.deferred = void 0;
+/**
+ * Creates a new `DeferredPromise`
+ *
+ * ```typescript
+ import {deferred} from '@kwsites/promise-deferred`;
+ ```
+ */
+function deferred() {
+ let done;
+ let fail;
+ let status = 'pending';
+ const promise = new Promise((_done, _fail) => {
+ done = _done;
+ fail = _fail;
+ });
+ return {
+ promise,
+ done(result) {
+ if (status === 'pending') {
+ status = 'resolved';
+ done(result);
+ }
+ },
+ fail(error) {
+ if (status === 'pending') {
+ status = 'rejected';
+ fail(error);
+ }
+ },
+ get fulfilled() {
+ return status !== 'pending';
+ },
+ get status() {
+ return status;
+ },
+ };
+}
+exports.deferred = deferred;
+/**
+ * Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the
+ * local variable name rather than the factory import name, without needing to rename on import.
+ *
+ * ```typescript
+ import {createDeferred} from '@kwsites/promise-deferred`;
+ ```
+ */
+exports.createDeferred = deferred;
+/**
+ * Default export allows use as:
+ *
+ * ```typescript
+ import deferred from '@kwsites/promise-deferred`;
+ ```
+ */
+exports.default = deferred;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/node_modules/@kwsites/promise-deferred/dist/index.js.map b/node_modules/@kwsites/promise-deferred/dist/index.js.map
new file mode 100644
index 0000000..74583ed
--- /dev/null
+++ b/node_modules/@kwsites/promise-deferred/dist/index.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA0BA;;;;;;GAMG;AACH,SAAgB,QAAQ;IACrB,IAAI,IAAyB,CAAC;IAC9B,IAAI,IAAwB,CAAC;IAC7B,IAAI,MAAM,GAA0B,SAAS,CAAC;IAE9C,MAAM,OAAO,GAAe,IAAI,OAAO,CAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACzD,IAAI,GAAG,KAAK,CAAC;QACb,IAAI,GAAG,KAAK,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO;QACJ,OAAO;QACP,IAAI,CAAE,MAAM;YACT,IAAI,MAAM,KAAK,SAAS,EAAE;gBACvB,MAAM,GAAG,UAAU,CAAC;gBACpB,IAAI,CAAC,MAAM,CAAC,CAAC;aACf;QACJ,CAAC;QACD,IAAI,CAAE,KAAK;YACR,IAAI,MAAM,KAAK,SAAS,EAAE;gBACvB,MAAM,GAAG,UAAU,CAAC;gBACpB,IAAI,CAAC,KAAK,CAAC,CAAC;aACd;QACJ,CAAC;QACD,IAAI,SAAS;YACV,OAAO,MAAM,KAAK,SAAS,CAAC;QAC/B,CAAC;QACD,IAAI,MAAM;YACP,OAAO,MAAM,CAAC;QACjB,CAAC;KACH,CAAC;AACL,CAAC;AA/BD,4BA+BC;AAED;;;;;;;GAOG;AACU,QAAA,cAAc,GAAG,QAAQ,CAAC;AAEvC;;;;;;GAMG;AACH,kBAAe,QAAQ,CAAC"}
\ No newline at end of file
diff --git a/node_modules/@kwsites/promise-deferred/package.json b/node_modules/@kwsites/promise-deferred/package.json
new file mode 100644
index 0000000..72dbbf0
--- /dev/null
+++ b/node_modules/@kwsites/promise-deferred/package.json
@@ -0,0 +1,43 @@
+{
+ "name": "@kwsites/promise-deferred",
+ "description": "Minimalist creation of promise wrappers, exposing the ability to resolve or reject the inner promise",
+ "version": "1.1.1",
+ "private": false,
+ "author": "Steve King ",
+ "contributors": [
+ {
+ "name": "Steve King",
+ "email": "steve@mydev.co"
+ }
+ ],
+ "main": "./dist/index",
+ "types": "./dist/index",
+ "license": "MIT",
+ "repository": "git://github.com/kwsites/promise-deferred.git",
+ "devDependencies": {
+ "@babel/core": "^7.10.3",
+ "@babel/preset-env": "^7.10.3",
+ "@babel/preset-typescript": "^7.10.1",
+ "@types/jest": "^26.0.0",
+ "@types/node": "^14.0.13",
+ "babel-jest": "^26.1.0",
+ "babel-preset-env": "^1.7.0",
+ "jest": "^26.1.0",
+ "ts-node": "^8.10.2",
+ "typescript": "^3.9.5"
+ },
+ "files": [
+ "LICENSE",
+ "dist/**/*.*"
+ ],
+ "scripts": {
+ "clean": "git clean -fxd -e .idea -e node_modules",
+ "clean:modules": "git clean -fxd node_modules",
+ "build": "tsc --build",
+ "build:clean": "yarn run clean && tsc",
+ "preversion": "yarn run build:clean && yarn test",
+ "postversion": "npm publish --access=public && git push && git push --tags",
+ "test": "jest --coverage",
+ "tsc": "tsc"
+ }
+}
diff --git a/node_modules/debug/LICENSE b/node_modules/debug/LICENSE
new file mode 100644
index 0000000..1a9820e
--- /dev/null
+++ b/node_modules/debug/LICENSE
@@ -0,0 +1,20 @@
+(The MIT License)
+
+Copyright (c) 2014-2017 TJ Holowaychuk
+Copyright (c) 2018-2021 Josh Junon
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software
+and associated documentation files (the 'Software'), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial
+portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/node_modules/debug/README.md b/node_modules/debug/README.md
new file mode 100644
index 0000000..e9c3e04
--- /dev/null
+++ b/node_modules/debug/README.md
@@ -0,0 +1,481 @@
+# debug
+[![Build Status](https://travis-ci.org/debug-js/debug.svg?branch=master)](https://travis-ci.org/debug-js/debug) [![Coverage Status](https://coveralls.io/repos/github/debug-js/debug/badge.svg?branch=master)](https://coveralls.io/github/debug-js/debug?branch=master) [![Slack](https://visionmedia-community-slackin.now.sh/badge.svg)](https://visionmedia-community-slackin.now.sh/) [![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers)
+[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors)
+
+
+
+A tiny JavaScript debugging utility modelled after Node.js core's debugging
+technique. Works in Node.js and web browsers.
+
+## Installation
+
+```bash
+$ npm install debug
+```
+
+## Usage
+
+`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
+
+Example [_app.js_](./examples/node/app.js):
+
+```js
+var debug = require('debug')('http')
+ , http = require('http')
+ , name = 'My App';
+
+// fake app
+
+debug('booting %o', name);
+
+http.createServer(function(req, res){
+ debug(req.method + ' ' + req.url);
+ res.end('hello\n');
+}).listen(3000, function(){
+ debug('listening');
+});
+
+// fake worker of some kind
+
+require('./worker');
+```
+
+Example [_worker.js_](./examples/node/worker.js):
+
+```js
+var a = require('debug')('worker:a')
+ , b = require('debug')('worker:b');
+
+function work() {
+ a('doing lots of uninteresting work');
+ setTimeout(work, Math.random() * 1000);
+}
+
+work();
+
+function workb() {
+ b('doing some work');
+ setTimeout(workb, Math.random() * 2000);
+}
+
+workb();
+```
+
+The `DEBUG` environment variable is then used to enable these based on space or
+comma-delimited names.
+
+Here are some examples:
+
+
+
+
+
+#### Windows command prompt notes
+
+##### CMD
+
+On Windows the environment variable is set using the `set` command.
+
+```cmd
+set DEBUG=*,-not_this
+```
+
+Example:
+
+```cmd
+set DEBUG=* & node app.js
+```
+
+##### PowerShell (VS Code default)
+
+PowerShell uses different syntax to set environment variables.
+
+```cmd
+$env:DEBUG = "*,-not_this"
+```
+
+Example:
+
+```cmd
+$env:DEBUG='app';node app.js
+```
+
+Then, run the program to be debugged as usual.
+
+npm script example:
+```js
+ "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
+```
+
+## Namespace Colors
+
+Every debug instance has a color generated for it based on its namespace name.
+This helps when visually parsing the debug output to identify which debug instance
+a debug line belongs to.
+
+#### Node.js
+
+In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
+the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
+otherwise debug will only use a small handful of basic colors.
+
+
+
+#### Web Browser
+
+Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
+option. These are WebKit web inspectors, Firefox ([since version
+31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
+and the Firebug plugin for Firefox (any version).
+
+
+
+
+## Millisecond diff
+
+When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
+
+
+
+When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
+
+
+
+
+## Conventions
+
+If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
+
+## Wildcards
+
+The `*` character may be used as a wildcard. Suppose for example your library has
+debuggers named "connect:bodyParser", "connect:compress", "connect:session",
+instead of listing all three with
+`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
+`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
+
+You can also exclude specific debuggers by prefixing them with a "-" character.
+For example, `DEBUG=*,-connect:*` would include all debuggers except those
+starting with "connect:".
+
+## Environment Variables
+
+When running through Node.js, you can set a few environment variables that will
+change the behavior of the debug logging:
+
+| Name | Purpose |
+|-----------|-------------------------------------------------|
+| `DEBUG` | Enables/disables specific debugging namespaces. |
+| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
+| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
+| `DEBUG_DEPTH` | Object inspection depth. |
+| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
+
+
+__Note:__ The environment variables beginning with `DEBUG_` end up being
+converted into an Options object that gets used with `%o`/`%O` formatters.
+See the Node.js documentation for
+[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
+for the complete list.
+
+## Formatters
+
+Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
+Below are the officially supported formatters:
+
+| Formatter | Representation |
+|-----------|----------------|
+| `%O` | Pretty-print an Object on multiple lines. |
+| `%o` | Pretty-print an Object all on a single line. |
+| `%s` | String. |
+| `%d` | Number (both integer and float). |
+| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
+| `%%` | Single percent sign ('%'). This does not consume an argument. |
+
+
+### Custom formatters
+
+You can add custom formatters by extending the `debug.formatters` object.
+For example, if you wanted to add support for rendering a Buffer as hex with
+`%h`, you could do something like:
+
+```js
+const createDebug = require('debug')
+createDebug.formatters.h = (v) => {
+ return v.toString('hex')
+}
+
+// …elsewhere
+const debug = createDebug('foo')
+debug('this is hex: %h', new Buffer('hello world'))
+// foo this is hex: 68656c6c6f20776f726c6421 +0ms
+```
+
+
+## Browser Support
+
+You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
+or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
+if you don't want to build it yourself.
+
+Debug's enable state is currently persisted by `localStorage`.
+Consider the situation shown below where you have `worker:a` and `worker:b`,
+and wish to debug both. You can enable this using `localStorage.debug`:
+
+```js
+localStorage.debug = 'worker:*'
+```
+
+And then refresh the page.
+
+```js
+a = debug('worker:a');
+b = debug('worker:b');
+
+setInterval(function(){
+ a('doing some work');
+}, 1000);
+
+setInterval(function(){
+ b('doing some work');
+}, 1200);
+```
+
+In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
+
+
+
+## Output streams
+
+ By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
+
+Example [_stdout.js_](./examples/node/stdout.js):
+
+```js
+var debug = require('debug');
+var error = debug('app:error');
+
+// by default stderr is used
+error('goes to stderr!');
+
+var log = debug('app:log');
+// set this namespace to log via console.log
+log.log = console.log.bind(console); // don't forget to bind to console!
+log('goes to stdout');
+error('still goes to stderr!');
+
+// set all output to go via console.info
+// overrides all per-namespace log settings
+debug.log = console.info.bind(console);
+error('now goes to stdout via console.info');
+log('still goes to stdout, but via console.info now');
+```
+
+## Extend
+You can simply extend debugger
+```js
+const log = require('debug')('auth');
+
+//creates new debug instance with extended namespace
+const logSign = log.extend('sign');
+const logLogin = log.extend('login');
+
+log('hello'); // auth hello
+logSign('hello'); //auth:sign hello
+logLogin('hello'); //auth:login hello
+```
+
+## Set dynamically
+
+You can also enable debug dynamically by calling the `enable()` method :
+
+```js
+let debug = require('debug');
+
+console.log(1, debug.enabled('test'));
+
+debug.enable('test');
+console.log(2, debug.enabled('test'));
+
+debug.disable();
+console.log(3, debug.enabled('test'));
+
+```
+
+print :
+```
+1 false
+2 true
+3 false
+```
+
+Usage :
+`enable(namespaces)`
+`namespaces` can include modes separated by a colon and wildcards.
+
+Note that calling `enable()` completely overrides previously set DEBUG variable :
+
+```
+$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
+=> false
+```
+
+`disable()`
+
+Will disable all namespaces. The functions returns the namespaces currently
+enabled (and skipped). This can be useful if you want to disable debugging
+temporarily without knowing what was enabled to begin with.
+
+For example:
+
+```js
+let debug = require('debug');
+debug.enable('foo:*,-foo:bar');
+let namespaces = debug.disable();
+debug.enable(namespaces);
+```
+
+Note: There is no guarantee that the string will be identical to the initial
+enable string, but semantically they will be identical.
+
+## Checking whether a debug target is enabled
+
+After you've created a debug instance, you can determine whether or not it is
+enabled by checking the `enabled` property:
+
+```javascript
+const debug = require('debug')('http');
+
+if (debug.enabled) {
+ // do stuff...
+}
+```
+
+You can also manually toggle this property to force the debug instance to be
+enabled or disabled.
+
+## Usage in child processes
+
+Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process.
+For example:
+
+```javascript
+worker = fork(WORKER_WRAP_PATH, [workerPath], {
+ stdio: [
+ /* stdin: */ 0,
+ /* stdout: */ 'pipe',
+ /* stderr: */ 'pipe',
+ 'ipc',
+ ],
+ env: Object.assign({}, process.env, {
+ DEBUG_COLORS: 1 // without this settings, colors won't be shown
+ }),
+});
+
+worker.stderr.pipe(process.stderr, { end: false });
+```
+
+
+## Authors
+
+ - TJ Holowaychuk
+ - Nathan Rajlich
+ - Andrew Rhyne
+ - Josh Junon
+
+## Backers
+
+Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## Sponsors
+
+Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
+Copyright (c) 2018-2021 Josh Junon
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/debug/node_modules/ms/index.js b/node_modules/debug/node_modules/ms/index.js
new file mode 100644
index 0000000..c4498bc
--- /dev/null
+++ b/node_modules/debug/node_modules/ms/index.js
@@ -0,0 +1,162 @@
+/**
+ * Helpers.
+ */
+
+var s = 1000;
+var m = s * 60;
+var h = m * 60;
+var d = h * 24;
+var w = d * 7;
+var y = d * 365.25;
+
+/**
+ * Parse or format the given `val`.
+ *
+ * Options:
+ *
+ * - `long` verbose formatting [false]
+ *
+ * @param {String|Number} val
+ * @param {Object} [options]
+ * @throws {Error} throw an error if val is not a non-empty string or a number
+ * @return {String|Number}
+ * @api public
+ */
+
+module.exports = function(val, options) {
+ options = options || {};
+ var type = typeof val;
+ if (type === 'string' && val.length > 0) {
+ return parse(val);
+ } else if (type === 'number' && isFinite(val)) {
+ return options.long ? fmtLong(val) : fmtShort(val);
+ }
+ throw new Error(
+ 'val is not a non-empty string or a valid number. val=' +
+ JSON.stringify(val)
+ );
+};
+
+/**
+ * Parse the given `str` and return milliseconds.
+ *
+ * @param {String} str
+ * @return {Number}
+ * @api private
+ */
+
+function parse(str) {
+ str = String(str);
+ if (str.length > 100) {
+ return;
+ }
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
+ str
+ );
+ if (!match) {
+ return;
+ }
+ var n = parseFloat(match[1]);
+ var type = (match[2] || 'ms').toLowerCase();
+ switch (type) {
+ case 'years':
+ case 'year':
+ case 'yrs':
+ case 'yr':
+ case 'y':
+ return n * y;
+ case 'weeks':
+ case 'week':
+ case 'w':
+ return n * w;
+ case 'days':
+ case 'day':
+ case 'd':
+ return n * d;
+ case 'hours':
+ case 'hour':
+ case 'hrs':
+ case 'hr':
+ case 'h':
+ return n * h;
+ case 'minutes':
+ case 'minute':
+ case 'mins':
+ case 'min':
+ case 'm':
+ return n * m;
+ case 'seconds':
+ case 'second':
+ case 'secs':
+ case 'sec':
+ case 's':
+ return n * s;
+ case 'milliseconds':
+ case 'millisecond':
+ case 'msecs':
+ case 'msec':
+ case 'ms':
+ return n;
+ default:
+ return undefined;
+ }
+}
+
+/**
+ * Short format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+function fmtShort(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return Math.round(ms / d) + 'd';
+ }
+ if (msAbs >= h) {
+ return Math.round(ms / h) + 'h';
+ }
+ if (msAbs >= m) {
+ return Math.round(ms / m) + 'm';
+ }
+ if (msAbs >= s) {
+ return Math.round(ms / s) + 's';
+ }
+ return ms + 'ms';
+}
+
+/**
+ * Long format for `ms`.
+ *
+ * @param {Number} ms
+ * @return {String}
+ * @api private
+ */
+
+function fmtLong(ms) {
+ var msAbs = Math.abs(ms);
+ if (msAbs >= d) {
+ return plural(ms, msAbs, d, 'day');
+ }
+ if (msAbs >= h) {
+ return plural(ms, msAbs, h, 'hour');
+ }
+ if (msAbs >= m) {
+ return plural(ms, msAbs, m, 'minute');
+ }
+ if (msAbs >= s) {
+ return plural(ms, msAbs, s, 'second');
+ }
+ return ms + ' ms';
+}
+
+/**
+ * Pluralization helper.
+ */
+
+function plural(ms, msAbs, n, name) {
+ var isPlural = msAbs >= n * 1.5;
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
+}
diff --git a/node_modules/debug/node_modules/ms/license.md b/node_modules/debug/node_modules/ms/license.md
new file mode 100644
index 0000000..69b6125
--- /dev/null
+++ b/node_modules/debug/node_modules/ms/license.md
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2016 Zeit, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/debug/node_modules/ms/package.json b/node_modules/debug/node_modules/ms/package.json
new file mode 100644
index 0000000..eea666e
--- /dev/null
+++ b/node_modules/debug/node_modules/ms/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "ms",
+ "version": "2.1.2",
+ "description": "Tiny millisecond conversion utility",
+ "repository": "zeit/ms",
+ "main": "./index",
+ "files": [
+ "index.js"
+ ],
+ "scripts": {
+ "precommit": "lint-staged",
+ "lint": "eslint lib/* bin/*",
+ "test": "mocha tests.js"
+ },
+ "eslintConfig": {
+ "extends": "eslint:recommended",
+ "env": {
+ "node": true,
+ "es6": true
+ }
+ },
+ "lint-staged": {
+ "*.js": [
+ "npm run lint",
+ "prettier --single-quote --write",
+ "git add"
+ ]
+ },
+ "license": "MIT",
+ "devDependencies": {
+ "eslint": "4.12.1",
+ "expect.js": "0.3.1",
+ "husky": "0.14.3",
+ "lint-staged": "5.0.0",
+ "mocha": "4.0.1"
+ }
+}
diff --git a/node_modules/debug/node_modules/ms/readme.md b/node_modules/debug/node_modules/ms/readme.md
new file mode 100644
index 0000000..9a1996b
--- /dev/null
+++ b/node_modules/debug/node_modules/ms/readme.md
@@ -0,0 +1,60 @@
+# ms
+
+[![Build Status](https://travis-ci.org/zeit/ms.svg?branch=master)](https://travis-ci.org/zeit/ms)
+[![Join the community on Spectrum](https://withspectrum.github.io/badge/badge.svg)](https://spectrum.chat/zeit)
+
+Use this package to easily convert various time formats to milliseconds.
+
+## Examples
+
+```js
+ms('2 days') // 172800000
+ms('1d') // 86400000
+ms('10h') // 36000000
+ms('2.5 hrs') // 9000000
+ms('2h') // 7200000
+ms('1m') // 60000
+ms('5s') // 5000
+ms('1y') // 31557600000
+ms('100') // 100
+ms('-3 days') // -259200000
+ms('-1h') // -3600000
+ms('-200') // -200
+```
+
+### Convert from Milliseconds
+
+```js
+ms(60000) // "1m"
+ms(2 * 60000) // "2m"
+ms(-3 * 60000) // "-3m"
+ms(ms('10 hours')) // "10h"
+```
+
+### Time Format Written-Out
+
+```js
+ms(60000, { long: true }) // "1 minute"
+ms(2 * 60000, { long: true }) // "2 minutes"
+ms(-3 * 60000, { long: true }) // "-3 minutes"
+ms(ms('10 hours'), { long: true }) // "10 hours"
+```
+
+## Features
+
+- Works both in [Node.js](https://nodejs.org) and in the browser
+- If a number is supplied to `ms`, a string with a unit is returned
+- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
+- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
+
+## Related Packages
+
+- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
+
+## Caught a Bug?
+
+1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
+2. Link the package to the global module directory: `npm link`
+3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
+
+As always, you can run the tests using: `npm test`
diff --git a/node_modules/debug/package.json b/node_modules/debug/package.json
new file mode 100644
index 0000000..3bcdc24
--- /dev/null
+++ b/node_modules/debug/package.json
@@ -0,0 +1,59 @@
+{
+ "name": "debug",
+ "version": "4.3.4",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/debug-js/debug.git"
+ },
+ "description": "Lightweight debugging utility for Node.js and the browser",
+ "keywords": [
+ "debug",
+ "log",
+ "debugger"
+ ],
+ "files": [
+ "src",
+ "LICENSE",
+ "README.md"
+ ],
+ "author": "Josh Junon ",
+ "contributors": [
+ "TJ Holowaychuk ",
+ "Nathan Rajlich (http://n8.io)",
+ "Andrew Rhyne "
+ ],
+ "license": "MIT",
+ "scripts": {
+ "lint": "xo",
+ "test": "npm run test:node && npm run test:browser && npm run lint",
+ "test:node": "istanbul cover _mocha -- test.js",
+ "test:browser": "karma start --single-run",
+ "test:coverage": "cat ./coverage/lcov.info | coveralls"
+ },
+ "dependencies": {
+ "ms": "2.1.2"
+ },
+ "devDependencies": {
+ "brfs": "^2.0.1",
+ "browserify": "^16.2.3",
+ "coveralls": "^3.0.2",
+ "istanbul": "^0.4.5",
+ "karma": "^3.1.4",
+ "karma-browserify": "^6.0.0",
+ "karma-chrome-launcher": "^2.2.0",
+ "karma-mocha": "^1.3.0",
+ "mocha": "^5.2.0",
+ "mocha-lcov-reporter": "^1.2.0",
+ "xo": "^0.23.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ },
+ "main": "./src/index.js",
+ "browser": "./src/browser.js",
+ "engines": {
+ "node": ">=6.0"
+ }
+}
diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js
new file mode 100644
index 0000000..cd0fc35
--- /dev/null
+++ b/node_modules/debug/src/browser.js
@@ -0,0 +1,269 @@
+/* eslint-env browser */
+
+/**
+ * This is the web browser implementation of `debug()`.
+ */
+
+exports.formatArgs = formatArgs;
+exports.save = save;
+exports.load = load;
+exports.useColors = useColors;
+exports.storage = localstorage();
+exports.destroy = (() => {
+ let warned = false;
+
+ return () => {
+ if (!warned) {
+ warned = true;
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
+ }
+ };
+})();
+
+/**
+ * Colors.
+ */
+
+exports.colors = [
+ '#0000CC',
+ '#0000FF',
+ '#0033CC',
+ '#0033FF',
+ '#0066CC',
+ '#0066FF',
+ '#0099CC',
+ '#0099FF',
+ '#00CC00',
+ '#00CC33',
+ '#00CC66',
+ '#00CC99',
+ '#00CCCC',
+ '#00CCFF',
+ '#3300CC',
+ '#3300FF',
+ '#3333CC',
+ '#3333FF',
+ '#3366CC',
+ '#3366FF',
+ '#3399CC',
+ '#3399FF',
+ '#33CC00',
+ '#33CC33',
+ '#33CC66',
+ '#33CC99',
+ '#33CCCC',
+ '#33CCFF',
+ '#6600CC',
+ '#6600FF',
+ '#6633CC',
+ '#6633FF',
+ '#66CC00',
+ '#66CC33',
+ '#9900CC',
+ '#9900FF',
+ '#9933CC',
+ '#9933FF',
+ '#99CC00',
+ '#99CC33',
+ '#CC0000',
+ '#CC0033',
+ '#CC0066',
+ '#CC0099',
+ '#CC00CC',
+ '#CC00FF',
+ '#CC3300',
+ '#CC3333',
+ '#CC3366',
+ '#CC3399',
+ '#CC33CC',
+ '#CC33FF',
+ '#CC6600',
+ '#CC6633',
+ '#CC9900',
+ '#CC9933',
+ '#CCCC00',
+ '#CCCC33',
+ '#FF0000',
+ '#FF0033',
+ '#FF0066',
+ '#FF0099',
+ '#FF00CC',
+ '#FF00FF',
+ '#FF3300',
+ '#FF3333',
+ '#FF3366',
+ '#FF3399',
+ '#FF33CC',
+ '#FF33FF',
+ '#FF6600',
+ '#FF6633',
+ '#FF9900',
+ '#FF9933',
+ '#FFCC00',
+ '#FFCC33'
+];
+
+/**
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
+ * and the Firebug extension (any Firefox version) are known
+ * to support "%c" CSS customizations.
+ *
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
+ */
+
+// eslint-disable-next-line complexity
+function useColors() {
+ // NB: In an Electron preload script, document will be defined but not fully
+ // initialized. Since we know we're in Chrome, we'll just detect this case
+ // explicitly
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
+ return true;
+ }
+
+ // Internet Explorer and Edge do not support colors.
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
+ return false;
+ }
+
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
+ // Is firebug? http://stackoverflow.com/a/398120/376773
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
+ // Is firefox >= v31?
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
+ // Double check webkit in userAgent just in case we are in a worker
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
+}
+
+/**
+ * Colorize log arguments if enabled.
+ *
+ * @api public
+ */
+
+function formatArgs(args) {
+ args[0] = (this.useColors ? '%c' : '') +
+ this.namespace +
+ (this.useColors ? ' %c' : ' ') +
+ args[0] +
+ (this.useColors ? '%c ' : ' ') +
+ '+' + module.exports.humanize(this.diff);
+
+ if (!this.useColors) {
+ return;
+ }
+
+ const c = 'color: ' + this.color;
+ args.splice(1, 0, c, 'color: inherit');
+
+ // The final "%c" is somewhat tricky, because there could be other
+ // arguments passed either before or after the %c, so we need to
+ // figure out the correct index to insert the CSS into
+ let index = 0;
+ let lastC = 0;
+ args[0].replace(/%[a-zA-Z%]/g, match => {
+ if (match === '%%') {
+ return;
+ }
+ index++;
+ if (match === '%c') {
+ // We only are interested in the *last* %c
+ // (the user may have provided their own)
+ lastC = index;
+ }
+ });
+
+ args.splice(lastC, 0, c);
+}
+
+/**
+ * Invokes `console.debug()` when available.
+ * No-op when `console.debug` is not a "function".
+ * If `console.debug` is not available, falls back
+ * to `console.log`.
+ *
+ * @api public
+ */
+exports.log = console.debug || console.log || (() => {});
+
+/**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+function save(namespaces) {
+ try {
+ if (namespaces) {
+ exports.storage.setItem('debug', namespaces);
+ } else {
+ exports.storage.removeItem('debug');
+ }
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+}
+
+/**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+function load() {
+ let r;
+ try {
+ r = exports.storage.getItem('debug');
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
+ r = process.env.DEBUG;
+ }
+
+ return r;
+}
+
+/**
+ * Localstorage attempts to return the localstorage.
+ *
+ * This is necessary because safari throws
+ * when a user disables cookies/localstorage
+ * and you attempt to access it.
+ *
+ * @return {LocalStorage}
+ * @api private
+ */
+
+function localstorage() {
+ try {
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
+ // The Browser also has localStorage in the global context.
+ return localStorage;
+ } catch (error) {
+ // Swallow
+ // XXX (@Qix-) should we be logging these?
+ }
+}
+
+module.exports = require('./common')(exports);
+
+const {formatters} = module.exports;
+
+/**
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
+ */
+
+formatters.j = function (v) {
+ try {
+ return JSON.stringify(v);
+ } catch (error) {
+ return '[UnexpectedJSONParseError]: ' + error.message;
+ }
+};
diff --git a/node_modules/debug/src/common.js b/node_modules/debug/src/common.js
new file mode 100644
index 0000000..e3291b2
--- /dev/null
+++ b/node_modules/debug/src/common.js
@@ -0,0 +1,274 @@
+
+/**
+ * This is the common logic for both the Node.js and web browser
+ * implementations of `debug()`.
+ */
+
+function setup(env) {
+ createDebug.debug = createDebug;
+ createDebug.default = createDebug;
+ createDebug.coerce = coerce;
+ createDebug.disable = disable;
+ createDebug.enable = enable;
+ createDebug.enabled = enabled;
+ createDebug.humanize = require('ms');
+ createDebug.destroy = destroy;
+
+ Object.keys(env).forEach(key => {
+ createDebug[key] = env[key];
+ });
+
+ /**
+ * The currently active debug mode names, and names to skip.
+ */
+
+ createDebug.names = [];
+ createDebug.skips = [];
+
+ /**
+ * Map of special "%n" handling functions, for the debug "format" argument.
+ *
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
+ */
+ createDebug.formatters = {};
+
+ /**
+ * Selects a color for a debug namespace
+ * @param {String} namespace The namespace string for the debug instance to be colored
+ * @return {Number|String} An ANSI color code for the given namespace
+ * @api private
+ */
+ function selectColor(namespace) {
+ let hash = 0;
+
+ for (let i = 0; i < namespace.length; i++) {
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
+ hash |= 0; // Convert to 32bit integer
+ }
+
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
+ }
+ createDebug.selectColor = selectColor;
+
+ /**
+ * Create a debugger with the given `namespace`.
+ *
+ * @param {String} namespace
+ * @return {Function}
+ * @api public
+ */
+ function createDebug(namespace) {
+ let prevTime;
+ let enableOverride = null;
+ let namespacesCache;
+ let enabledCache;
+
+ function debug(...args) {
+ // Disabled?
+ if (!debug.enabled) {
+ return;
+ }
+
+ const self = debug;
+
+ // Set `diff` timestamp
+ const curr = Number(new Date());
+ const ms = curr - (prevTime || curr);
+ self.diff = ms;
+ self.prev = prevTime;
+ self.curr = curr;
+ prevTime = curr;
+
+ args[0] = createDebug.coerce(args[0]);
+
+ if (typeof args[0] !== 'string') {
+ // Anything else let's inspect with %O
+ args.unshift('%O');
+ }
+
+ // Apply any `formatters` transformations
+ let index = 0;
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
+ // If we encounter an escaped % then don't increase the array index
+ if (match === '%%') {
+ return '%';
+ }
+ index++;
+ const formatter = createDebug.formatters[format];
+ if (typeof formatter === 'function') {
+ const val = args[index];
+ match = formatter.call(self, val);
+
+ // Now we need to remove `args[index]` since it's inlined in the `format`
+ args.splice(index, 1);
+ index--;
+ }
+ return match;
+ });
+
+ // Apply env-specific formatting (colors, etc.)
+ createDebug.formatArgs.call(self, args);
+
+ const logFn = self.log || createDebug.log;
+ logFn.apply(self, args);
+ }
+
+ debug.namespace = namespace;
+ debug.useColors = createDebug.useColors();
+ debug.color = createDebug.selectColor(namespace);
+ debug.extend = extend;
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
+
+ Object.defineProperty(debug, 'enabled', {
+ enumerable: true,
+ configurable: false,
+ get: () => {
+ if (enableOverride !== null) {
+ return enableOverride;
+ }
+ if (namespacesCache !== createDebug.namespaces) {
+ namespacesCache = createDebug.namespaces;
+ enabledCache = createDebug.enabled(namespace);
+ }
+
+ return enabledCache;
+ },
+ set: v => {
+ enableOverride = v;
+ }
+ });
+
+ // Env-specific initialization logic for debug instances
+ if (typeof createDebug.init === 'function') {
+ createDebug.init(debug);
+ }
+
+ return debug;
+ }
+
+ function extend(namespace, delimiter) {
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
+ newDebug.log = this.log;
+ return newDebug;
+ }
+
+ /**
+ * Enables a debug mode by namespaces. This can include modes
+ * separated by a colon and wildcards.
+ *
+ * @param {String} namespaces
+ * @api public
+ */
+ function enable(namespaces) {
+ createDebug.save(namespaces);
+ createDebug.namespaces = namespaces;
+
+ createDebug.names = [];
+ createDebug.skips = [];
+
+ let i;
+ const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
+ const len = split.length;
+
+ for (i = 0; i < len; i++) {
+ if (!split[i]) {
+ // ignore empty strings
+ continue;
+ }
+
+ namespaces = split[i].replace(/\*/g, '.*?');
+
+ if (namespaces[0] === '-') {
+ createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
+ } else {
+ createDebug.names.push(new RegExp('^' + namespaces + '$'));
+ }
+ }
+ }
+
+ /**
+ * Disable debug output.
+ *
+ * @return {String} namespaces
+ * @api public
+ */
+ function disable() {
+ const namespaces = [
+ ...createDebug.names.map(toNamespace),
+ ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
+ ].join(',');
+ createDebug.enable('');
+ return namespaces;
+ }
+
+ /**
+ * Returns true if the given mode name is enabled, false otherwise.
+ *
+ * @param {String} name
+ * @return {Boolean}
+ * @api public
+ */
+ function enabled(name) {
+ if (name[name.length - 1] === '*') {
+ return true;
+ }
+
+ let i;
+ let len;
+
+ for (i = 0, len = createDebug.skips.length; i < len; i++) {
+ if (createDebug.skips[i].test(name)) {
+ return false;
+ }
+ }
+
+ for (i = 0, len = createDebug.names.length; i < len; i++) {
+ if (createDebug.names[i].test(name)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Convert regexp to namespace
+ *
+ * @param {RegExp} regxep
+ * @return {String} namespace
+ * @api private
+ */
+ function toNamespace(regexp) {
+ return regexp.toString()
+ .substring(2, regexp.toString().length - 2)
+ .replace(/\.\*\?$/, '*');
+ }
+
+ /**
+ * Coerce `val`.
+ *
+ * @param {Mixed} val
+ * @return {Mixed}
+ * @api private
+ */
+ function coerce(val) {
+ if (val instanceof Error) {
+ return val.stack || val.message;
+ }
+ return val;
+ }
+
+ /**
+ * XXX DO NOT USE. This is a temporary stub function.
+ * XXX It WILL be removed in the next major release.
+ */
+ function destroy() {
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
+ }
+
+ createDebug.enable(createDebug.load());
+
+ return createDebug;
+}
+
+module.exports = setup;
diff --git a/node_modules/debug/src/index.js b/node_modules/debug/src/index.js
new file mode 100644
index 0000000..bf4c57f
--- /dev/null
+++ b/node_modules/debug/src/index.js
@@ -0,0 +1,10 @@
+/**
+ * Detect Electron renderer / nwjs process, which is node, but we should
+ * treat as a browser.
+ */
+
+if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
+ module.exports = require('./browser.js');
+} else {
+ module.exports = require('./node.js');
+}
diff --git a/node_modules/debug/src/node.js b/node_modules/debug/src/node.js
new file mode 100644
index 0000000..79bc085
--- /dev/null
+++ b/node_modules/debug/src/node.js
@@ -0,0 +1,263 @@
+/**
+ * Module dependencies.
+ */
+
+const tty = require('tty');
+const util = require('util');
+
+/**
+ * This is the Node.js implementation of `debug()`.
+ */
+
+exports.init = init;
+exports.log = log;
+exports.formatArgs = formatArgs;
+exports.save = save;
+exports.load = load;
+exports.useColors = useColors;
+exports.destroy = util.deprecate(
+ () => {},
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
+);
+
+/**
+ * Colors.
+ */
+
+exports.colors = [6, 2, 3, 4, 5, 1];
+
+try {
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
+ // eslint-disable-next-line import/no-extraneous-dependencies
+ const supportsColor = require('supports-color');
+
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
+ exports.colors = [
+ 20,
+ 21,
+ 26,
+ 27,
+ 32,
+ 33,
+ 38,
+ 39,
+ 40,
+ 41,
+ 42,
+ 43,
+ 44,
+ 45,
+ 56,
+ 57,
+ 62,
+ 63,
+ 68,
+ 69,
+ 74,
+ 75,
+ 76,
+ 77,
+ 78,
+ 79,
+ 80,
+ 81,
+ 92,
+ 93,
+ 98,
+ 99,
+ 112,
+ 113,
+ 128,
+ 129,
+ 134,
+ 135,
+ 148,
+ 149,
+ 160,
+ 161,
+ 162,
+ 163,
+ 164,
+ 165,
+ 166,
+ 167,
+ 168,
+ 169,
+ 170,
+ 171,
+ 172,
+ 173,
+ 178,
+ 179,
+ 184,
+ 185,
+ 196,
+ 197,
+ 198,
+ 199,
+ 200,
+ 201,
+ 202,
+ 203,
+ 204,
+ 205,
+ 206,
+ 207,
+ 208,
+ 209,
+ 214,
+ 215,
+ 220,
+ 221
+ ];
+ }
+} catch (error) {
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
+}
+
+/**
+ * Build up the default `inspectOpts` object from the environment variables.
+ *
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
+ */
+
+exports.inspectOpts = Object.keys(process.env).filter(key => {
+ return /^debug_/i.test(key);
+}).reduce((obj, key) => {
+ // Camel-case
+ const prop = key
+ .substring(6)
+ .toLowerCase()
+ .replace(/_([a-z])/g, (_, k) => {
+ return k.toUpperCase();
+ });
+
+ // Coerce string value into JS value
+ let val = process.env[key];
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
+ val = true;
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
+ val = false;
+ } else if (val === 'null') {
+ val = null;
+ } else {
+ val = Number(val);
+ }
+
+ obj[prop] = val;
+ return obj;
+}, {});
+
+/**
+ * Is stdout a TTY? Colored output is enabled when `true`.
+ */
+
+function useColors() {
+ return 'colors' in exports.inspectOpts ?
+ Boolean(exports.inspectOpts.colors) :
+ tty.isatty(process.stderr.fd);
+}
+
+/**
+ * Adds ANSI color escape codes if enabled.
+ *
+ * @api public
+ */
+
+function formatArgs(args) {
+ const {namespace: name, useColors} = this;
+
+ if (useColors) {
+ const c = this.color;
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
+
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
+ } else {
+ args[0] = getDate() + name + ' ' + args[0];
+ }
+}
+
+function getDate() {
+ if (exports.inspectOpts.hideDate) {
+ return '';
+ }
+ return new Date().toISOString() + ' ';
+}
+
+/**
+ * Invokes `util.format()` with the specified arguments and writes to stderr.
+ */
+
+function log(...args) {
+ return process.stderr.write(util.format(...args) + '\n');
+}
+
+/**
+ * Save `namespaces`.
+ *
+ * @param {String} namespaces
+ * @api private
+ */
+function save(namespaces) {
+ if (namespaces) {
+ process.env.DEBUG = namespaces;
+ } else {
+ // If you set a process.env field to null or undefined, it gets cast to the
+ // string 'null' or 'undefined'. Just delete instead.
+ delete process.env.DEBUG;
+ }
+}
+
+/**
+ * Load `namespaces`.
+ *
+ * @return {String} returns the previously persisted debug modes
+ * @api private
+ */
+
+function load() {
+ return process.env.DEBUG;
+}
+
+/**
+ * Init logic for `debug` instances.
+ *
+ * Create a new `inspectOpts` object in case `useColors` is set
+ * differently for a particular `debug` instance.
+ */
+
+function init(debug) {
+ debug.inspectOpts = {};
+
+ const keys = Object.keys(exports.inspectOpts);
+ for (let i = 0; i < keys.length; i++) {
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
+ }
+}
+
+module.exports = require('./common')(exports);
+
+const {formatters} = module.exports;
+
+/**
+ * Map %o to `util.inspect()`, all on a single line.
+ */
+
+formatters.o = function (v) {
+ this.inspectOpts.colors = this.useColors;
+ return util.inspect(v, this.inspectOpts)
+ .split('\n')
+ .map(str => str.trim())
+ .join(' ');
+};
+
+/**
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
+ */
+
+formatters.O = function (v) {
+ this.inspectOpts.colors = this.useColors;
+ return util.inspect(v, this.inspectOpts);
+};
diff --git a/node_modules/simple-git/dist/cjs/index.js b/node_modules/simple-git/dist/cjs/index.js
new file mode 100644
index 0000000..8b569aa
--- /dev/null
+++ b/node_modules/simple-git/dist/cjs/index.js
@@ -0,0 +1,4907 @@
+"use strict";
+var __create = Object.create;
+var __defProp = Object.defineProperty;
+var __defProps = Object.defineProperties;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __getOwnPropSymbols = Object.getOwnPropertySymbols;
+var __getProtoOf = Object.getPrototypeOf;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __propIsEnum = Object.prototype.propertyIsEnumerable;
+var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+var __spreadValues = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp.call(b, prop))
+ __defNormalProp(a, prop, b[prop]);
+ if (__getOwnPropSymbols)
+ for (var prop of __getOwnPropSymbols(b)) {
+ if (__propIsEnum.call(b, prop))
+ __defNormalProp(a, prop, b[prop]);
+ }
+ return a;
+};
+var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
+var __esm = (fn, res) => function __init() {
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
+};
+var __commonJS = (cb, mod) => function __require() {
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+};
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
+};
+var __copyProps = (to, from, except, desc) => {
+ if (from && typeof from === "object" || typeof from === "function") {
+ for (let key of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to, key) && key !== except)
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+ }
+ return to;
+};
+var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
+ mod
+));
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+var __async = (__this, __arguments, generator) => {
+ return new Promise((resolve, reject) => {
+ var fulfilled = (value) => {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var rejected = (value) => {
+ try {
+ step(generator.throw(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
+ step((generator = generator.apply(__this, __arguments)).next());
+ });
+};
+
+// src/lib/errors/git-error.ts
+var GitError;
+var init_git_error = __esm({
+ "src/lib/errors/git-error.ts"() {
+ "use strict";
+ GitError = class extends Error {
+ constructor(task, message) {
+ super(message);
+ this.task = task;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+ };
+ }
+});
+
+// src/lib/errors/git-response-error.ts
+var GitResponseError;
+var init_git_response_error = __esm({
+ "src/lib/errors/git-response-error.ts"() {
+ "use strict";
+ init_git_error();
+ GitResponseError = class extends GitError {
+ constructor(git, message) {
+ super(void 0, message || String(git));
+ this.git = git;
+ }
+ };
+ }
+});
+
+// src/lib/args/pathspec.ts
+function pathspec(...paths) {
+ const key = new String(paths);
+ cache.set(key, paths);
+ return key;
+}
+function isPathSpec(path) {
+ return path instanceof String && cache.has(path);
+}
+function toPaths(pathSpec) {
+ return cache.get(pathSpec) || [];
+}
+var cache;
+var init_pathspec = __esm({
+ "src/lib/args/pathspec.ts"() {
+ "use strict";
+ cache = /* @__PURE__ */ new WeakMap();
+ }
+});
+
+// src/lib/errors/git-construct-error.ts
+var GitConstructError;
+var init_git_construct_error = __esm({
+ "src/lib/errors/git-construct-error.ts"() {
+ "use strict";
+ init_git_error();
+ GitConstructError = class extends GitError {
+ constructor(config, message) {
+ super(void 0, message);
+ this.config = config;
+ }
+ };
+ }
+});
+
+// src/lib/errors/git-plugin-error.ts
+var GitPluginError;
+var init_git_plugin_error = __esm({
+ "src/lib/errors/git-plugin-error.ts"() {
+ "use strict";
+ init_git_error();
+ GitPluginError = class extends GitError {
+ constructor(task, plugin, message) {
+ super(task, message);
+ this.task = task;
+ this.plugin = plugin;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+ };
+ }
+});
+
+// src/lib/errors/task-configuration-error.ts
+var TaskConfigurationError;
+var init_task_configuration_error = __esm({
+ "src/lib/errors/task-configuration-error.ts"() {
+ "use strict";
+ init_git_error();
+ TaskConfigurationError = class extends GitError {
+ constructor(message) {
+ super(void 0, message);
+ }
+ };
+ }
+});
+
+// src/lib/utils/util.ts
+function asFunction(source) {
+ return typeof source === "function" ? source : NOOP;
+}
+function isUserFunction(source) {
+ return typeof source === "function" && source !== NOOP;
+}
+function splitOn(input, char) {
+ const index = input.indexOf(char);
+ if (index <= 0) {
+ return [input, ""];
+ }
+ return [input.substr(0, index), input.substr(index + 1)];
+}
+function first(input, offset = 0) {
+ return isArrayLike(input) && input.length > offset ? input[offset] : void 0;
+}
+function last(input, offset = 0) {
+ if (isArrayLike(input) && input.length > offset) {
+ return input[input.length - 1 - offset];
+ }
+}
+function isArrayLike(input) {
+ return !!(input && typeof input.length === "number");
+}
+function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
+ return input.split(separator).reduce((output, line) => {
+ const lineContent = trimmed2 ? line.trim() : line;
+ if (lineContent) {
+ output.push(lineContent);
+ }
+ return output;
+ }, []);
+}
+function forEachLineWithContent(input, callback) {
+ return toLinesWithContent(input, true).map((line) => callback(line));
+}
+function folderExists(path) {
+ return (0, import_file_exists.exists)(path, import_file_exists.FOLDER);
+}
+function append(target, item) {
+ if (Array.isArray(target)) {
+ if (!target.includes(item)) {
+ target.push(item);
+ }
+ } else {
+ target.add(item);
+ }
+ return item;
+}
+function including(target, item) {
+ if (Array.isArray(target) && !target.includes(item)) {
+ target.push(item);
+ }
+ return target;
+}
+function remove(target, item) {
+ if (Array.isArray(target)) {
+ const index = target.indexOf(item);
+ if (index >= 0) {
+ target.splice(index, 1);
+ }
+ } else {
+ target.delete(item);
+ }
+ return item;
+}
+function asArray(source) {
+ return Array.isArray(source) ? source : [source];
+}
+function asStringArray(source) {
+ return asArray(source).map(String);
+}
+function asNumber(source, onNaN = 0) {
+ if (source == null) {
+ return onNaN;
+ }
+ const num = parseInt(source, 10);
+ return isNaN(num) ? onNaN : num;
+}
+function prefixedArray(input, prefix) {
+ const output = [];
+ for (let i = 0, max = input.length; i < max; i++) {
+ output.push(prefix, input[i]);
+ }
+ return output;
+}
+function bufferToString(input) {
+ return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8");
+}
+function pick(source, properties) {
+ return Object.assign(
+ {},
+ ...properties.map((property) => property in source ? { [property]: source[property] } : {})
+ );
+}
+function delay(duration = 0) {
+ return new Promise((done) => setTimeout(done, duration));
+}
+function orVoid(input) {
+ if (input === false) {
+ return void 0;
+ }
+ return input;
+}
+var import_file_exists, NULL, NOOP, objectToString;
+var init_util = __esm({
+ "src/lib/utils/util.ts"() {
+ "use strict";
+ import_file_exists = require("@kwsites/file-exists");
+ NULL = "\0";
+ NOOP = () => {
+ };
+ objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);
+ }
+});
+
+// src/lib/utils/argument-filters.ts
+function filterType(input, filter, def) {
+ if (filter(input)) {
+ return input;
+ }
+ return arguments.length > 2 ? def : void 0;
+}
+function filterPrimitives(input, omit) {
+ const type = isPathSpec(input) ? "string" : typeof input;
+ return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));
+}
+function filterPlainObject(input) {
+ return !!input && objectToString(input) === "[object Object]";
+}
+function filterFunction(input) {
+ return typeof input === "function";
+}
+var filterArray, filterString, filterStringArray, filterStringOrStringArray, filterHasLength;
+var init_argument_filters = __esm({
+ "src/lib/utils/argument-filters.ts"() {
+ "use strict";
+ init_util();
+ init_pathspec();
+ filterArray = (input) => {
+ return Array.isArray(input);
+ };
+ filterString = (input) => {
+ return typeof input === "string";
+ };
+ filterStringArray = (input) => {
+ return Array.isArray(input) && input.every(filterString);
+ };
+ filterStringOrStringArray = (input) => {
+ return filterString(input) || Array.isArray(input) && input.every(filterString);
+ };
+ filterHasLength = (input) => {
+ if (input == null || "number|boolean|function".includes(typeof input)) {
+ return false;
+ }
+ return Array.isArray(input) || typeof input === "string" || typeof input.length === "number";
+ };
+ }
+});
+
+// src/lib/utils/exit-codes.ts
+var ExitCodes;
+var init_exit_codes = __esm({
+ "src/lib/utils/exit-codes.ts"() {
+ "use strict";
+ ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
+ ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
+ ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
+ ExitCodes2[ExitCodes2["NOT_FOUND"] = -2] = "NOT_FOUND";
+ ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN";
+ return ExitCodes2;
+ })(ExitCodes || {});
+ }
+});
+
+// src/lib/utils/git-output-streams.ts
+var GitOutputStreams;
+var init_git_output_streams = __esm({
+ "src/lib/utils/git-output-streams.ts"() {
+ "use strict";
+ GitOutputStreams = class {
+ constructor(stdOut, stdErr) {
+ this.stdOut = stdOut;
+ this.stdErr = stdErr;
+ }
+ asStrings() {
+ return new GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
+ }
+ };
+ }
+});
+
+// src/lib/utils/line-parser.ts
+var LineParser, RemoteLineParser;
+var init_line_parser = __esm({
+ "src/lib/utils/line-parser.ts"() {
+ "use strict";
+ LineParser = class {
+ constructor(regExp, useMatches) {
+ this.matches = [];
+ this.parse = (line, target) => {
+ this.resetMatches();
+ if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
+ return false;
+ }
+ return this.useMatches(target, this.prepareMatches()) !== false;
+ };
+ this._regExp = Array.isArray(regExp) ? regExp : [regExp];
+ if (useMatches) {
+ this.useMatches = useMatches;
+ }
+ }
+ useMatches(target, match) {
+ throw new Error(`LineParser:useMatches not implemented`);
+ }
+ resetMatches() {
+ this.matches.length = 0;
+ }
+ prepareMatches() {
+ return this.matches;
+ }
+ addMatch(reg, index, line) {
+ const matched = line && reg.exec(line);
+ if (matched) {
+ this.pushMatch(index, matched);
+ }
+ return !!matched;
+ }
+ pushMatch(_index, matched) {
+ this.matches.push(...matched.slice(1));
+ }
+ };
+ RemoteLineParser = class extends LineParser {
+ addMatch(reg, index, line) {
+ return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
+ }
+ pushMatch(index, matched) {
+ if (index > 0 || matched.length > 1) {
+ super.pushMatch(index, matched);
+ }
+ }
+ };
+ }
+});
+
+// src/lib/utils/simple-git-options.ts
+function createInstanceConfig(...options) {
+ const baseDir = process.cwd();
+ const config = Object.assign(
+ __spreadValues({ baseDir }, defaultOptions),
+ ...options.filter((o) => typeof o === "object" && o)
+ );
+ config.baseDir = config.baseDir || baseDir;
+ config.trimmed = config.trimmed === true;
+ return config;
+}
+var defaultOptions;
+var init_simple_git_options = __esm({
+ "src/lib/utils/simple-git-options.ts"() {
+ "use strict";
+ defaultOptions = {
+ binary: "git",
+ maxConcurrentProcesses: 5,
+ config: [],
+ trimmed: false
+ };
+ }
+});
+
+// src/lib/utils/task-options.ts
+function appendTaskOptions(options, commands = []) {
+ if (!filterPlainObject(options)) {
+ return commands;
+ }
+ return Object.keys(options).reduce((commands2, key) => {
+ const value = options[key];
+ if (isPathSpec(value)) {
+ commands2.push(value);
+ } else if (filterPrimitives(value, ["boolean"])) {
+ commands2.push(key + "=" + value);
+ } else {
+ commands2.push(key);
+ }
+ return commands2;
+ }, commands);
+}
+function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
+ const command = [];
+ for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {
+ if ("string|number".includes(typeof args[i])) {
+ command.push(String(args[i]));
+ }
+ }
+ appendTaskOptions(trailingOptionsArgument(args), command);
+ if (!objectOnly) {
+ command.push(...trailingArrayArgument(args));
+ }
+ return command;
+}
+function trailingArrayArgument(args) {
+ const hasTrailingCallback = typeof last(args) === "function";
+ return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []);
+}
+function trailingOptionsArgument(args) {
+ const hasTrailingCallback = filterFunction(last(args));
+ return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);
+}
+function trailingFunctionArgument(args, includeNoop = true) {
+ const callback = asFunction(last(args));
+ return includeNoop || isUserFunction(callback) ? callback : void 0;
+}
+var init_task_options = __esm({
+ "src/lib/utils/task-options.ts"() {
+ "use strict";
+ init_argument_filters();
+ init_util();
+ init_pathspec();
+ }
+});
+
+// src/lib/utils/task-parser.ts
+function callTaskParser(parser3, streams) {
+ return parser3(streams.stdOut, streams.stdErr);
+}
+function parseStringResponse(result, parsers12, texts, trim = true) {
+ asArray(texts).forEach((text) => {
+ for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {
+ const line = (offset = 0) => {
+ if (i + offset >= max) {
+ return;
+ }
+ return lines[i + offset];
+ };
+ parsers12.some(({ parse }) => parse(line, result));
+ }
+ });
+ return result;
+}
+var init_task_parser = __esm({
+ "src/lib/utils/task-parser.ts"() {
+ "use strict";
+ init_util();
+ }
+});
+
+// src/lib/utils/index.ts
+var utils_exports = {};
+__export(utils_exports, {
+ ExitCodes: () => ExitCodes,
+ GitOutputStreams: () => GitOutputStreams,
+ LineParser: () => LineParser,
+ NOOP: () => NOOP,
+ NULL: () => NULL,
+ RemoteLineParser: () => RemoteLineParser,
+ append: () => append,
+ appendTaskOptions: () => appendTaskOptions,
+ asArray: () => asArray,
+ asFunction: () => asFunction,
+ asNumber: () => asNumber,
+ asStringArray: () => asStringArray,
+ bufferToString: () => bufferToString,
+ callTaskParser: () => callTaskParser,
+ createInstanceConfig: () => createInstanceConfig,
+ delay: () => delay,
+ filterArray: () => filterArray,
+ filterFunction: () => filterFunction,
+ filterHasLength: () => filterHasLength,
+ filterPlainObject: () => filterPlainObject,
+ filterPrimitives: () => filterPrimitives,
+ filterString: () => filterString,
+ filterStringArray: () => filterStringArray,
+ filterStringOrStringArray: () => filterStringOrStringArray,
+ filterType: () => filterType,
+ first: () => first,
+ folderExists: () => folderExists,
+ forEachLineWithContent: () => forEachLineWithContent,
+ getTrailingOptions: () => getTrailingOptions,
+ including: () => including,
+ isUserFunction: () => isUserFunction,
+ last: () => last,
+ objectToString: () => objectToString,
+ orVoid: () => orVoid,
+ parseStringResponse: () => parseStringResponse,
+ pick: () => pick,
+ prefixedArray: () => prefixedArray,
+ remove: () => remove,
+ splitOn: () => splitOn,
+ toLinesWithContent: () => toLinesWithContent,
+ trailingFunctionArgument: () => trailingFunctionArgument,
+ trailingOptionsArgument: () => trailingOptionsArgument
+});
+var init_utils = __esm({
+ "src/lib/utils/index.ts"() {
+ "use strict";
+ init_argument_filters();
+ init_exit_codes();
+ init_git_output_streams();
+ init_line_parser();
+ init_simple_git_options();
+ init_task_options();
+ init_task_parser();
+ init_util();
+ }
+});
+
+// src/lib/tasks/check-is-repo.ts
+var check_is_repo_exports = {};
+__export(check_is_repo_exports, {
+ CheckRepoActions: () => CheckRepoActions,
+ checkIsBareRepoTask: () => checkIsBareRepoTask,
+ checkIsRepoRootTask: () => checkIsRepoRootTask,
+ checkIsRepoTask: () => checkIsRepoTask
+});
+function checkIsRepoTask(action) {
+ switch (action) {
+ case "bare" /* BARE */:
+ return checkIsBareRepoTask();
+ case "root" /* IS_REPO_ROOT */:
+ return checkIsRepoRootTask();
+ }
+ const commands = ["rev-parse", "--is-inside-work-tree"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser
+ };
+}
+function checkIsRepoRootTask() {
+ const commands = ["rev-parse", "--git-dir"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser(path) {
+ return /^\.(git)?$/.test(path.trim());
+ }
+ };
+}
+function checkIsBareRepoTask() {
+ const commands = ["rev-parse", "--is-bare-repository"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser
+ };
+}
+function isNotRepoMessage(error) {
+ return /(Not a git repository|Kein Git-Repository)/i.test(String(error));
+}
+var CheckRepoActions, onError, parser;
+var init_check_is_repo = __esm({
+ "src/lib/tasks/check-is-repo.ts"() {
+ "use strict";
+ init_utils();
+ CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
+ CheckRepoActions2["BARE"] = "bare";
+ CheckRepoActions2["IN_TREE"] = "tree";
+ CheckRepoActions2["IS_REPO_ROOT"] = "root";
+ return CheckRepoActions2;
+ })(CheckRepoActions || {});
+ onError = ({ exitCode }, error, done, fail) => {
+ if (exitCode === 128 /* UNCLEAN */ && isNotRepoMessage(error)) {
+ return done(Buffer.from("false"));
+ }
+ fail(error);
+ };
+ parser = (text) => {
+ return text.trim() === "true";
+ };
+ }
+});
+
+// src/lib/responses/CleanSummary.ts
+function cleanSummaryParser(dryRun, text) {
+ const summary = new CleanResponse(dryRun);
+ const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
+ toLinesWithContent(text).forEach((line) => {
+ const removed = line.replace(regexp, "");
+ summary.paths.push(removed);
+ (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
+ });
+ return summary;
+}
+var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp;
+var init_CleanSummary = __esm({
+ "src/lib/responses/CleanSummary.ts"() {
+ "use strict";
+ init_utils();
+ CleanResponse = class {
+ constructor(dryRun) {
+ this.dryRun = dryRun;
+ this.paths = [];
+ this.files = [];
+ this.folders = [];
+ }
+ };
+ removalRegexp = /^[a-z]+\s*/i;
+ dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
+ isFolderRegexp = /\/$/;
+ }
+});
+
+// src/lib/tasks/task.ts
+var task_exports = {};
+__export(task_exports, {
+ EMPTY_COMMANDS: () => EMPTY_COMMANDS,
+ adhocExecTask: () => adhocExecTask,
+ configurationErrorTask: () => configurationErrorTask,
+ isBufferTask: () => isBufferTask,
+ isEmptyTask: () => isEmptyTask,
+ straightThroughBufferTask: () => straightThroughBufferTask,
+ straightThroughStringTask: () => straightThroughStringTask
+});
+function adhocExecTask(parser3) {
+ return {
+ commands: EMPTY_COMMANDS,
+ format: "empty",
+ parser: parser3
+ };
+}
+function configurationErrorTask(error) {
+ return {
+ commands: EMPTY_COMMANDS,
+ format: "empty",
+ parser() {
+ throw typeof error === "string" ? new TaskConfigurationError(error) : error;
+ }
+ };
+}
+function straightThroughStringTask(commands, trimmed2 = false) {
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return trimmed2 ? String(text).trim() : text;
+ }
+ };
+}
+function straightThroughBufferTask(commands) {
+ return {
+ commands,
+ format: "buffer",
+ parser(buffer) {
+ return buffer;
+ }
+ };
+}
+function isBufferTask(task) {
+ return task.format === "buffer";
+}
+function isEmptyTask(task) {
+ return task.format === "empty" || !task.commands.length;
+}
+var EMPTY_COMMANDS;
+var init_task = __esm({
+ "src/lib/tasks/task.ts"() {
+ "use strict";
+ init_task_configuration_error();
+ EMPTY_COMMANDS = [];
+ }
+});
+
+// src/lib/tasks/clean.ts
+var clean_exports = {};
+__export(clean_exports, {
+ CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,
+ CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,
+ CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,
+ CleanOptions: () => CleanOptions,
+ cleanTask: () => cleanTask,
+ cleanWithOptionsTask: () => cleanWithOptionsTask,
+ isCleanOptionsArray: () => isCleanOptionsArray
+});
+function cleanWithOptionsTask(mode, customArgs) {
+ const { cleanMode, options, valid } = getCleanOptions(mode);
+ if (!cleanMode) {
+ return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);
+ }
+ if (!valid.options) {
+ return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
+ }
+ options.push(...customArgs);
+ if (options.some(isInteractiveMode)) {
+ return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);
+ }
+ return cleanTask(cleanMode, options);
+}
+function cleanTask(mode, customArgs) {
+ const commands = ["clean", `-${mode}`, ...customArgs];
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return cleanSummaryParser(mode === "n" /* DRY_RUN */, text);
+ }
+ };
+}
+function isCleanOptionsArray(input) {
+ return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));
+}
+function getCleanOptions(input) {
+ let cleanMode;
+ let options = [];
+ let valid = { cleanMode: false, options: true };
+ input.replace(/[^a-z]i/g, "").split("").forEach((char) => {
+ if (isCleanMode(char)) {
+ cleanMode = char;
+ valid.cleanMode = true;
+ } else {
+ valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);
+ }
+ });
+ return {
+ cleanMode,
+ options,
+ valid
+ };
+}
+function isCleanMode(cleanMode) {
+ return cleanMode === "f" /* FORCE */ || cleanMode === "n" /* DRY_RUN */;
+}
+function isKnownOption(option) {
+ return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
+}
+function isInteractiveMode(option) {
+ if (/^-[^\-]/.test(option)) {
+ return option.indexOf("i") > 0;
+ }
+ return option === "--interactive";
+}
+var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues;
+var init_clean = __esm({
+ "src/lib/tasks/clean.ts"() {
+ "use strict";
+ init_CleanSummary();
+ init_utils();
+ init_task();
+ CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported";
+ CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required';
+ CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: ";
+ CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {
+ CleanOptions2["DRY_RUN"] = "n";
+ CleanOptions2["FORCE"] = "f";
+ CleanOptions2["IGNORED_INCLUDED"] = "x";
+ CleanOptions2["IGNORED_ONLY"] = "X";
+ CleanOptions2["EXCLUDING"] = "e";
+ CleanOptions2["QUIET"] = "q";
+ CleanOptions2["RECURSIVE"] = "d";
+ return CleanOptions2;
+ })(CleanOptions || {});
+ CleanOptionValues = /* @__PURE__ */ new Set([
+ "i",
+ ...asStringArray(Object.values(CleanOptions))
+ ]);
+ }
+});
+
+// src/lib/responses/ConfigList.ts
+function configListParser(text) {
+ const config = new ConfigList();
+ for (const item of configParser(text)) {
+ config.addValue(item.file, String(item.key), item.value);
+ }
+ return config;
+}
+function configGetParser(text, key) {
+ let value = null;
+ const values = [];
+ const scopes = /* @__PURE__ */ new Map();
+ for (const item of configParser(text, key)) {
+ if (item.key !== key) {
+ continue;
+ }
+ values.push(value = item.value);
+ if (!scopes.has(item.file)) {
+ scopes.set(item.file, []);
+ }
+ scopes.get(item.file).push(value);
+ }
+ return {
+ key,
+ paths: Array.from(scopes.keys()),
+ scopes,
+ value,
+ values
+ };
+}
+function configFilePath(filePath) {
+ return filePath.replace(/^(file):/, "");
+}
+function* configParser(text, requestedKey = null) {
+ const lines = text.split("\0");
+ for (let i = 0, max = lines.length - 1; i < max; ) {
+ const file = configFilePath(lines[i++]);
+ let value = lines[i++];
+ let key = requestedKey;
+ if (value.includes("\n")) {
+ const line = splitOn(value, "\n");
+ key = line[0];
+ value = line[1];
+ }
+ yield { file, key, value };
+ }
+}
+var ConfigList;
+var init_ConfigList = __esm({
+ "src/lib/responses/ConfigList.ts"() {
+ "use strict";
+ init_utils();
+ ConfigList = class {
+ constructor() {
+ this.files = [];
+ this.values = /* @__PURE__ */ Object.create(null);
+ }
+ get all() {
+ if (!this._all) {
+ this._all = this.files.reduce((all, file) => {
+ return Object.assign(all, this.values[file]);
+ }, {});
+ }
+ return this._all;
+ }
+ addFile(file) {
+ if (!(file in this.values)) {
+ const latest = last(this.files);
+ this.values[file] = latest ? Object.create(this.values[latest]) : {};
+ this.files.push(file);
+ }
+ return this.values[file];
+ }
+ addValue(file, key, value) {
+ const values = this.addFile(file);
+ if (!values.hasOwnProperty(key)) {
+ values[key] = value;
+ } else if (Array.isArray(values[key])) {
+ values[key].push(value);
+ } else {
+ values[key] = [values[key], value];
+ }
+ this._all = void 0;
+ }
+ };
+ }
+});
+
+// src/lib/tasks/config.ts
+function asConfigScope(scope, fallback) {
+ if (typeof scope === "string" && GitConfigScope.hasOwnProperty(scope)) {
+ return scope;
+ }
+ return fallback;
+}
+function addConfigTask(key, value, append2, scope) {
+ const commands = ["config", `--${scope}`];
+ if (append2) {
+ commands.push("--add");
+ }
+ commands.push(key, value);
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return text;
+ }
+ };
+}
+function getConfigTask(key, scope) {
+ const commands = ["config", "--null", "--show-origin", "--get-all", key];
+ if (scope) {
+ commands.splice(1, 0, `--${scope}`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return configGetParser(text, key);
+ }
+ };
+}
+function listConfigTask(scope) {
+ const commands = ["config", "--list", "--show-origin", "--null"];
+ if (scope) {
+ commands.push(`--${scope}`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return configListParser(text);
+ }
+ };
+}
+function config_default() {
+ return {
+ addConfig(key, value, ...rest) {
+ return this._runTask(
+ addConfigTask(
+ key,
+ value,
+ rest[0] === true,
+ asConfigScope(rest[1], "local" /* local */)
+ ),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ getConfig(key, scope) {
+ return this._runTask(
+ getConfigTask(key, asConfigScope(scope, void 0)),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ listConfig(...rest) {
+ return this._runTask(
+ listConfigTask(asConfigScope(rest[0], void 0)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var GitConfigScope;
+var init_config = __esm({
+ "src/lib/tasks/config.ts"() {
+ "use strict";
+ init_ConfigList();
+ init_utils();
+ GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
+ GitConfigScope2["system"] = "system";
+ GitConfigScope2["global"] = "global";
+ GitConfigScope2["local"] = "local";
+ GitConfigScope2["worktree"] = "worktree";
+ return GitConfigScope2;
+ })(GitConfigScope || {});
+ }
+});
+
+// src/lib/tasks/diff-name-status.ts
+function isDiffNameStatus(input) {
+ return diffNameStatus.has(input);
+}
+var DiffNameStatus, diffNameStatus;
+var init_diff_name_status = __esm({
+ "src/lib/tasks/diff-name-status.ts"() {
+ "use strict";
+ DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
+ DiffNameStatus2["ADDED"] = "A";
+ DiffNameStatus2["COPIED"] = "C";
+ DiffNameStatus2["DELETED"] = "D";
+ DiffNameStatus2["MODIFIED"] = "M";
+ DiffNameStatus2["RENAMED"] = "R";
+ DiffNameStatus2["CHANGED"] = "T";
+ DiffNameStatus2["UNMERGED"] = "U";
+ DiffNameStatus2["UNKNOWN"] = "X";
+ DiffNameStatus2["BROKEN"] = "B";
+ return DiffNameStatus2;
+ })(DiffNameStatus || {});
+ diffNameStatus = new Set(Object.values(DiffNameStatus));
+ }
+});
+
+// src/lib/tasks/grep.ts
+function grepQueryBuilder(...params) {
+ return new GrepQuery().param(...params);
+}
+function parseGrep(grep) {
+ const paths = /* @__PURE__ */ new Set();
+ const results = {};
+ forEachLineWithContent(grep, (input) => {
+ const [path, line, preview] = input.split(NULL);
+ paths.add(path);
+ (results[path] = results[path] || []).push({
+ line: asNumber(line),
+ path,
+ preview
+ });
+ });
+ return {
+ paths,
+ results
+ };
+}
+function grep_default() {
+ return {
+ grep(searchTerm) {
+ const then = trailingFunctionArgument(arguments);
+ const options = getTrailingOptions(arguments);
+ for (const option of disallowedOptions) {
+ if (options.includes(option)) {
+ return this._runTask(
+ configurationErrorTask(`git.grep: use of "${option}" is not supported.`),
+ then
+ );
+ }
+ }
+ if (typeof searchTerm === "string") {
+ searchTerm = grepQueryBuilder().param(searchTerm);
+ }
+ const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm];
+ return this._runTask(
+ {
+ commands,
+ format: "utf-8",
+ parser(stdOut) {
+ return parseGrep(stdOut);
+ }
+ },
+ then
+ );
+ }
+ };
+}
+var disallowedOptions, Query, _a, GrepQuery;
+var init_grep = __esm({
+ "src/lib/tasks/grep.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ disallowedOptions = ["-h"];
+ Query = Symbol("grepQuery");
+ GrepQuery = class {
+ constructor() {
+ this[_a] = [];
+ }
+ *[(_a = Query, Symbol.iterator)]() {
+ for (const query of this[Query]) {
+ yield query;
+ }
+ }
+ and(...and) {
+ and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")");
+ return this;
+ }
+ param(...param) {
+ this[Query].push(...prefixedArray(param, "-e"));
+ return this;
+ }
+ };
+ }
+});
+
+// src/lib/tasks/reset.ts
+var reset_exports = {};
+__export(reset_exports, {
+ ResetMode: () => ResetMode,
+ getResetMode: () => getResetMode,
+ resetTask: () => resetTask
+});
+function resetTask(mode, customArgs) {
+ const commands = ["reset"];
+ if (isValidResetMode(mode)) {
+ commands.push(`--${mode}`);
+ }
+ commands.push(...customArgs);
+ return straightThroughStringTask(commands);
+}
+function getResetMode(mode) {
+ if (isValidResetMode(mode)) {
+ return mode;
+ }
+ switch (typeof mode) {
+ case "string":
+ case "undefined":
+ return "soft" /* SOFT */;
+ }
+ return;
+}
+function isValidResetMode(mode) {
+ return ResetModes.includes(mode);
+}
+var ResetMode, ResetModes;
+var init_reset = __esm({
+ "src/lib/tasks/reset.ts"() {
+ "use strict";
+ init_task();
+ ResetMode = /* @__PURE__ */ ((ResetMode2) => {
+ ResetMode2["MIXED"] = "mixed";
+ ResetMode2["SOFT"] = "soft";
+ ResetMode2["HARD"] = "hard";
+ ResetMode2["MERGE"] = "merge";
+ ResetMode2["KEEP"] = "keep";
+ return ResetMode2;
+ })(ResetMode || {});
+ ResetModes = Array.from(Object.values(ResetMode));
+ }
+});
+
+// src/lib/api.ts
+var api_exports = {};
+__export(api_exports, {
+ CheckRepoActions: () => CheckRepoActions,
+ CleanOptions: () => CleanOptions,
+ DiffNameStatus: () => DiffNameStatus,
+ GitConfigScope: () => GitConfigScope,
+ GitConstructError: () => GitConstructError,
+ GitError: () => GitError,
+ GitPluginError: () => GitPluginError,
+ GitResponseError: () => GitResponseError,
+ ResetMode: () => ResetMode,
+ TaskConfigurationError: () => TaskConfigurationError,
+ grepQueryBuilder: () => grepQueryBuilder,
+ pathspec: () => pathspec
+});
+var init_api = __esm({
+ "src/lib/api.ts"() {
+ "use strict";
+ init_pathspec();
+ init_git_construct_error();
+ init_git_error();
+ init_git_plugin_error();
+ init_git_response_error();
+ init_task_configuration_error();
+ init_check_is_repo();
+ init_clean();
+ init_config();
+ init_diff_name_status();
+ init_grep();
+ init_reset();
+ }
+});
+
+// src/lib/plugins/abort-plugin.ts
+function abortPlugin(signal) {
+ if (!signal) {
+ return;
+ }
+ const onSpawnAfter = {
+ type: "spawn.after",
+ action(_data, context) {
+ function kill() {
+ context.kill(new GitPluginError(void 0, "abort", "Abort signal received"));
+ }
+ signal.addEventListener("abort", kill);
+ context.spawned.on("close", () => signal.removeEventListener("abort", kill));
+ }
+ };
+ const onSpawnBefore = {
+ type: "spawn.before",
+ action(_data, context) {
+ if (signal.aborted) {
+ context.kill(new GitPluginError(void 0, "abort", "Abort already signaled"));
+ }
+ }
+ };
+ return [onSpawnBefore, onSpawnAfter];
+}
+var init_abort_plugin = __esm({
+ "src/lib/plugins/abort-plugin.ts"() {
+ "use strict";
+ init_git_plugin_error();
+ }
+});
+
+// src/lib/plugins/block-unsafe-operations-plugin.ts
+function isConfigSwitch(arg) {
+ return typeof arg === "string" && arg.trim().toLowerCase() === "-c";
+}
+function preventProtocolOverride(arg, next) {
+ if (!isConfigSwitch(arg)) {
+ return;
+ }
+ if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) {
+ return;
+ }
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol"
+ );
+}
+function preventUploadPack(arg, method) {
+ if (/^\s*--(upload|receive)-pack/.test(arg)) {
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`
+ );
+ }
+ if (method === "clone" && /^\s*-u\b/.test(arg)) {
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ `Use of clone with option -u is not permitted without enabling allowUnsafePack`
+ );
+ }
+ if (method === "push" && /^\s*--exec\b/.test(arg)) {
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ `Use of push with option --exec is not permitted without enabling allowUnsafePack`
+ );
+ }
+}
+function blockUnsafeOperationsPlugin({
+ allowUnsafeProtocolOverride = false,
+ allowUnsafePack = false
+} = {}) {
+ return {
+ type: "spawn.args",
+ action(args, context) {
+ args.forEach((current, index) => {
+ const next = index < args.length ? args[index + 1] : "";
+ allowUnsafeProtocolOverride || preventProtocolOverride(current, next);
+ allowUnsafePack || preventUploadPack(current, context.method);
+ });
+ return args;
+ }
+ };
+}
+var init_block_unsafe_operations_plugin = __esm({
+ "src/lib/plugins/block-unsafe-operations-plugin.ts"() {
+ "use strict";
+ init_git_plugin_error();
+ }
+});
+
+// src/lib/plugins/command-config-prefixing-plugin.ts
+function commandConfigPrefixingPlugin(configuration) {
+ const prefix = prefixedArray(configuration, "-c");
+ return {
+ type: "spawn.args",
+ action(data) {
+ return [...prefix, ...data];
+ }
+ };
+}
+var init_command_config_prefixing_plugin = __esm({
+ "src/lib/plugins/command-config-prefixing-plugin.ts"() {
+ "use strict";
+ init_utils();
+ }
+});
+
+// src/lib/plugins/completion-detection.plugin.ts
+function completionDetectionPlugin({
+ onClose = true,
+ onExit = 50
+} = {}) {
+ function createEvents() {
+ let exitCode = -1;
+ const events = {
+ close: (0, import_promise_deferred.deferred)(),
+ closeTimeout: (0, import_promise_deferred.deferred)(),
+ exit: (0, import_promise_deferred.deferred)(),
+ exitTimeout: (0, import_promise_deferred.deferred)()
+ };
+ const result = Promise.race([
+ onClose === false ? never : events.closeTimeout.promise,
+ onExit === false ? never : events.exitTimeout.promise
+ ]);
+ configureTimeout(onClose, events.close, events.closeTimeout);
+ configureTimeout(onExit, events.exit, events.exitTimeout);
+ return {
+ close(code) {
+ exitCode = code;
+ events.close.done();
+ },
+ exit(code) {
+ exitCode = code;
+ events.exit.done();
+ },
+ get exitCode() {
+ return exitCode;
+ },
+ result
+ };
+ }
+ function configureTimeout(flag, event, timeout) {
+ if (flag === false) {
+ return;
+ }
+ (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);
+ }
+ return {
+ type: "spawn.after",
+ action(_0, _1) {
+ return __async(this, arguments, function* (_data, { spawned, close }) {
+ var _a3, _b;
+ const events = createEvents();
+ let deferClose = true;
+ let quickClose = () => void (deferClose = false);
+ (_a3 = spawned.stdout) == null ? void 0 : _a3.on("data", quickClose);
+ (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose);
+ spawned.on("error", quickClose);
+ spawned.on("close", (code) => events.close(code));
+ spawned.on("exit", (code) => events.exit(code));
+ try {
+ yield events.result;
+ if (deferClose) {
+ yield delay(50);
+ }
+ close(events.exitCode);
+ } catch (err) {
+ close(events.exitCode, err);
+ }
+ });
+ }
+ };
+}
+var import_promise_deferred, never;
+var init_completion_detection_plugin = __esm({
+ "src/lib/plugins/completion-detection.plugin.ts"() {
+ "use strict";
+ import_promise_deferred = require("@kwsites/promise-deferred");
+ init_utils();
+ never = (0, import_promise_deferred.deferred)().promise;
+ }
+});
+
+// src/lib/plugins/custom-binary.plugin.ts
+function isBadArgument(arg) {
+ return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg);
+}
+function toBinaryConfig(input, allowUnsafe) {
+ if (input.length < 1 || input.length > 2) {
+ throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR);
+ }
+ const isBad = input.some(isBadArgument);
+ if (isBad) {
+ if (allowUnsafe) {
+ console.warn(WRONG_CHARS_ERR);
+ } else {
+ throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR);
+ }
+ }
+ const [binary, prefix] = input;
+ return {
+ binary,
+ prefix
+ };
+}
+function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) {
+ let config = toBinaryConfig(asArray(input), allowUnsafe);
+ plugins.on("binary", (input2) => {
+ config = toBinaryConfig(asArray(input2), allowUnsafe);
+ });
+ plugins.append("spawn.binary", () => {
+ return config.binary;
+ });
+ plugins.append("spawn.args", (data) => {
+ return config.prefix ? [config.prefix, ...data] : data;
+ });
+}
+var WRONG_NUMBER_ERR, WRONG_CHARS_ERR;
+var init_custom_binary_plugin = __esm({
+ "src/lib/plugins/custom-binary.plugin.ts"() {
+ "use strict";
+ init_git_plugin_error();
+ init_utils();
+ WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;
+ WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;
+ }
+});
+
+// src/lib/plugins/error-detection.plugin.ts
+function isTaskError(result) {
+ return !!(result.exitCode && result.stdErr.length);
+}
+function getErrorMessage(result) {
+ return Buffer.concat([...result.stdOut, ...result.stdErr]);
+}
+function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {
+ return (error, result) => {
+ if (!overwrite && error || !isError(result)) {
+ return error;
+ }
+ return errorMessage(result);
+ };
+}
+function errorDetectionPlugin(config) {
+ return {
+ type: "task.error",
+ action(data, context) {
+ const error = config(data.error, {
+ stdErr: context.stdErr,
+ stdOut: context.stdOut,
+ exitCode: context.exitCode
+ });
+ if (Buffer.isBuffer(error)) {
+ return { error: new GitError(void 0, error.toString("utf-8")) };
+ }
+ return {
+ error
+ };
+ }
+ };
+}
+var init_error_detection_plugin = __esm({
+ "src/lib/plugins/error-detection.plugin.ts"() {
+ "use strict";
+ init_git_error();
+ }
+});
+
+// src/lib/plugins/plugin-store.ts
+var import_node_events, PluginStore;
+var init_plugin_store = __esm({
+ "src/lib/plugins/plugin-store.ts"() {
+ "use strict";
+ import_node_events = require("node:events");
+ init_utils();
+ PluginStore = class {
+ constructor() {
+ this.plugins = /* @__PURE__ */ new Set();
+ this.events = new import_node_events.EventEmitter();
+ }
+ on(type, listener) {
+ this.events.on(type, listener);
+ }
+ reconfigure(type, data) {
+ this.events.emit(type, data);
+ }
+ append(type, action) {
+ const plugin = append(this.plugins, { type, action });
+ return () => this.plugins.delete(plugin);
+ }
+ add(plugin) {
+ const plugins = [];
+ asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));
+ return () => {
+ plugins.forEach((plugin2) => this.plugins.delete(plugin2));
+ };
+ }
+ exec(type, data, context) {
+ let output = data;
+ const contextual = Object.freeze(Object.create(context));
+ for (const plugin of this.plugins) {
+ if (plugin.type === type) {
+ output = plugin.action(output, contextual);
+ }
+ }
+ return output;
+ }
+ };
+ }
+});
+
+// src/lib/plugins/progress-monitor-plugin.ts
+function progressMonitorPlugin(progress) {
+ const progressCommand = "--progress";
+ const progressMethods = ["checkout", "clone", "fetch", "pull", "push"];
+ const onProgress = {
+ type: "spawn.after",
+ action(_data, context) {
+ var _a2;
+ if (!context.commands.includes(progressCommand)) {
+ return;
+ }
+ (_a2 = context.spawned.stderr) == null ? void 0 : _a2.on("data", (chunk) => {
+ const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
+ if (!message) {
+ return;
+ }
+ progress({
+ method: context.method,
+ stage: progressEventStage(message[1]),
+ progress: asNumber(message[2]),
+ processed: asNumber(message[3]),
+ total: asNumber(message[4])
+ });
+ });
+ }
+ };
+ const onArgs = {
+ type: "spawn.args",
+ action(args, context) {
+ if (!progressMethods.includes(context.method)) {
+ return args;
+ }
+ return including(args, progressCommand);
+ }
+ };
+ return [onArgs, onProgress];
+}
+function progressEventStage(input) {
+ return String(input.toLowerCase().split(" ", 1)) || "unknown";
+}
+var init_progress_monitor_plugin = __esm({
+ "src/lib/plugins/progress-monitor-plugin.ts"() {
+ "use strict";
+ init_utils();
+ }
+});
+
+// src/lib/plugins/simple-git-plugin.ts
+var init_simple_git_plugin = __esm({
+ "src/lib/plugins/simple-git-plugin.ts"() {
+ "use strict";
+ }
+});
+
+// src/lib/plugins/spawn-options-plugin.ts
+function spawnOptionsPlugin(spawnOptions) {
+ const options = pick(spawnOptions, ["uid", "gid"]);
+ return {
+ type: "spawn.options",
+ action(data) {
+ return __spreadValues(__spreadValues({}, options), data);
+ }
+ };
+}
+var init_spawn_options_plugin = __esm({
+ "src/lib/plugins/spawn-options-plugin.ts"() {
+ "use strict";
+ init_utils();
+ }
+});
+
+// src/lib/plugins/timout-plugin.ts
+function timeoutPlugin({
+ block,
+ stdErr = true,
+ stdOut = true
+}) {
+ if (block > 0) {
+ return {
+ type: "spawn.after",
+ action(_data, context) {
+ var _a2, _b;
+ let timeout;
+ function wait() {
+ timeout && clearTimeout(timeout);
+ timeout = setTimeout(kill, block);
+ }
+ function stop() {
+ var _a3, _b2;
+ (_a3 = context.spawned.stdout) == null ? void 0 : _a3.off("data", wait);
+ (_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait);
+ context.spawned.off("exit", stop);
+ context.spawned.off("close", stop);
+ timeout && clearTimeout(timeout);
+ }
+ function kill() {
+ stop();
+ context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
+ }
+ stdOut && ((_a2 = context.spawned.stdout) == null ? void 0 : _a2.on("data", wait));
+ stdErr && ((_b = context.spawned.stderr) == null ? void 0 : _b.on("data", wait));
+ context.spawned.on("exit", stop);
+ context.spawned.on("close", stop);
+ wait();
+ }
+ };
+ }
+}
+var init_timout_plugin = __esm({
+ "src/lib/plugins/timout-plugin.ts"() {
+ "use strict";
+ init_git_plugin_error();
+ }
+});
+
+// src/lib/plugins/index.ts
+var init_plugins = __esm({
+ "src/lib/plugins/index.ts"() {
+ "use strict";
+ init_abort_plugin();
+ init_block_unsafe_operations_plugin();
+ init_command_config_prefixing_plugin();
+ init_completion_detection_plugin();
+ init_custom_binary_plugin();
+ init_error_detection_plugin();
+ init_plugin_store();
+ init_progress_monitor_plugin();
+ init_simple_git_plugin();
+ init_spawn_options_plugin();
+ init_timout_plugin();
+ }
+});
+
+// src/lib/plugins/suffix-paths.plugin.ts
+function suffixPathsPlugin() {
+ return {
+ type: "spawn.args",
+ action(data) {
+ const prefix = [];
+ let suffix;
+ function append2(args) {
+ (suffix = suffix || []).push(...args);
+ }
+ for (let i = 0; i < data.length; i++) {
+ const param = data[i];
+ if (isPathSpec(param)) {
+ append2(toPaths(param));
+ continue;
+ }
+ if (param === "--") {
+ append2(
+ data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item)
+ );
+ break;
+ }
+ prefix.push(param);
+ }
+ return !suffix ? prefix : [...prefix, "--", ...suffix.map(String)];
+ }
+ };
+}
+var init_suffix_paths_plugin = __esm({
+ "src/lib/plugins/suffix-paths.plugin.ts"() {
+ "use strict";
+ init_pathspec();
+ }
+});
+
+// src/lib/git-logger.ts
+function createLog() {
+ return (0, import_debug.default)("simple-git");
+}
+function prefixedLogger(to, prefix, forward) {
+ if (!prefix || !String(prefix).replace(/\s*/, "")) {
+ return !forward ? to : (message, ...args) => {
+ to(message, ...args);
+ forward(message, ...args);
+ };
+ }
+ return (message, ...args) => {
+ to(`%s ${message}`, prefix, ...args);
+ if (forward) {
+ forward(message, ...args);
+ }
+ };
+}
+function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
+ if (typeof name === "string") {
+ return name;
+ }
+ const childNamespace = childDebugger && childDebugger.namespace || "";
+ if (childNamespace.startsWith(parentNamespace)) {
+ return childNamespace.substr(parentNamespace.length + 1);
+ }
+ return childNamespace || parentNamespace;
+}
+function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
+ const labelPrefix = label && `[${label}]` || "";
+ const spawned = [];
+ const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose;
+ const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
+ return step(initialStep);
+ function sibling(name, initial) {
+ return append(
+ spawned,
+ createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)
+ );
+ }
+ function step(phase) {
+ const stepPrefix = phase && `[${phase}]` || "";
+ const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;
+ const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);
+ return Object.assign(debugDebugger ? debug2 : info, {
+ label,
+ sibling,
+ info,
+ step
+ });
+ }
+}
+var import_debug;
+var init_git_logger = __esm({
+ "src/lib/git-logger.ts"() {
+ "use strict";
+ import_debug = __toESM(require("debug"));
+ init_utils();
+ import_debug.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
+ import_debug.default.formatters.B = (value) => {
+ if (Buffer.isBuffer(value)) {
+ return value.toString("utf8");
+ }
+ return objectToString(value);
+ };
+ }
+});
+
+// src/lib/runners/tasks-pending-queue.ts
+var _TasksPendingQueue, TasksPendingQueue;
+var init_tasks_pending_queue = __esm({
+ "src/lib/runners/tasks-pending-queue.ts"() {
+ "use strict";
+ init_git_error();
+ init_git_logger();
+ _TasksPendingQueue = class {
+ constructor(logLabel = "GitExecutor") {
+ this.logLabel = logLabel;
+ this._queue = /* @__PURE__ */ new Map();
+ }
+ withProgress(task) {
+ return this._queue.get(task);
+ }
+ createProgress(task) {
+ const name = _TasksPendingQueue.getName(task.commands[0]);
+ const logger = createLogger(this.logLabel, name);
+ return {
+ task,
+ logger,
+ name
+ };
+ }
+ push(task) {
+ const progress = this.createProgress(task);
+ progress.logger("Adding task to the queue, commands = %o", task.commands);
+ this._queue.set(task, progress);
+ return progress;
+ }
+ fatal(err) {
+ for (const [task, { logger }] of Array.from(this._queue.entries())) {
+ if (task === err.task) {
+ logger.info(`Failed %o`, err);
+ logger(
+ `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`
+ );
+ } else {
+ logger.info(
+ `A fatal exception occurred in a previous task, the queue has been purged: %o`,
+ err.message
+ );
+ }
+ this.complete(task);
+ }
+ if (this._queue.size !== 0) {
+ throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
+ }
+ }
+ complete(task) {
+ const progress = this.withProgress(task);
+ if (progress) {
+ this._queue.delete(task);
+ }
+ }
+ attempt(task) {
+ const progress = this.withProgress(task);
+ if (!progress) {
+ throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task");
+ }
+ progress.logger("Starting task");
+ return progress;
+ }
+ static getName(name = "empty") {
+ return `task:${name}:${++_TasksPendingQueue.counter}`;
+ }
+ };
+ TasksPendingQueue = _TasksPendingQueue;
+ TasksPendingQueue.counter = 0;
+ }
+});
+
+// src/lib/runners/git-executor-chain.ts
+function pluginContext(task, commands) {
+ return {
+ method: first(task.commands) || "",
+ commands
+ };
+}
+function onErrorReceived(target, logger) {
+ return (err) => {
+ logger(`[ERROR] child process exception %o`, err);
+ target.push(Buffer.from(String(err.stack), "ascii"));
+ };
+}
+function onDataReceived(target, name, logger, output) {
+ return (buffer) => {
+ logger(`%s received %L bytes`, name, buffer);
+ output(`%B`, buffer);
+ target.push(buffer);
+ };
+}
+var import_child_process, GitExecutorChain;
+var init_git_executor_chain = __esm({
+ "src/lib/runners/git-executor-chain.ts"() {
+ "use strict";
+ import_child_process = require("child_process");
+ init_git_error();
+ init_task();
+ init_utils();
+ init_tasks_pending_queue();
+ GitExecutorChain = class {
+ constructor(_executor, _scheduler, _plugins) {
+ this._executor = _executor;
+ this._scheduler = _scheduler;
+ this._plugins = _plugins;
+ this._chain = Promise.resolve();
+ this._queue = new TasksPendingQueue();
+ }
+ get cwd() {
+ return this._cwd || this._executor.cwd;
+ }
+ set cwd(cwd) {
+ this._cwd = cwd;
+ }
+ get env() {
+ return this._executor.env;
+ }
+ get outputHandler() {
+ return this._executor.outputHandler;
+ }
+ chain() {
+ return this;
+ }
+ push(task) {
+ this._queue.push(task);
+ return this._chain = this._chain.then(() => this.attemptTask(task));
+ }
+ attemptTask(task) {
+ return __async(this, null, function* () {
+ const onScheduleComplete = yield this._scheduler.next();
+ const onQueueComplete = () => this._queue.complete(task);
+ try {
+ const { logger } = this._queue.attempt(task);
+ return yield isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger);
+ } catch (e) {
+ throw this.onFatalException(task, e);
+ } finally {
+ onQueueComplete();
+ onScheduleComplete();
+ }
+ });
+ }
+ onFatalException(task, e) {
+ const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
+ this._chain = Promise.resolve();
+ this._queue.fatal(gitError);
+ return gitError;
+ }
+ attemptRemoteTask(task, logger) {
+ return __async(this, null, function* () {
+ const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
+ const args = this._plugins.exec(
+ "spawn.args",
+ [...task.commands],
+ pluginContext(task, task.commands)
+ );
+ const raw = yield this.gitResponse(
+ task,
+ binary,
+ args,
+ this.outputHandler,
+ logger.step("SPAWN")
+ );
+ const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE"));
+ logger(`passing response to task's parser as a %s`, task.format);
+ if (isBufferTask(task)) {
+ return callTaskParser(task.parser, outputStreams);
+ }
+ return callTaskParser(task.parser, outputStreams.asStrings());
+ });
+ }
+ attemptEmptyTask(task, logger) {
+ return __async(this, null, function* () {
+ logger(`empty task bypassing child process to call to task's parser`);
+ return task.parser(this);
+ });
+ }
+ handleTaskData(task, args, result, logger) {
+ const { exitCode, rejection, stdOut, stdErr } = result;
+ return new Promise((done, fail) => {
+ logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
+ const { error } = this._plugins.exec(
+ "task.error",
+ { error: rejection },
+ __spreadValues(__spreadValues({}, pluginContext(task, args)), result)
+ );
+ if (error && task.onError) {
+ logger.info(`exitCode=%s handling with custom error handler`);
+ return task.onError(
+ result,
+ error,
+ (newStdOut) => {
+ logger.info(`custom error handler treated as success`);
+ logger(`custom error returned a %s`, objectToString(newStdOut));
+ done(
+ new GitOutputStreams(
+ Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut,
+ Buffer.concat(stdErr)
+ )
+ );
+ },
+ fail
+ );
+ }
+ if (error) {
+ logger.info(
+ `handling as error: exitCode=%s stdErr=%s rejection=%o`,
+ exitCode,
+ stdErr.length,
+ rejection
+ );
+ return fail(error);
+ }
+ logger.info(`retrieving task output complete`);
+ done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
+ });
+ }
+ gitResponse(task, command, args, outputHandler, logger) {
+ return __async(this, null, function* () {
+ const outputLogger = logger.sibling("output");
+ const spawnOptions = this._plugins.exec(
+ "spawn.options",
+ {
+ cwd: this.cwd,
+ env: this.env,
+ windowsHide: true
+ },
+ pluginContext(task, task.commands)
+ );
+ return new Promise((done) => {
+ const stdOut = [];
+ const stdErr = [];
+ logger.info(`%s %o`, command, args);
+ logger("%O", spawnOptions);
+ let rejection = this._beforeSpawn(task, args);
+ if (rejection) {
+ return done({
+ stdOut,
+ stdErr,
+ exitCode: 9901,
+ rejection
+ });
+ }
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
+ kill(reason) {
+ rejection = reason || rejection;
+ }
+ }));
+ const spawned = (0, import_child_process.spawn)(command, args, spawnOptions);
+ spawned.stdout.on(
+ "data",
+ onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
+ );
+ spawned.stderr.on(
+ "data",
+ onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))
+ );
+ spawned.on("error", onErrorReceived(stdErr, logger));
+ if (outputHandler) {
+ logger(`Passing child process stdOut/stdErr to custom outputHandler`);
+ outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
+ }
+ this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
+ spawned,
+ close(exitCode, reason) {
+ done({
+ stdOut,
+ stdErr,
+ exitCode,
+ rejection: rejection || reason
+ });
+ },
+ kill(reason) {
+ if (spawned.killed) {
+ return;
+ }
+ rejection = reason;
+ spawned.kill("SIGINT");
+ }
+ }));
+ });
+ });
+ }
+ _beforeSpawn(task, args) {
+ let rejection;
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
+ kill(reason) {
+ rejection = reason || rejection;
+ }
+ }));
+ return rejection;
+ }
+ };
+ }
+});
+
+// src/lib/runners/git-executor.ts
+var git_executor_exports = {};
+__export(git_executor_exports, {
+ GitExecutor: () => GitExecutor
+});
+var GitExecutor;
+var init_git_executor = __esm({
+ "src/lib/runners/git-executor.ts"() {
+ "use strict";
+ init_git_executor_chain();
+ GitExecutor = class {
+ constructor(cwd, _scheduler, _plugins) {
+ this.cwd = cwd;
+ this._scheduler = _scheduler;
+ this._plugins = _plugins;
+ this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);
+ }
+ chain() {
+ return new GitExecutorChain(this, this._scheduler, this._plugins);
+ }
+ push(task) {
+ return this._chain.push(task);
+ }
+ };
+ }
+});
+
+// src/lib/task-callback.ts
+function taskCallback(task, response, callback = NOOP) {
+ const onSuccess = (data) => {
+ callback(null, data);
+ };
+ const onError2 = (err) => {
+ if ((err == null ? void 0 : err.task) === task) {
+ callback(
+ err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,
+ void 0
+ );
+ }
+ };
+ response.then(onSuccess, onError2);
+}
+function addDeprecationNoticeToError(err) {
+ let log = (name) => {
+ console.warn(
+ `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`
+ );
+ log = NOOP;
+ };
+ return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
+ function descriptorReducer(all, name) {
+ if (name in err) {
+ return all;
+ }
+ all[name] = {
+ enumerable: false,
+ configurable: false,
+ get() {
+ log(name);
+ return err.git[name];
+ }
+ };
+ return all;
+ }
+}
+var init_task_callback = __esm({
+ "src/lib/task-callback.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_utils();
+ }
+});
+
+// src/lib/tasks/change-working-directory.ts
+function changeWorkingDirectoryTask(directory, root) {
+ return adhocExecTask((instance) => {
+ if (!folderExists(directory)) {
+ throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`);
+ }
+ return (root || instance).cwd = directory;
+ });
+}
+var init_change_working_directory = __esm({
+ "src/lib/tasks/change-working-directory.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/tasks/checkout.ts
+function checkoutTask(args) {
+ const commands = ["checkout", ...args];
+ if (commands[1] === "-b" && commands.includes("-B")) {
+ commands[1] = remove(commands, "-B");
+ }
+ return straightThroughStringTask(commands);
+}
+function checkout_default() {
+ return {
+ checkout() {
+ return this._runTask(
+ checkoutTask(getTrailingOptions(arguments, 1)),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ checkoutBranch(branchName, startPoint) {
+ return this._runTask(
+ checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ checkoutLocalBranch(branchName) {
+ return this._runTask(
+ checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var init_checkout = __esm({
+ "src/lib/tasks/checkout.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/parsers/parse-commit.ts
+function parseCommitResult(stdOut) {
+ const result = {
+ author: null,
+ branch: "",
+ commit: "",
+ root: false,
+ summary: {
+ changes: 0,
+ insertions: 0,
+ deletions: 0
+ }
+ };
+ return parseStringResponse(result, parsers, stdOut);
+}
+var parsers;
+var init_parse_commit = __esm({
+ "src/lib/parsers/parse-commit.ts"() {
+ "use strict";
+ init_utils();
+ parsers = [
+ new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
+ result.branch = branch;
+ result.commit = commit;
+ result.root = !!root;
+ }),
+ new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
+ const parts = author.split("<");
+ const email = parts.pop();
+ if (!email || !email.includes("@")) {
+ return;
+ }
+ result.author = {
+ email: email.substr(0, email.length - 1),
+ name: parts.join("<").trim()
+ };
+ }),
+ new LineParser(
+ /(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,
+ (result, [changes, insertions, deletions]) => {
+ result.summary.changes = parseInt(changes, 10) || 0;
+ result.summary.insertions = parseInt(insertions, 10) || 0;
+ result.summary.deletions = parseInt(deletions, 10) || 0;
+ }
+ ),
+ new LineParser(
+ /^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,
+ (result, [changes, lines, direction]) => {
+ result.summary.changes = parseInt(changes, 10) || 0;
+ const count = parseInt(lines, 10) || 0;
+ if (direction === "-") {
+ result.summary.deletions = count;
+ } else if (direction === "+") {
+ result.summary.insertions = count;
+ }
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/tasks/commit.ts
+function commitTask(message, files, customArgs) {
+ const commands = [
+ "-c",
+ "core.abbrev=40",
+ "commit",
+ ...prefixedArray(message, "-m"),
+ ...files,
+ ...customArgs
+ ];
+ return {
+ commands,
+ format: "utf-8",
+ parser: parseCommitResult
+ };
+}
+function commit_default() {
+ return {
+ commit(message, ...rest) {
+ const next = trailingFunctionArgument(arguments);
+ const task = rejectDeprecatedSignatures(message) || commitTask(
+ asArray(message),
+ asArray(filterType(rest[0], filterStringOrStringArray, [])),
+ [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]
+ );
+ return this._runTask(task, next);
+ }
+ };
+ function rejectDeprecatedSignatures(message) {
+ return !filterStringOrStringArray(message) && configurationErrorTask(
+ `git.commit: requires the commit message to be supplied as a string/string[]`
+ );
+ }
+}
+var init_commit = __esm({
+ "src/lib/tasks/commit.ts"() {
+ "use strict";
+ init_parse_commit();
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/tasks/first-commit.ts
+function first_commit_default() {
+ return {
+ firstCommit() {
+ return this._runTask(
+ straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var init_first_commit = __esm({
+ "src/lib/tasks/first-commit.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/tasks/hash-object.ts
+function hashObjectTask(filePath, write) {
+ const commands = ["hash-object", filePath];
+ if (write) {
+ commands.push("-w");
+ }
+ return straightThroughStringTask(commands, true);
+}
+var init_hash_object = __esm({
+ "src/lib/tasks/hash-object.ts"() {
+ "use strict";
+ init_task();
+ }
+});
+
+// src/lib/responses/InitSummary.ts
+function parseInit(bare, path, text) {
+ const response = String(text).trim();
+ let result;
+ if (result = initResponseRegex.exec(response)) {
+ return new InitSummary(bare, path, false, result[1]);
+ }
+ if (result = reInitResponseRegex.exec(response)) {
+ return new InitSummary(bare, path, true, result[1]);
+ }
+ let gitDir = "";
+ const tokens = response.split(" ");
+ while (tokens.length) {
+ const token = tokens.shift();
+ if (token === "in") {
+ gitDir = tokens.join(" ");
+ break;
+ }
+ }
+ return new InitSummary(bare, path, /^re/i.test(response), gitDir);
+}
+var InitSummary, initResponseRegex, reInitResponseRegex;
+var init_InitSummary = __esm({
+ "src/lib/responses/InitSummary.ts"() {
+ "use strict";
+ InitSummary = class {
+ constructor(bare, path, existing, gitDir) {
+ this.bare = bare;
+ this.path = path;
+ this.existing = existing;
+ this.gitDir = gitDir;
+ }
+ };
+ initResponseRegex = /^Init.+ repository in (.+)$/;
+ reInitResponseRegex = /^Rein.+ in (.+)$/;
+ }
+});
+
+// src/lib/tasks/init.ts
+function hasBareCommand(command) {
+ return command.includes(bareCommand);
+}
+function initTask(bare = false, path, customArgs) {
+ const commands = ["init", ...customArgs];
+ if (bare && !hasBareCommand(commands)) {
+ commands.splice(1, 0, bareCommand);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return parseInit(commands.includes("--bare"), path, text);
+ }
+ };
+}
+var bareCommand;
+var init_init = __esm({
+ "src/lib/tasks/init.ts"() {
+ "use strict";
+ init_InitSummary();
+ bareCommand = "--bare";
+ }
+});
+
+// src/lib/args/log-format.ts
+function logFormatFromCommand(customArgs) {
+ for (let i = 0; i < customArgs.length; i++) {
+ const format = logFormatRegex.exec(customArgs[i]);
+ if (format) {
+ return `--${format[1]}`;
+ }
+ }
+ return "" /* NONE */;
+}
+function isLogFormat(customArg) {
+ return logFormatRegex.test(customArg);
+}
+var logFormatRegex;
+var init_log_format = __esm({
+ "src/lib/args/log-format.ts"() {
+ "use strict";
+ logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;
+ }
+});
+
+// src/lib/responses/DiffSummary.ts
+var DiffSummary;
+var init_DiffSummary = __esm({
+ "src/lib/responses/DiffSummary.ts"() {
+ "use strict";
+ DiffSummary = class {
+ constructor() {
+ this.changed = 0;
+ this.deletions = 0;
+ this.insertions = 0;
+ this.files = [];
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-diff-summary.ts
+function getDiffParser(format = "" /* NONE */) {
+ const parser3 = diffSummaryParsers[format];
+ return (stdOut) => parseStringResponse(new DiffSummary(), parser3, stdOut, false);
+}
+var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers;
+var init_parse_diff_summary = __esm({
+ "src/lib/parsers/parse-diff-summary.ts"() {
+ "use strict";
+ init_log_format();
+ init_DiffSummary();
+ init_diff_name_status();
+ init_utils();
+ statParser = [
+ new LineParser(
+ /^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,
+ (result, [file, changes, alterations = ""]) => {
+ result.files.push({
+ file: file.trim(),
+ changes: asNumber(changes),
+ insertions: alterations.replace(/[^+]/g, "").length,
+ deletions: alterations.replace(/[^-]/g, "").length,
+ binary: false
+ });
+ }
+ ),
+ new LineParser(
+ /^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,
+ (result, [file, before, after]) => {
+ result.files.push({
+ file: file.trim(),
+ before: asNumber(before),
+ after: asNumber(after),
+ binary: true
+ });
+ }
+ ),
+ new LineParser(
+ /(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,
+ (result, [changed, summary]) => {
+ const inserted = /(\d+) i/.exec(summary);
+ const deleted = /(\d+) d/.exec(summary);
+ result.changed = asNumber(changed);
+ result.insertions = asNumber(inserted == null ? void 0 : inserted[1]);
+ result.deletions = asNumber(deleted == null ? void 0 : deleted[1]);
+ }
+ )
+ ];
+ numStatParser = [
+ new LineParser(
+ /(\d+)\t(\d+)\t(.+)$/,
+ (result, [changesInsert, changesDelete, file]) => {
+ const insertions = asNumber(changesInsert);
+ const deletions = asNumber(changesDelete);
+ result.changed++;
+ result.insertions += insertions;
+ result.deletions += deletions;
+ result.files.push({
+ file,
+ changes: insertions + deletions,
+ insertions,
+ deletions,
+ binary: false
+ });
+ }
+ ),
+ new LineParser(/-\t-\t(.+)$/, (result, [file]) => {
+ result.changed++;
+ result.files.push({
+ file,
+ after: 0,
+ before: 0,
+ binary: true
+ });
+ })
+ ];
+ nameOnlyParser = [
+ new LineParser(/(.+)$/, (result, [file]) => {
+ result.changed++;
+ result.files.push({
+ file,
+ changes: 0,
+ insertions: 0,
+ deletions: 0,
+ binary: false
+ });
+ })
+ ];
+ nameStatusParser = [
+ new LineParser(
+ /([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,
+ (result, [status, _similarity, from, _to, to]) => {
+ result.changed++;
+ result.files.push({
+ file: to != null ? to : from,
+ changes: 0,
+ status: orVoid(isDiffNameStatus(status) && status),
+ insertions: 0,
+ deletions: 0,
+ binary: false
+ });
+ }
+ )
+ ];
+ diffSummaryParsers = {
+ ["" /* NONE */]: statParser,
+ ["--stat" /* STAT */]: statParser,
+ ["--numstat" /* NUM_STAT */]: numStatParser,
+ ["--name-status" /* NAME_STATUS */]: nameStatusParser,
+ ["--name-only" /* NAME_ONLY */]: nameOnlyParser
+ };
+ }
+});
+
+// src/lib/parsers/parse-list-log-summary.ts
+function lineBuilder(tokens, fields) {
+ return fields.reduce(
+ (line, field, index) => {
+ line[field] = tokens[index] || "";
+ return line;
+ },
+ /* @__PURE__ */ Object.create({ diff: null })
+ );
+}
+function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "" /* NONE */) {
+ const parseDiffResult = getDiffParser(logFormat);
+ return function(stdOut) {
+ const all = toLinesWithContent(
+ stdOut,
+ true,
+ START_BOUNDARY
+ ).map(function(item) {
+ const lineDetail = item.trim().split(COMMIT_BOUNDARY);
+ const listLogLine = lineBuilder(
+ lineDetail[0].trim().split(splitter),
+ fields
+ );
+ if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
+ listLogLine.diff = parseDiffResult(lineDetail[1]);
+ }
+ return listLogLine;
+ });
+ return {
+ all,
+ latest: all.length && all[0] || null,
+ total: all.length
+ };
+ };
+}
+var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames;
+var init_parse_list_log_summary = __esm({
+ "src/lib/parsers/parse-list-log-summary.ts"() {
+ "use strict";
+ init_utils();
+ init_parse_diff_summary();
+ init_log_format();
+ START_BOUNDARY = "\xF2\xF2\xF2\xF2\xF2\xF2 ";
+ COMMIT_BOUNDARY = " \xF2\xF2";
+ SPLITTER = " \xF2 ";
+ defaultFieldNames = ["hash", "date", "message", "refs", "author_name", "author_email"];
+ }
+});
+
+// src/lib/tasks/diff.ts
+var diff_exports = {};
+__export(diff_exports, {
+ diffSummaryTask: () => diffSummaryTask,
+ validateLogFormatConfig: () => validateLogFormatConfig
+});
+function diffSummaryTask(customArgs) {
+ let logFormat = logFormatFromCommand(customArgs);
+ const commands = ["diff"];
+ if (logFormat === "" /* NONE */) {
+ logFormat = "--stat" /* STAT */;
+ commands.push("--stat=4096");
+ }
+ commands.push(...customArgs);
+ return validateLogFormatConfig(commands) || {
+ commands,
+ format: "utf-8",
+ parser: getDiffParser(logFormat)
+ };
+}
+function validateLogFormatConfig(customArgs) {
+ const flags = customArgs.filter(isLogFormat);
+ if (flags.length > 1) {
+ return configurationErrorTask(
+ `Summary flags are mutually exclusive - pick one of ${flags.join(",")}`
+ );
+ }
+ if (flags.length && customArgs.includes("-z")) {
+ return configurationErrorTask(
+ `Summary flag ${flags} parsing is not compatible with null termination option '-z'`
+ );
+ }
+}
+var init_diff = __esm({
+ "src/lib/tasks/diff.ts"() {
+ "use strict";
+ init_log_format();
+ init_parse_diff_summary();
+ init_task();
+ }
+});
+
+// src/lib/tasks/log.ts
+function prettyFormat(format, splitter) {
+ const fields = [];
+ const formatStr = [];
+ Object.keys(format).forEach((field) => {
+ fields.push(field);
+ formatStr.push(String(format[field]));
+ });
+ return [fields, formatStr.join(splitter)];
+}
+function userOptions(input) {
+ return Object.keys(input).reduce((out, key) => {
+ if (!(key in excludeOptions)) {
+ out[key] = input[key];
+ }
+ return out;
+ }, {});
+}
+function parseLogOptions(opt = {}, customArgs = []) {
+ const splitter = filterType(opt.splitter, filterString, SPLITTER);
+ const format = !filterPrimitives(opt.format) && opt.format ? opt.format : {
+ hash: "%H",
+ date: opt.strictDate === false ? "%ai" : "%aI",
+ message: "%s",
+ refs: "%D",
+ body: opt.multiLine ? "%B" : "%b",
+ author_name: opt.mailMap !== false ? "%aN" : "%an",
+ author_email: opt.mailMap !== false ? "%aE" : "%ae"
+ };
+ const [fields, formatStr] = prettyFormat(format, splitter);
+ const suffix = [];
+ const command = [
+ `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,
+ ...customArgs
+ ];
+ const maxCount = opt.n || opt["max-count"] || opt.maxCount;
+ if (maxCount) {
+ command.push(`--max-count=${maxCount}`);
+ }
+ if (opt.from || opt.to) {
+ const rangeOperator = opt.symmetric !== false ? "..." : "..";
+ suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
+ }
+ if (filterString(opt.file)) {
+ command.push("--follow", pathspec(opt.file));
+ }
+ appendTaskOptions(userOptions(opt), command);
+ return {
+ fields,
+ splitter,
+ commands: [...command, ...suffix]
+ };
+}
+function logTask(splitter, fields, customArgs) {
+ const parser3 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
+ return {
+ commands: ["log", ...customArgs],
+ format: "utf-8",
+ parser: parser3
+ };
+}
+function log_default() {
+ return {
+ log(...rest) {
+ const next = trailingFunctionArgument(arguments);
+ const options = parseLogOptions(
+ trailingOptionsArgument(arguments),
+ filterType(arguments[0], filterArray)
+ );
+ const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
+ return this._runTask(task, next);
+ }
+ };
+ function createLogTask(options) {
+ return logTask(options.splitter, options.fields, options.commands);
+ }
+ function rejectDeprecatedSignatures(from, to) {
+ return filterString(from) && filterString(to) && configurationErrorTask(
+ `git.log(string, string) should be replaced with git.log({ from: string, to: string })`
+ );
+ }
+}
+var excludeOptions;
+var init_log = __esm({
+ "src/lib/tasks/log.ts"() {
+ "use strict";
+ init_log_format();
+ init_pathspec();
+ init_parse_list_log_summary();
+ init_utils();
+ init_task();
+ init_diff();
+ excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {
+ excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty";
+ excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count";
+ excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount";
+ excludeOptions2[excludeOptions2["n"] = 3] = "n";
+ excludeOptions2[excludeOptions2["file"] = 4] = "file";
+ excludeOptions2[excludeOptions2["format"] = 5] = "format";
+ excludeOptions2[excludeOptions2["from"] = 6] = "from";
+ excludeOptions2[excludeOptions2["to"] = 7] = "to";
+ excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter";
+ excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric";
+ excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap";
+ excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine";
+ excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate";
+ return excludeOptions2;
+ })(excludeOptions || {});
+ }
+});
+
+// src/lib/responses/MergeSummary.ts
+var MergeSummaryConflict, MergeSummaryDetail;
+var init_MergeSummary = __esm({
+ "src/lib/responses/MergeSummary.ts"() {
+ "use strict";
+ MergeSummaryConflict = class {
+ constructor(reason, file = null, meta) {
+ this.reason = reason;
+ this.file = file;
+ this.meta = meta;
+ }
+ toString() {
+ return `${this.file}:${this.reason}`;
+ }
+ };
+ MergeSummaryDetail = class {
+ constructor() {
+ this.conflicts = [];
+ this.merges = [];
+ this.result = "success";
+ }
+ get failed() {
+ return this.conflicts.length > 0;
+ }
+ get reason() {
+ return this.result;
+ }
+ toString() {
+ if (this.conflicts.length) {
+ return `CONFLICTS: ${this.conflicts.join(", ")}`;
+ }
+ return "OK";
+ }
+ };
+ }
+});
+
+// src/lib/responses/PullSummary.ts
+var PullSummary, PullFailedSummary;
+var init_PullSummary = __esm({
+ "src/lib/responses/PullSummary.ts"() {
+ "use strict";
+ PullSummary = class {
+ constructor() {
+ this.remoteMessages = {
+ all: []
+ };
+ this.created = [];
+ this.deleted = [];
+ this.files = [];
+ this.deletions = {};
+ this.insertions = {};
+ this.summary = {
+ changes: 0,
+ deletions: 0,
+ insertions: 0
+ };
+ }
+ };
+ PullFailedSummary = class {
+ constructor() {
+ this.remote = "";
+ this.hash = {
+ local: "",
+ remote: ""
+ };
+ this.branch = {
+ local: "",
+ remote: ""
+ };
+ this.message = "";
+ }
+ toString() {
+ return this.message;
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-remote-objects.ts
+function objectEnumerationResult(remoteMessages) {
+ return remoteMessages.objects = remoteMessages.objects || {
+ compressing: 0,
+ counting: 0,
+ enumerating: 0,
+ packReused: 0,
+ reused: { count: 0, delta: 0 },
+ total: { count: 0, delta: 0 }
+ };
+}
+function asObjectCount(source) {
+ const count = /^\s*(\d+)/.exec(source);
+ const delta = /delta (\d+)/i.exec(source);
+ return {
+ count: asNumber(count && count[1] || "0"),
+ delta: asNumber(delta && delta[1] || "0")
+ };
+}
+var remoteMessagesObjectParsers;
+var init_parse_remote_objects = __esm({
+ "src/lib/parsers/parse-remote-objects.ts"() {
+ "use strict";
+ init_utils();
+ remoteMessagesObjectParsers = [
+ new RemoteLineParser(
+ /^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,
+ (result, [action, count]) => {
+ const key = action.toLowerCase();
+ const enumeration = objectEnumerationResult(result.remoteMessages);
+ Object.assign(enumeration, { [key]: asNumber(count) });
+ }
+ ),
+ new RemoteLineParser(
+ /^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,
+ (result, [action, count]) => {
+ const key = action.toLowerCase();
+ const enumeration = objectEnumerationResult(result.remoteMessages);
+ Object.assign(enumeration, { [key]: asNumber(count) });
+ }
+ ),
+ new RemoteLineParser(
+ /total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,
+ (result, [total, reused, packReused]) => {
+ const objects = objectEnumerationResult(result.remoteMessages);
+ objects.total = asObjectCount(total);
+ objects.reused = asObjectCount(reused);
+ objects.packReused = asNumber(packReused);
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/parsers/parse-remote-messages.ts
+function parseRemoteMessages(_stdOut, stdErr) {
+ return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);
+}
+var parsers2, RemoteMessageSummary;
+var init_parse_remote_messages = __esm({
+ "src/lib/parsers/parse-remote-messages.ts"() {
+ "use strict";
+ init_utils();
+ init_parse_remote_objects();
+ parsers2 = [
+ new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
+ result.remoteMessages.all.push(text.trim());
+ return false;
+ }),
+ ...remoteMessagesObjectParsers,
+ new RemoteLineParser(
+ [/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/],
+ (result, [pullRequestUrl]) => {
+ result.remoteMessages.pullRequestUrl = pullRequestUrl;
+ }
+ ),
+ new RemoteLineParser(
+ [/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/],
+ (result, [count, summary, url]) => {
+ result.remoteMessages.vulnerabilities = {
+ count: asNumber(count),
+ summary,
+ url
+ };
+ }
+ )
+ ];
+ RemoteMessageSummary = class {
+ constructor() {
+ this.all = [];
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-pull.ts
+function parsePullErrorResult(stdOut, stdErr) {
+ const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);
+ return pullError.message && pullError;
+}
+var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult;
+var init_parse_pull = __esm({
+ "src/lib/parsers/parse-pull.ts"() {
+ "use strict";
+ init_PullSummary();
+ init_utils();
+ init_parse_remote_messages();
+ FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
+ SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
+ ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
+ parsers3 = [
+ new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
+ result.files.push(file);
+ if (insertions) {
+ result.insertions[file] = insertions.length;
+ }
+ if (deletions) {
+ result.deletions[file] = deletions.length;
+ }
+ }),
+ new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
+ if (insertions !== void 0 || deletions !== void 0) {
+ result.summary.changes = +changes || 0;
+ result.summary.insertions = +insertions || 0;
+ result.summary.deletions = +deletions || 0;
+ return true;
+ }
+ return false;
+ }),
+ new LineParser(ACTION_REGEX, (result, [action, file]) => {
+ append(result.files, file);
+ append(action === "create" ? result.created : result.deleted, file);
+ })
+ ];
+ errorParsers = [
+ new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
+ new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
+ new LineParser(
+ /([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,
+ (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
+ result.branch.local = branchLocal;
+ result.hash.local = hashLocal;
+ result.branch.remote = branchRemote;
+ result.hash.remote = hashRemote;
+ }
+ )
+ ];
+ parsePullDetail = (stdOut, stdErr) => {
+ return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);
+ };
+ parsePullResult = (stdOut, stdErr) => {
+ return Object.assign(
+ new PullSummary(),
+ parsePullDetail(stdOut, stdErr),
+ parseRemoteMessages(stdOut, stdErr)
+ );
+ };
+ }
+});
+
+// src/lib/parsers/parse-merge.ts
+var parsers4, parseMergeResult, parseMergeDetail;
+var init_parse_merge = __esm({
+ "src/lib/parsers/parse-merge.ts"() {
+ "use strict";
+ init_MergeSummary();
+ init_utils();
+ init_parse_pull();
+ parsers4 = [
+ new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
+ summary.merges.push(autoMerge);
+ }),
+ new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, file));
+ }),
+ new LineParser(
+ /^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,
+ (summary, [reason, file, deleteRef]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
+ }
+ ),
+ new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, null));
+ }),
+ new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
+ summary.result = result;
+ })
+ ];
+ parseMergeResult = (stdOut, stdErr) => {
+ return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));
+ };
+ parseMergeDetail = (stdOut) => {
+ return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);
+ };
+ }
+});
+
+// src/lib/tasks/merge.ts
+function mergeTask(customArgs) {
+ if (!customArgs.length) {
+ return configurationErrorTask("Git.merge requires at least one option");
+ }
+ return {
+ commands: ["merge", ...customArgs],
+ format: "utf-8",
+ parser(stdOut, stdErr) {
+ const merge = parseMergeResult(stdOut, stdErr);
+ if (merge.failed) {
+ throw new GitResponseError(merge);
+ }
+ return merge;
+ }
+ };
+}
+var init_merge = __esm({
+ "src/lib/tasks/merge.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_parse_merge();
+ init_task();
+ }
+});
+
+// src/lib/parsers/parse-push.ts
+function pushResultPushedItem(local, remote, status) {
+ const deleted = status.includes("deleted");
+ const tag = status.includes("tag") || /^refs\/tags/.test(local);
+ const alreadyUpdated = !status.includes("new");
+ return {
+ deleted,
+ tag,
+ branch: !tag,
+ new: !alreadyUpdated,
+ alreadyUpdated,
+ local,
+ remote
+ };
+}
+var parsers5, parsePushResult, parsePushDetail;
+var init_parse_push = __esm({
+ "src/lib/parsers/parse-push.ts"() {
+ "use strict";
+ init_utils();
+ init_parse_remote_messages();
+ parsers5 = [
+ new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
+ result.repo = repo;
+ }),
+ new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
+ result.ref = __spreadProps(__spreadValues({}, result.ref || {}), {
+ local
+ });
+ }),
+ new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
+ result.pushed.push(pushResultPushedItem(local, remote, type));
+ }),
+ new LineParser(
+ /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,
+ (result, [local, remote, remoteName]) => {
+ result.branch = __spreadProps(__spreadValues({}, result.branch || {}), {
+ local,
+ remote,
+ remoteName
+ });
+ }
+ ),
+ new LineParser(
+ /^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,
+ (result, [local, remote, from, to]) => {
+ result.update = {
+ head: {
+ local,
+ remote
+ },
+ hash: {
+ from,
+ to
+ }
+ };
+ }
+ )
+ ];
+ parsePushResult = (stdOut, stdErr) => {
+ const pushDetail = parsePushDetail(stdOut, stdErr);
+ const responseDetail = parseRemoteMessages(stdOut, stdErr);
+ return __spreadValues(__spreadValues({}, pushDetail), responseDetail);
+ };
+ parsePushDetail = (stdOut, stdErr) => {
+ return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
+ };
+ }
+});
+
+// src/lib/tasks/push.ts
+var push_exports = {};
+__export(push_exports, {
+ pushTagsTask: () => pushTagsTask,
+ pushTask: () => pushTask
+});
+function pushTagsTask(ref = {}, customArgs) {
+ append(customArgs, "--tags");
+ return pushTask(ref, customArgs);
+}
+function pushTask(ref = {}, customArgs) {
+ const commands = ["push", ...customArgs];
+ if (ref.branch) {
+ commands.splice(1, 0, ref.branch);
+ }
+ if (ref.remote) {
+ commands.splice(1, 0, ref.remote);
+ }
+ remove(commands, "-v");
+ append(commands, "--verbose");
+ append(commands, "--porcelain");
+ return {
+ commands,
+ format: "utf-8",
+ parser: parsePushResult
+ };
+}
+var init_push = __esm({
+ "src/lib/tasks/push.ts"() {
+ "use strict";
+ init_parse_push();
+ init_utils();
+ }
+});
+
+// src/lib/tasks/show.ts
+function show_default() {
+ return {
+ showBuffer() {
+ const commands = ["show", ...getTrailingOptions(arguments, 1)];
+ if (!commands.includes("--binary")) {
+ commands.splice(1, 0, "--binary");
+ }
+ return this._runTask(
+ straightThroughBufferTask(commands),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ show() {
+ const commands = ["show", ...getTrailingOptions(arguments, 1)];
+ return this._runTask(
+ straightThroughStringTask(commands),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var init_show = __esm({
+ "src/lib/tasks/show.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/responses/FileStatusSummary.ts
+var fromPathRegex, FileStatusSummary;
+var init_FileStatusSummary = __esm({
+ "src/lib/responses/FileStatusSummary.ts"() {
+ "use strict";
+ fromPathRegex = /^(.+) -> (.+)$/;
+ FileStatusSummary = class {
+ constructor(path, index, working_dir) {
+ this.path = path;
+ this.index = index;
+ this.working_dir = working_dir;
+ if ("R" === index + working_dir) {
+ const detail = fromPathRegex.exec(path) || [null, path, path];
+ this.from = detail[1] || "";
+ this.path = detail[2] || "";
+ }
+ }
+ };
+ }
+});
+
+// src/lib/responses/StatusSummary.ts
+function renamedFile(line) {
+ const [to, from] = line.split(NULL);
+ return {
+ from: from || to,
+ to
+ };
+}
+function parser2(indexX, indexY, handler) {
+ return [`${indexX}${indexY}`, handler];
+}
+function conflicts(indexX, ...indexY) {
+ return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file)));
+}
+function splitLine(result, lineStr) {
+ const trimmed2 = lineStr.trim();
+ switch (" ") {
+ case trimmed2.charAt(2):
+ return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3));
+ case trimmed2.charAt(1):
+ return data(" " /* NONE */, trimmed2.charAt(0), trimmed2.substr(2));
+ default:
+ return;
+ }
+ function data(index, workingDir, path) {
+ const raw = `${index}${workingDir}`;
+ const handler = parsers6.get(raw);
+ if (handler) {
+ handler(result, path);
+ }
+ if (raw !== "##" && raw !== "!!") {
+ result.files.push(new FileStatusSummary(path.replace(/\0.+$/, ""), index, workingDir));
+ }
+ }
+}
+var StatusSummary, parsers6, parseStatusSummary;
+var init_StatusSummary = __esm({
+ "src/lib/responses/StatusSummary.ts"() {
+ "use strict";
+ init_utils();
+ init_FileStatusSummary();
+ StatusSummary = class {
+ constructor() {
+ this.not_added = [];
+ this.conflicted = [];
+ this.created = [];
+ this.deleted = [];
+ this.ignored = void 0;
+ this.modified = [];
+ this.renamed = [];
+ this.files = [];
+ this.staged = [];
+ this.ahead = 0;
+ this.behind = 0;
+ this.current = null;
+ this.tracking = null;
+ this.detached = false;
+ this.isClean = () => {
+ return !this.files.length;
+ };
+ }
+ };
+ parsers6 = new Map([
+ parser2(
+ " " /* NONE */,
+ "A" /* ADDED */,
+ (result, file) => append(result.created, file)
+ ),
+ parser2(
+ " " /* NONE */,
+ "D" /* DELETED */,
+ (result, file) => append(result.deleted, file)
+ ),
+ parser2(
+ " " /* NONE */,
+ "M" /* MODIFIED */,
+ (result, file) => append(result.modified, file)
+ ),
+ parser2(
+ "A" /* ADDED */,
+ " " /* NONE */,
+ (result, file) => append(result.created, file) && append(result.staged, file)
+ ),
+ parser2(
+ "A" /* ADDED */,
+ "M" /* MODIFIED */,
+ (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)
+ ),
+ parser2(
+ "D" /* DELETED */,
+ " " /* NONE */,
+ (result, file) => append(result.deleted, file) && append(result.staged, file)
+ ),
+ parser2(
+ "M" /* MODIFIED */,
+ " " /* NONE */,
+ (result, file) => append(result.modified, file) && append(result.staged, file)
+ ),
+ parser2(
+ "M" /* MODIFIED */,
+ "M" /* MODIFIED */,
+ (result, file) => append(result.modified, file) && append(result.staged, file)
+ ),
+ parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => {
+ append(result.renamed, renamedFile(file));
+ }),
+ parser2("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => {
+ const renamed = renamedFile(file);
+ append(result.renamed, renamed);
+ append(result.modified, renamed.to);
+ }),
+ parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => {
+ append(_result.ignored = _result.ignored || [], _file);
+ }),
+ parser2(
+ "?" /* UNTRACKED */,
+ "?" /* UNTRACKED */,
+ (result, file) => append(result.not_added, file)
+ ),
+ ...conflicts("A" /* ADDED */, "A" /* ADDED */, "U" /* UNMERGED */),
+ ...conflicts(
+ "D" /* DELETED */,
+ "D" /* DELETED */,
+ "U" /* UNMERGED */
+ ),
+ ...conflicts(
+ "U" /* UNMERGED */,
+ "A" /* ADDED */,
+ "D" /* DELETED */,
+ "U" /* UNMERGED */
+ ),
+ [
+ "##",
+ (result, line) => {
+ const aheadReg = /ahead (\d+)/;
+ const behindReg = /behind (\d+)/;
+ const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
+ const trackingReg = /\.{3}(\S*)/;
+ const onEmptyBranchReg = /\son\s([\S]+)$/;
+ let regexResult;
+ regexResult = aheadReg.exec(line);
+ result.ahead = regexResult && +regexResult[1] || 0;
+ regexResult = behindReg.exec(line);
+ result.behind = regexResult && +regexResult[1] || 0;
+ regexResult = currentReg.exec(line);
+ result.current = regexResult && regexResult[1];
+ regexResult = trackingReg.exec(line);
+ result.tracking = regexResult && regexResult[1];
+ regexResult = onEmptyBranchReg.exec(line);
+ result.current = regexResult && regexResult[1] || result.current;
+ result.detached = /\(no branch\)/.test(line);
+ }
+ ]
+ ]);
+ parseStatusSummary = function(text) {
+ const lines = text.split(NULL);
+ const status = new StatusSummary();
+ for (let i = 0, l = lines.length; i < l; ) {
+ let line = lines[i++].trim();
+ if (!line) {
+ continue;
+ }
+ if (line.charAt(0) === "R" /* RENAMED */) {
+ line += NULL + (lines[i++] || "");
+ }
+ splitLine(status, line);
+ }
+ return status;
+ };
+ }
+});
+
+// src/lib/tasks/status.ts
+function statusTask(customArgs) {
+ const commands = [
+ "status",
+ "--porcelain",
+ "-b",
+ "-u",
+ "--null",
+ ...customArgs.filter((arg) => !ignoredOptions.includes(arg))
+ ];
+ return {
+ format: "utf-8",
+ commands,
+ parser(text) {
+ return parseStatusSummary(text);
+ }
+ };
+}
+var ignoredOptions;
+var init_status = __esm({
+ "src/lib/tasks/status.ts"() {
+ "use strict";
+ init_StatusSummary();
+ ignoredOptions = ["--null", "-z"];
+ }
+});
+
+// src/lib/tasks/version.ts
+function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) {
+ return Object.defineProperty(
+ {
+ major,
+ minor,
+ patch,
+ agent,
+ installed
+ },
+ "toString",
+ {
+ value() {
+ return `${this.major}.${this.minor}.${this.patch}`;
+ },
+ configurable: false,
+ enumerable: false
+ }
+ );
+}
+function notInstalledResponse() {
+ return versionResponse(0, 0, 0, "", false);
+}
+function version_default() {
+ return {
+ version() {
+ return this._runTask({
+ commands: ["--version"],
+ format: "utf-8",
+ parser: versionParser,
+ onError(result, error, done, fail) {
+ if (result.exitCode === -2 /* NOT_FOUND */) {
+ return done(Buffer.from(NOT_INSTALLED));
+ }
+ fail(error);
+ }
+ });
+ }
+ };
+}
+function versionParser(stdOut) {
+ if (stdOut === NOT_INSTALLED) {
+ return notInstalledResponse();
+ }
+ return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);
+}
+var NOT_INSTALLED, parsers7;
+var init_version = __esm({
+ "src/lib/tasks/version.ts"() {
+ "use strict";
+ init_utils();
+ NOT_INSTALLED = "installed=false";
+ parsers7 = [
+ new LineParser(
+ /version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,
+ (result, [major, minor, patch, agent = ""]) => {
+ Object.assign(
+ result,
+ versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)
+ );
+ }
+ ),
+ new LineParser(
+ /version (\d+)\.(\d+)\.(\D+)(.+)?$/,
+ (result, [major, minor, patch, agent = ""]) => {
+ Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/simple-git-api.ts
+var simple_git_api_exports = {};
+__export(simple_git_api_exports, {
+ SimpleGitApi: () => SimpleGitApi
+});
+var SimpleGitApi;
+var init_simple_git_api = __esm({
+ "src/lib/simple-git-api.ts"() {
+ "use strict";
+ init_task_callback();
+ init_change_working_directory();
+ init_checkout();
+ init_commit();
+ init_config();
+ init_first_commit();
+ init_grep();
+ init_hash_object();
+ init_init();
+ init_log();
+ init_merge();
+ init_push();
+ init_show();
+ init_status();
+ init_task();
+ init_version();
+ init_utils();
+ SimpleGitApi = class {
+ constructor(_executor) {
+ this._executor = _executor;
+ }
+ _runTask(task, then) {
+ const chain = this._executor.chain();
+ const promise = chain.push(task);
+ if (then) {
+ taskCallback(task, promise, then);
+ }
+ return Object.create(this, {
+ then: { value: promise.then.bind(promise) },
+ catch: { value: promise.catch.bind(promise) },
+ _executor: { value: chain }
+ });
+ }
+ add(files) {
+ return this._runTask(
+ straightThroughStringTask(["add", ...asArray(files)]),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ cwd(directory) {
+ const next = trailingFunctionArgument(arguments);
+ if (typeof directory === "string") {
+ return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
+ }
+ if (typeof (directory == null ? void 0 : directory.path) === "string") {
+ return this._runTask(
+ changeWorkingDirectoryTask(
+ directory.path,
+ directory.root && this._executor || void 0
+ ),
+ next
+ );
+ }
+ return this._runTask(
+ configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),
+ next
+ );
+ }
+ hashObject(path, write) {
+ return this._runTask(
+ hashObjectTask(path, write === true),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ init(bare) {
+ return this._runTask(
+ initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ merge() {
+ return this._runTask(
+ mergeTask(getTrailingOptions(arguments)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ mergeFromTo(remote, branch) {
+ if (!(filterString(remote) && filterString(branch))) {
+ return this._runTask(
+ configurationErrorTask(
+ `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`
+ )
+ );
+ }
+ return this._runTask(
+ mergeTask([remote, branch, ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments, false)
+ );
+ }
+ outputHandler(handler) {
+ this._executor.outputHandler = handler;
+ return this;
+ }
+ push() {
+ const task = pushTask(
+ {
+ remote: filterType(arguments[0], filterString),
+ branch: filterType(arguments[1], filterString)
+ },
+ getTrailingOptions(arguments)
+ );
+ return this._runTask(task, trailingFunctionArgument(arguments));
+ }
+ stash() {
+ return this._runTask(
+ straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ status() {
+ return this._runTask(
+ statusTask(getTrailingOptions(arguments)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+ Object.assign(
+ SimpleGitApi.prototype,
+ checkout_default(),
+ commit_default(),
+ config_default(),
+ first_commit_default(),
+ grep_default(),
+ log_default(),
+ show_default(),
+ version_default()
+ );
+ }
+});
+
+// src/lib/runners/scheduler.ts
+var scheduler_exports = {};
+__export(scheduler_exports, {
+ Scheduler: () => Scheduler
+});
+var import_promise_deferred2, createScheduledTask, Scheduler;
+var init_scheduler = __esm({
+ "src/lib/runners/scheduler.ts"() {
+ "use strict";
+ init_utils();
+ import_promise_deferred2 = require("@kwsites/promise-deferred");
+ init_git_logger();
+ createScheduledTask = (() => {
+ let id = 0;
+ return () => {
+ id++;
+ const { promise, done } = (0, import_promise_deferred2.createDeferred)();
+ return {
+ promise,
+ done,
+ id
+ };
+ };
+ })();
+ Scheduler = class {
+ constructor(concurrency = 2) {
+ this.concurrency = concurrency;
+ this.logger = createLogger("", "scheduler");
+ this.pending = [];
+ this.running = [];
+ this.logger(`Constructed, concurrency=%s`, concurrency);
+ }
+ schedule() {
+ if (!this.pending.length || this.running.length >= this.concurrency) {
+ this.logger(
+ `Schedule attempt ignored, pending=%s running=%s concurrency=%s`,
+ this.pending.length,
+ this.running.length,
+ this.concurrency
+ );
+ return;
+ }
+ const task = append(this.running, this.pending.shift());
+ this.logger(`Attempting id=%s`, task.id);
+ task.done(() => {
+ this.logger(`Completing id=`, task.id);
+ remove(this.running, task);
+ this.schedule();
+ });
+ }
+ next() {
+ const { promise, id } = append(this.pending, createScheduledTask());
+ this.logger(`Scheduling id=%s`, id);
+ this.schedule();
+ return promise;
+ }
+ };
+ }
+});
+
+// src/lib/tasks/apply-patch.ts
+var apply_patch_exports = {};
+__export(apply_patch_exports, {
+ applyPatchTask: () => applyPatchTask
+});
+function applyPatchTask(patches, customArgs) {
+ return straightThroughStringTask(["apply", ...customArgs, ...patches]);
+}
+var init_apply_patch = __esm({
+ "src/lib/tasks/apply-patch.ts"() {
+ "use strict";
+ init_task();
+ }
+});
+
+// src/lib/responses/BranchDeleteSummary.ts
+function branchDeletionSuccess(branch, hash) {
+ return {
+ branch,
+ hash,
+ success: true
+ };
+}
+function branchDeletionFailure(branch) {
+ return {
+ branch,
+ hash: null,
+ success: false
+ };
+}
+var BranchDeletionBatch;
+var init_BranchDeleteSummary = __esm({
+ "src/lib/responses/BranchDeleteSummary.ts"() {
+ "use strict";
+ BranchDeletionBatch = class {
+ constructor() {
+ this.all = [];
+ this.branches = {};
+ this.errors = [];
+ }
+ get success() {
+ return !this.errors.length;
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-branch-delete.ts
+function hasBranchDeletionError(data, processExitCode) {
+ return processExitCode === 1 /* ERROR */ && deleteErrorRegex.test(data);
+}
+var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions;
+var init_parse_branch_delete = __esm({
+ "src/lib/parsers/parse-branch-delete.ts"() {
+ "use strict";
+ init_BranchDeleteSummary();
+ init_utils();
+ deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
+ deleteErrorRegex = /^error[^']+'([^']+)'/m;
+ parsers8 = [
+ new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
+ const deletion = branchDeletionSuccess(branch, hash);
+ result.all.push(deletion);
+ result.branches[branch] = deletion;
+ }),
+ new LineParser(deleteErrorRegex, (result, [branch]) => {
+ const deletion = branchDeletionFailure(branch);
+ result.errors.push(deletion);
+ result.all.push(deletion);
+ result.branches[branch] = deletion;
+ })
+ ];
+ parseBranchDeletions = (stdOut, stdErr) => {
+ return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]);
+ };
+ }
+});
+
+// src/lib/responses/BranchSummary.ts
+var BranchSummaryResult;
+var init_BranchSummary = __esm({
+ "src/lib/responses/BranchSummary.ts"() {
+ "use strict";
+ BranchSummaryResult = class {
+ constructor() {
+ this.all = [];
+ this.branches = {};
+ this.current = "";
+ this.detached = false;
+ }
+ push(status, detached, name, commit, label) {
+ if (status === "*" /* CURRENT */) {
+ this.detached = detached;
+ this.current = name;
+ }
+ this.all.push(name);
+ this.branches[name] = {
+ current: status === "*" /* CURRENT */,
+ linkedWorkTree: status === "+" /* LINKED */,
+ name,
+ commit,
+ label
+ };
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-branch.ts
+function branchStatus(input) {
+ return input ? input.charAt(0) : "";
+}
+function parseBranchSummary(stdOut) {
+ return parseStringResponse(new BranchSummaryResult(), parsers9, stdOut);
+}
+var parsers9;
+var init_parse_branch = __esm({
+ "src/lib/parsers/parse-branch.ts"() {
+ "use strict";
+ init_BranchSummary();
+ init_utils();
+ parsers9 = [
+ new LineParser(
+ /^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,
+ (result, [current, name, commit, label]) => {
+ result.push(branchStatus(current), true, name, commit, label);
+ }
+ ),
+ new LineParser(
+ new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$", "s"),
+ (result, [current, name, commit, label]) => {
+ result.push(branchStatus(current), false, name, commit, label);
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/tasks/branch.ts
+var branch_exports = {};
+__export(branch_exports, {
+ branchLocalTask: () => branchLocalTask,
+ branchTask: () => branchTask,
+ containsDeleteBranchCommand: () => containsDeleteBranchCommand,
+ deleteBranchTask: () => deleteBranchTask,
+ deleteBranchesTask: () => deleteBranchesTask
+});
+function containsDeleteBranchCommand(commands) {
+ const deleteCommands = ["-d", "-D", "--delete"];
+ return commands.some((command) => deleteCommands.includes(command));
+}
+function branchTask(customArgs) {
+ const isDelete = containsDeleteBranchCommand(customArgs);
+ const commands = ["branch", ...customArgs];
+ if (commands.length === 1) {
+ commands.push("-a");
+ }
+ if (!commands.includes("-v")) {
+ commands.splice(1, 0, "-v");
+ }
+ return {
+ format: "utf-8",
+ commands,
+ parser(stdOut, stdErr) {
+ if (isDelete) {
+ return parseBranchDeletions(stdOut, stdErr).all[0];
+ }
+ return parseBranchSummary(stdOut);
+ }
+ };
+}
+function branchLocalTask() {
+ const parser3 = parseBranchSummary;
+ return {
+ format: "utf-8",
+ commands: ["branch", "-v"],
+ parser: parser3
+ };
+}
+function deleteBranchesTask(branches, forceDelete = false) {
+ return {
+ format: "utf-8",
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", ...branches],
+ parser(stdOut, stdErr) {
+ return parseBranchDeletions(stdOut, stdErr);
+ },
+ onError({ exitCode, stdOut }, error, done, fail) {
+ if (!hasBranchDeletionError(String(error), exitCode)) {
+ return fail(error);
+ }
+ done(stdOut);
+ }
+ };
+}
+function deleteBranchTask(branch, forceDelete = false) {
+ const task = {
+ format: "utf-8",
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", branch],
+ parser(stdOut, stdErr) {
+ return parseBranchDeletions(stdOut, stdErr).branches[branch];
+ },
+ onError({ exitCode, stdErr, stdOut }, error, _, fail) {
+ if (!hasBranchDeletionError(String(error), exitCode)) {
+ return fail(error);
+ }
+ throw new GitResponseError(
+ task.parser(bufferToString(stdOut), bufferToString(stdErr)),
+ String(error)
+ );
+ }
+ };
+ return task;
+}
+var init_branch = __esm({
+ "src/lib/tasks/branch.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_parse_branch_delete();
+ init_parse_branch();
+ init_utils();
+ }
+});
+
+// src/lib/responses/CheckIgnore.ts
+var parseCheckIgnore;
+var init_CheckIgnore = __esm({
+ "src/lib/responses/CheckIgnore.ts"() {
+ "use strict";
+ parseCheckIgnore = (text) => {
+ return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file);
+ };
+ }
+});
+
+// src/lib/tasks/check-ignore.ts
+var check_ignore_exports = {};
+__export(check_ignore_exports, {
+ checkIgnoreTask: () => checkIgnoreTask
+});
+function checkIgnoreTask(paths) {
+ return {
+ commands: ["check-ignore", ...paths],
+ format: "utf-8",
+ parser: parseCheckIgnore
+ };
+}
+var init_check_ignore = __esm({
+ "src/lib/tasks/check-ignore.ts"() {
+ "use strict";
+ init_CheckIgnore();
+ }
+});
+
+// src/lib/tasks/clone.ts
+var clone_exports = {};
+__export(clone_exports, {
+ cloneMirrorTask: () => cloneMirrorTask,
+ cloneTask: () => cloneTask
+});
+function disallowedCommand(command) {
+ return /^--upload-pack(=|$)/.test(command);
+}
+function cloneTask(repo, directory, customArgs) {
+ const commands = ["clone", ...customArgs];
+ filterString(repo) && commands.push(repo);
+ filterString(directory) && commands.push(directory);
+ const banned = commands.find(disallowedCommand);
+ if (banned) {
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
+ }
+ return straightThroughStringTask(commands);
+}
+function cloneMirrorTask(repo, directory, customArgs) {
+ append(customArgs, "--mirror");
+ return cloneTask(repo, directory, customArgs);
+}
+var init_clone = __esm({
+ "src/lib/tasks/clone.ts"() {
+ "use strict";
+ init_task();
+ init_utils();
+ }
+});
+
+// src/lib/parsers/parse-fetch.ts
+function parseFetchResult(stdOut, stdErr) {
+ const result = {
+ raw: stdOut,
+ remote: null,
+ branches: [],
+ tags: [],
+ updated: [],
+ deleted: []
+ };
+ return parseStringResponse(result, parsers10, [stdOut, stdErr]);
+}
+var parsers10;
+var init_parse_fetch = __esm({
+ "src/lib/parsers/parse-fetch.ts"() {
+ "use strict";
+ init_utils();
+ parsers10 = [
+ new LineParser(/From (.+)$/, (result, [remote]) => {
+ result.remote = remote;
+ }),
+ new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
+ result.branches.push({
+ name,
+ tracking
+ });
+ }),
+ new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
+ result.tags.push({
+ name,
+ tracking
+ });
+ }),
+ new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result, [tracking]) => {
+ result.deleted.push({
+ tracking
+ });
+ }),
+ new LineParser(
+ /\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,
+ (result, [from, to, name, tracking]) => {
+ result.updated.push({
+ name,
+ tracking,
+ to,
+ from
+ });
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/tasks/fetch.ts
+var fetch_exports = {};
+__export(fetch_exports, {
+ fetchTask: () => fetchTask
+});
+function disallowedCommand2(command) {
+ return /^--upload-pack(=|$)/.test(command);
+}
+function fetchTask(remote, branch, customArgs) {
+ const commands = ["fetch", ...customArgs];
+ if (remote && branch) {
+ commands.push(remote, branch);
+ }
+ const banned = commands.find(disallowedCommand2);
+ if (banned) {
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser: parseFetchResult
+ };
+}
+var init_fetch = __esm({
+ "src/lib/tasks/fetch.ts"() {
+ "use strict";
+ init_parse_fetch();
+ init_task();
+ }
+});
+
+// src/lib/parsers/parse-move.ts
+function parseMoveResult(stdOut) {
+ return parseStringResponse({ moves: [] }, parsers11, stdOut);
+}
+var parsers11;
+var init_parse_move = __esm({
+ "src/lib/parsers/parse-move.ts"() {
+ "use strict";
+ init_utils();
+ parsers11 = [
+ new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
+ result.moves.push({ from, to });
+ })
+ ];
+ }
+});
+
+// src/lib/tasks/move.ts
+var move_exports = {};
+__export(move_exports, {
+ moveTask: () => moveTask
+});
+function moveTask(from, to) {
+ return {
+ commands: ["mv", "-v", ...asArray(from), to],
+ format: "utf-8",
+ parser: parseMoveResult
+ };
+}
+var init_move = __esm({
+ "src/lib/tasks/move.ts"() {
+ "use strict";
+ init_parse_move();
+ init_utils();
+ }
+});
+
+// src/lib/tasks/pull.ts
+var pull_exports = {};
+__export(pull_exports, {
+ pullTask: () => pullTask
+});
+function pullTask(remote, branch, customArgs) {
+ const commands = ["pull", ...customArgs];
+ if (remote && branch) {
+ commands.splice(1, 0, remote, branch);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(stdOut, stdErr) {
+ return parsePullResult(stdOut, stdErr);
+ },
+ onError(result, _error, _done, fail) {
+ const pullError = parsePullErrorResult(
+ bufferToString(result.stdOut),
+ bufferToString(result.stdErr)
+ );
+ if (pullError) {
+ return fail(new GitResponseError(pullError));
+ }
+ fail(_error);
+ }
+ };
+}
+var init_pull = __esm({
+ "src/lib/tasks/pull.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_parse_pull();
+ init_utils();
+ }
+});
+
+// src/lib/responses/GetRemoteSummary.ts
+function parseGetRemotes(text) {
+ const remotes = {};
+ forEach(text, ([name]) => remotes[name] = { name });
+ return Object.values(remotes);
+}
+function parseGetRemotesVerbose(text) {
+ const remotes = {};
+ forEach(text, ([name, url, purpose]) => {
+ if (!remotes.hasOwnProperty(name)) {
+ remotes[name] = {
+ name,
+ refs: { fetch: "", push: "" }
+ };
+ }
+ if (purpose && url) {
+ remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url;
+ }
+ });
+ return Object.values(remotes);
+}
+function forEach(text, handler) {
+ forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
+}
+var init_GetRemoteSummary = __esm({
+ "src/lib/responses/GetRemoteSummary.ts"() {
+ "use strict";
+ init_utils();
+ }
+});
+
+// src/lib/tasks/remote.ts
+var remote_exports = {};
+__export(remote_exports, {
+ addRemoteTask: () => addRemoteTask,
+ getRemotesTask: () => getRemotesTask,
+ listRemotesTask: () => listRemotesTask,
+ remoteTask: () => remoteTask,
+ removeRemoteTask: () => removeRemoteTask
+});
+function addRemoteTask(remoteName, remoteRepo, customArgs) {
+ return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]);
+}
+function getRemotesTask(verbose) {
+ const commands = ["remote"];
+ if (verbose) {
+ commands.push("-v");
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
+ };
+}
+function listRemotesTask(customArgs) {
+ const commands = [...customArgs];
+ if (commands[0] !== "ls-remote") {
+ commands.unshift("ls-remote");
+ }
+ return straightThroughStringTask(commands);
+}
+function remoteTask(customArgs) {
+ const commands = [...customArgs];
+ if (commands[0] !== "remote") {
+ commands.unshift("remote");
+ }
+ return straightThroughStringTask(commands);
+}
+function removeRemoteTask(remoteName) {
+ return straightThroughStringTask(["remote", "remove", remoteName]);
+}
+var init_remote = __esm({
+ "src/lib/tasks/remote.ts"() {
+ "use strict";
+ init_GetRemoteSummary();
+ init_task();
+ }
+});
+
+// src/lib/tasks/stash-list.ts
+var stash_list_exports = {};
+__export(stash_list_exports, {
+ stashListTask: () => stashListTask
+});
+function stashListTask(opt = {}, customArgs) {
+ const options = parseLogOptions(opt);
+ const commands = ["stash", "list", ...options.commands, ...customArgs];
+ const parser3 = createListLogSummaryParser(
+ options.splitter,
+ options.fields,
+ logFormatFromCommand(commands)
+ );
+ return validateLogFormatConfig(commands) || {
+ commands,
+ format: "utf-8",
+ parser: parser3
+ };
+}
+var init_stash_list = __esm({
+ "src/lib/tasks/stash-list.ts"() {
+ "use strict";
+ init_log_format();
+ init_parse_list_log_summary();
+ init_diff();
+ init_log();
+ }
+});
+
+// src/lib/tasks/sub-module.ts
+var sub_module_exports = {};
+__export(sub_module_exports, {
+ addSubModuleTask: () => addSubModuleTask,
+ initSubModuleTask: () => initSubModuleTask,
+ subModuleTask: () => subModuleTask,
+ updateSubModuleTask: () => updateSubModuleTask
+});
+function addSubModuleTask(repo, path) {
+ return subModuleTask(["add", repo, path]);
+}
+function initSubModuleTask(customArgs) {
+ return subModuleTask(["init", ...customArgs]);
+}
+function subModuleTask(customArgs) {
+ const commands = [...customArgs];
+ if (commands[0] !== "submodule") {
+ commands.unshift("submodule");
+ }
+ return straightThroughStringTask(commands);
+}
+function updateSubModuleTask(customArgs) {
+ return subModuleTask(["update", ...customArgs]);
+}
+var init_sub_module = __esm({
+ "src/lib/tasks/sub-module.ts"() {
+ "use strict";
+ init_task();
+ }
+});
+
+// src/lib/responses/TagList.ts
+function singleSorted(a, b) {
+ const aIsNum = isNaN(a);
+ const bIsNum = isNaN(b);
+ if (aIsNum !== bIsNum) {
+ return aIsNum ? 1 : -1;
+ }
+ return aIsNum ? sorted(a, b) : 0;
+}
+function sorted(a, b) {
+ return a === b ? 0 : a > b ? 1 : -1;
+}
+function trimmed(input) {
+ return input.trim();
+}
+function toNumber(input) {
+ if (typeof input === "string") {
+ return parseInt(input.replace(/^\D+/g, ""), 10) || 0;
+ }
+ return 0;
+}
+var TagList, parseTagList;
+var init_TagList = __esm({
+ "src/lib/responses/TagList.ts"() {
+ "use strict";
+ TagList = class {
+ constructor(all, latest) {
+ this.all = all;
+ this.latest = latest;
+ }
+ };
+ parseTagList = function(data, customSort = false) {
+ const tags = data.split("\n").map(trimmed).filter(Boolean);
+ if (!customSort) {
+ tags.sort(function(tagA, tagB) {
+ const partsA = tagA.split(".");
+ const partsB = tagB.split(".");
+ if (partsA.length === 1 || partsB.length === 1) {
+ return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
+ }
+ for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
+ const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
+ if (diff) {
+ return diff;
+ }
+ }
+ return 0;
+ });
+ }
+ const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0);
+ return new TagList(tags, latest);
+ };
+ }
+});
+
+// src/lib/tasks/tag.ts
+var tag_exports = {};
+__export(tag_exports, {
+ addAnnotatedTagTask: () => addAnnotatedTagTask,
+ addTagTask: () => addTagTask,
+ tagListTask: () => tagListTask
+});
+function tagListTask(customArgs = []) {
+ const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
+ return {
+ format: "utf-8",
+ commands: ["tag", "-l", ...customArgs],
+ parser(text) {
+ return parseTagList(text, hasCustomSort);
+ }
+ };
+}
+function addTagTask(name) {
+ return {
+ format: "utf-8",
+ commands: ["tag", name],
+ parser() {
+ return { name };
+ }
+ };
+}
+function addAnnotatedTagTask(name, tagMessage) {
+ return {
+ format: "utf-8",
+ commands: ["tag", "-a", "-m", tagMessage, name],
+ parser() {
+ return { name };
+ }
+ };
+}
+var init_tag = __esm({
+ "src/lib/tasks/tag.ts"() {
+ "use strict";
+ init_TagList();
+ }
+});
+
+// src/git.js
+var require_git = __commonJS({
+ "src/git.js"(exports2, module2) {
+ "use strict";
+ var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
+ var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
+ var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
+ var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
+ var {
+ asArray: asArray2,
+ filterArray: filterArray2,
+ filterPrimitives: filterPrimitives2,
+ filterString: filterString2,
+ filterStringOrStringArray: filterStringOrStringArray2,
+ filterType: filterType2,
+ getTrailingOptions: getTrailingOptions2,
+ trailingFunctionArgument: trailingFunctionArgument2,
+ trailingOptionsArgument: trailingOptionsArgument2
+ } = (init_utils(), __toCommonJS(utils_exports));
+ var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
+ var {
+ branchTask: branchTask2,
+ branchLocalTask: branchLocalTask2,
+ deleteBranchesTask: deleteBranchesTask2,
+ deleteBranchTask: deleteBranchTask2
+ } = (init_branch(), __toCommonJS(branch_exports));
+ var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
+ var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
+ var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports));
+ var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
+ var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
+ var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
+ var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
+ var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
+ var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
+ var {
+ addRemoteTask: addRemoteTask2,
+ getRemotesTask: getRemotesTask2,
+ listRemotesTask: listRemotesTask2,
+ remoteTask: remoteTask2,
+ removeRemoteTask: removeRemoteTask2
+ } = (init_remote(), __toCommonJS(remote_exports));
+ var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
+ var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
+ var {
+ addSubModuleTask: addSubModuleTask2,
+ initSubModuleTask: initSubModuleTask2,
+ subModuleTask: subModuleTask2,
+ updateSubModuleTask: updateSubModuleTask2
+ } = (init_sub_module(), __toCommonJS(sub_module_exports));
+ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
+ var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
+ function Git2(options, plugins) {
+ this._plugins = plugins;
+ this._executor = new GitExecutor2(
+ options.baseDir,
+ new Scheduler2(options.maxConcurrentProcesses),
+ plugins
+ );
+ this._trimmed = options.trimmed;
+ }
+ (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
+ Git2.prototype.customBinary = function(command) {
+ this._plugins.reconfigure("binary", command);
+ return this;
+ };
+ Git2.prototype.env = function(name, value) {
+ if (arguments.length === 1 && typeof name === "object") {
+ this._executor.env = name;
+ } else {
+ (this._executor.env = this._executor.env || {})[name] = value;
+ }
+ return this;
+ };
+ Git2.prototype.stashList = function(options) {
+ return this._runTask(
+ stashListTask2(
+ trailingOptionsArgument2(arguments) || {},
+ filterArray2(options) && options || []
+ ),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ function createCloneTask(api, task, repoPath, localPath) {
+ if (typeof repoPath !== "string") {
+ return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`);
+ }
+ return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
+ }
+ Git2.prototype.clone = function() {
+ return this._runTask(
+ createCloneTask("clone", cloneTask2, ...arguments),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.mirror = function() {
+ return this._runTask(
+ createCloneTask("mirror", cloneMirrorTask2, ...arguments),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.mv = function(from, to) {
+ return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.checkoutLatestTag = function(then) {
+ var git = this;
+ return this.pull(function() {
+ git.tags(function(err, tags) {
+ git.checkout(tags.latest, then);
+ });
+ });
+ };
+ Git2.prototype.pull = function(remote, branch, options, then) {
+ return this._runTask(
+ pullTask2(
+ filterType2(remote, filterString2),
+ filterType2(branch, filterString2),
+ getTrailingOptions2(arguments)
+ ),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.fetch = function(remote, branch) {
+ return this._runTask(
+ fetchTask2(
+ filterType2(remote, filterString2),
+ filterType2(branch, filterString2),
+ getTrailingOptions2(arguments)
+ ),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.silent = function(silence) {
+ console.warn(
+ "simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"
+ );
+ return this;
+ };
+ Git2.prototype.tags = function(options, then) {
+ return this._runTask(
+ tagListTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.rebase = function() {
+ return this._runTask(
+ straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.reset = function(mode) {
+ return this._runTask(
+ resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.revert = function(commit) {
+ const next = trailingFunctionArgument2(arguments);
+ if (typeof commit !== "string") {
+ return this._runTask(configurationErrorTask2("Commit must be a string"), next);
+ }
+ return this._runTask(
+ straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]),
+ next
+ );
+ };
+ Git2.prototype.addTag = function(name) {
+ const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
+ return this._runTask(
+ addAnnotatedTagTask2(tagName, tagMessage),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
+ return this._runTask(
+ deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
+ return this._runTask(
+ deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.branch = function(options, then) {
+ return this._runTask(
+ branchTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.branchLocal = function(then) {
+ return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.raw = function(commands) {
+ const createRestCommands = !Array.isArray(commands);
+ const command = [].slice.call(createRestCommands ? arguments : commands, 0);
+ for (let i = 0; i < command.length && createRestCommands; i++) {
+ if (!filterPrimitives2(command[i])) {
+ command.splice(i, command.length - i);
+ break;
+ }
+ }
+ command.push(...getTrailingOptions2(arguments, 0, true));
+ var next = trailingFunctionArgument2(arguments);
+ if (!command.length) {
+ return this._runTask(
+ configurationErrorTask2("Raw: must supply one or more command to execute"),
+ next
+ );
+ }
+ return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
+ };
+ Git2.prototype.submoduleAdd = function(repo, path, then) {
+ return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.submoduleUpdate = function(args, then) {
+ return this._runTask(
+ updateSubModuleTask2(getTrailingOptions2(arguments, true)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.submoduleInit = function(args, then) {
+ return this._runTask(
+ initSubModuleTask2(getTrailingOptions2(arguments, true)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.subModule = function(options, then) {
+ return this._runTask(
+ subModuleTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.listRemote = function() {
+ return this._runTask(
+ listRemotesTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
+ return this._runTask(
+ addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.removeRemote = function(remoteName, then) {
+ return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.getRemotes = function(verbose, then) {
+ return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.remote = function(options, then) {
+ return this._runTask(
+ remoteTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.tag = function(options, then) {
+ const command = getTrailingOptions2(arguments);
+ if (command[0] !== "tag") {
+ command.unshift("tag");
+ }
+ return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.updateServerInfo = function(then) {
+ return this._runTask(
+ straightThroughStringTask2(["update-server-info"]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.pushTags = function(remote, then) {
+ const task = pushTagsTask2(
+ { remote: filterType2(remote, filterString2) },
+ getTrailingOptions2(arguments)
+ );
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.rm = function(files) {
+ return this._runTask(
+ straightThroughStringTask2(["rm", "-f", ...asArray2(files)]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.rmKeepLocal = function(files) {
+ return this._runTask(
+ straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.catFile = function(options, then) {
+ return this._catFile("utf-8", arguments);
+ };
+ Git2.prototype.binaryCatFile = function() {
+ return this._catFile("buffer", arguments);
+ };
+ Git2.prototype._catFile = function(format, args) {
+ var handler = trailingFunctionArgument2(args);
+ var command = ["cat-file"];
+ var options = args[0];
+ if (typeof options === "string") {
+ return this._runTask(
+ configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"),
+ handler
+ );
+ }
+ if (Array.isArray(options)) {
+ command.push.apply(command, options);
+ }
+ const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
+ return this._runTask(task, handler);
+ };
+ Git2.prototype.diff = function(options, then) {
+ const task = filterString2(options) ? configurationErrorTask2(
+ "git.diff: supplying options as a single string is no longer supported, switch to an array of strings"
+ ) : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]);
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.diffSummary = function() {
+ return this._runTask(
+ diffSummaryTask2(getTrailingOptions2(arguments, 1)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.applyPatch = function(patches) {
+ const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(
+ `git.applyPatch requires one or more string patches as the first argument`
+ ) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.revparse = function() {
+ const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
+ return this._runTask(
+ straightThroughStringTask2(commands, true),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.clean = function(mode, options, then) {
+ const usingCleanOptionsArray = isCleanOptionsArray2(mode);
+ const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
+ const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
+ return this._runTask(
+ cleanWithOptionsTask2(cleanMode, customArgs),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.exec = function(then) {
+ const task = {
+ commands: [],
+ format: "utf-8",
+ parser() {
+ if (typeof then === "function") {
+ then();
+ }
+ }
+ };
+ return this._runTask(task);
+ };
+ Git2.prototype.clearQueue = function() {
+ return this;
+ };
+ Git2.prototype.checkIgnore = function(pathnames, then) {
+ return this._runTask(
+ checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.checkIsRepo = function(checkType, then) {
+ return this._runTask(
+ checkIsRepoTask2(filterType2(checkType, filterString2)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ module2.exports = Git2;
+ }
+});
+
+// src/lib/git-factory.ts
+var git_factory_exports = {};
+__export(git_factory_exports, {
+ esModuleFactory: () => esModuleFactory,
+ gitExportFactory: () => gitExportFactory,
+ gitInstanceFactory: () => gitInstanceFactory
+});
+function esModuleFactory(defaultExport) {
+ return Object.defineProperties(defaultExport, {
+ __esModule: { value: true },
+ default: { value: defaultExport }
+ });
+}
+function gitExportFactory(factory) {
+ return Object.assign(factory.bind(null), api_exports);
+}
+function gitInstanceFactory(baseDir, options) {
+ var _a2;
+ const plugins = new PluginStore();
+ const config = createInstanceConfig(
+ baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {},
+ options
+ );
+ if (!folderExists(config.baseDir)) {
+ throw new GitConstructError(
+ config,
+ `Cannot use simple-git on a directory that does not exist`
+ );
+ }
+ if (Array.isArray(config.config)) {
+ plugins.add(commandConfigPrefixingPlugin(config.config));
+ }
+ plugins.add(blockUnsafeOperationsPlugin(config.unsafe));
+ plugins.add(suffixPathsPlugin());
+ plugins.add(completionDetectionPlugin(config.completion));
+ config.abort && plugins.add(abortPlugin(config.abort));
+ config.progress && plugins.add(progressMonitorPlugin(config.progress));
+ config.timeout && plugins.add(timeoutPlugin(config.timeout));
+ config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
+ plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
+ config.errors && plugins.add(errorDetectionPlugin(config.errors));
+ customBinaryPlugin(plugins, config.binary, (_a2 = config.unsafe) == null ? void 0 : _a2.allowUnsafeCustomBinary);
+ return new Git(config, plugins);
+}
+var Git;
+var init_git_factory = __esm({
+ "src/lib/git-factory.ts"() {
+ "use strict";
+ init_api();
+ init_plugins();
+ init_suffix_paths_plugin();
+ init_utils();
+ Git = require_git();
+ }
+});
+
+// src/lib/runners/promise-wrapped.ts
+var promise_wrapped_exports = {};
+__export(promise_wrapped_exports, {
+ gitP: () => gitP
+});
+function gitP(...args) {
+ let git;
+ let chain = Promise.resolve();
+ try {
+ git = gitInstanceFactory(...args);
+ } catch (e) {
+ chain = Promise.reject(e);
+ }
+ function builderReturn() {
+ return promiseApi;
+ }
+ function chainReturn() {
+ return chain;
+ }
+ const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce(
+ (api, name) => {
+ const isAsync = functionNamesPromiseApi.includes(name);
+ const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api);
+ const alternative = isAsync ? chainReturn : builderReturn;
+ Object.defineProperty(api, name, {
+ enumerable: false,
+ configurable: false,
+ value: git ? valid : alternative
+ });
+ return api;
+ },
+ {}
+ );
+ return promiseApi;
+ function asyncWrapper(fn, git2) {
+ return function(...args2) {
+ if (typeof args2[args2.length] === "function") {
+ throw new TypeError(
+ "Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn
+ );
+ }
+ return chain.then(function() {
+ return new Promise(function(resolve, reject) {
+ const callback = (err, result) => {
+ if (err) {
+ return reject(toError(err));
+ }
+ resolve(result);
+ };
+ args2.push(callback);
+ git2[fn].apply(git2, args2);
+ });
+ });
+ };
+ }
+ function syncWrapper(fn, git2, api) {
+ return (...args2) => {
+ git2[fn](...args2);
+ return api;
+ };
+ }
+}
+function toError(error) {
+ if (error instanceof Error) {
+ return error;
+ }
+ if (typeof error === "string") {
+ return new Error(error);
+ }
+ return new GitResponseError(error);
+}
+var functionNamesBuilderApi, functionNamesPromiseApi;
+var init_promise_wrapped = __esm({
+ "src/lib/runners/promise-wrapped.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_git_factory();
+ functionNamesBuilderApi = ["customBinary", "env", "outputHandler", "silent"];
+ functionNamesPromiseApi = [
+ "add",
+ "addAnnotatedTag",
+ "addConfig",
+ "addRemote",
+ "addTag",
+ "applyPatch",
+ "binaryCatFile",
+ "branch",
+ "branchLocal",
+ "catFile",
+ "checkIgnore",
+ "checkIsRepo",
+ "checkout",
+ "checkoutBranch",
+ "checkoutLatestTag",
+ "checkoutLocalBranch",
+ "clean",
+ "clone",
+ "commit",
+ "cwd",
+ "deleteLocalBranch",
+ "deleteLocalBranches",
+ "diff",
+ "diffSummary",
+ "exec",
+ "fetch",
+ "getRemotes",
+ "init",
+ "listConfig",
+ "listRemote",
+ "log",
+ "merge",
+ "mergeFromTo",
+ "mirror",
+ "mv",
+ "pull",
+ "push",
+ "pushTags",
+ "raw",
+ "rebase",
+ "remote",
+ "removeRemote",
+ "reset",
+ "revert",
+ "revparse",
+ "rm",
+ "rmKeepLocal",
+ "show",
+ "stash",
+ "stashList",
+ "status",
+ "subModule",
+ "submoduleAdd",
+ "submoduleInit",
+ "submoduleUpdate",
+ "tag",
+ "tags",
+ "updateServerInfo"
+ ];
+ }
+});
+
+// src/index.js
+var { gitP: gitP2 } = (init_promise_wrapped(), __toCommonJS(promise_wrapped_exports));
+var { esModuleFactory: esModuleFactory2, gitInstanceFactory: gitInstanceFactory2, gitExportFactory: gitExportFactory2 } = (init_git_factory(), __toCommonJS(git_factory_exports));
+var simpleGit = esModuleFactory2(gitExportFactory2(gitInstanceFactory2));
+module.exports = Object.assign(simpleGit, { gitP: gitP2, simpleGit });
+//# sourceMappingURL=index.js.map
diff --git a/node_modules/simple-git/dist/cjs/index.js.map b/node_modules/simple-git/dist/cjs/index.js.map
new file mode 100644
index 0000000..8336bc0
--- /dev/null
+++ b/node_modules/simple-git/dist/cjs/index.js.map
@@ -0,0 +1,7 @@
+{
+ "version": 3,
+ "sources": ["../../src/lib/errors/git-error.ts", "../../src/lib/errors/git-response-error.ts", "../../src/lib/args/pathspec.ts", "../../src/lib/errors/git-construct-error.ts", "../../src/lib/errors/git-plugin-error.ts", "../../src/lib/errors/task-configuration-error.ts", "../../src/lib/utils/util.ts", "../../src/lib/utils/argument-filters.ts", "../../src/lib/utils/exit-codes.ts", "../../src/lib/utils/git-output-streams.ts", "../../src/lib/utils/line-parser.ts", "../../src/lib/utils/simple-git-options.ts", "../../src/lib/utils/task-options.ts", "../../src/lib/utils/task-parser.ts", "../../src/lib/utils/index.ts", "../../src/lib/tasks/check-is-repo.ts", "../../src/lib/responses/CleanSummary.ts", "../../src/lib/tasks/task.ts", "../../src/lib/tasks/clean.ts", "../../src/lib/responses/ConfigList.ts", "../../src/lib/tasks/config.ts", "../../src/lib/tasks/diff-name-status.ts", "../../src/lib/tasks/grep.ts", "../../src/lib/tasks/reset.ts", "../../src/lib/api.ts", "../../src/lib/plugins/abort-plugin.ts", "../../src/lib/plugins/block-unsafe-operations-plugin.ts", "../../src/lib/plugins/command-config-prefixing-plugin.ts", "../../src/lib/plugins/completion-detection.plugin.ts", "../../src/lib/plugins/custom-binary.plugin.ts", "../../src/lib/plugins/error-detection.plugin.ts", "../../src/lib/plugins/plugin-store.ts", "../../src/lib/plugins/progress-monitor-plugin.ts", "../../src/lib/plugins/simple-git-plugin.ts", "../../src/lib/plugins/spawn-options-plugin.ts", "../../src/lib/plugins/timout-plugin.ts", "../../src/lib/plugins/index.ts", "../../src/lib/plugins/suffix-paths.plugin.ts", "../../src/lib/git-logger.ts", "../../src/lib/runners/tasks-pending-queue.ts", "../../src/lib/runners/git-executor-chain.ts", "../../src/lib/runners/git-executor.ts", "../../src/lib/task-callback.ts", "../../src/lib/tasks/change-working-directory.ts", "../../src/lib/tasks/checkout.ts", "../../src/lib/parsers/parse-commit.ts", "../../src/lib/tasks/commit.ts", "../../src/lib/tasks/first-commit.ts", "../../src/lib/tasks/hash-object.ts", "../../src/lib/responses/InitSummary.ts", "../../src/lib/tasks/init.ts", "../../src/lib/args/log-format.ts", "../../src/lib/responses/DiffSummary.ts", "../../src/lib/parsers/parse-diff-summary.ts", "../../src/lib/parsers/parse-list-log-summary.ts", "../../src/lib/tasks/diff.ts", "../../src/lib/tasks/log.ts", "../../src/lib/responses/MergeSummary.ts", "../../src/lib/responses/PullSummary.ts", "../../src/lib/parsers/parse-remote-objects.ts", "../../src/lib/parsers/parse-remote-messages.ts", "../../src/lib/parsers/parse-pull.ts", "../../src/lib/parsers/parse-merge.ts", "../../src/lib/tasks/merge.ts", "../../src/lib/parsers/parse-push.ts", "../../src/lib/tasks/push.ts", "../../src/lib/tasks/show.ts", "../../src/lib/responses/FileStatusSummary.ts", "../../src/lib/responses/StatusSummary.ts", "../../src/lib/tasks/status.ts", "../../src/lib/tasks/version.ts", "../../src/lib/simple-git-api.ts", "../../src/lib/runners/scheduler.ts", "../../src/lib/tasks/apply-patch.ts", "../../src/lib/responses/BranchDeleteSummary.ts", "../../src/lib/parsers/parse-branch-delete.ts", "../../src/lib/responses/BranchSummary.ts", "../../src/lib/parsers/parse-branch.ts", "../../src/lib/tasks/branch.ts", "../../src/lib/responses/CheckIgnore.ts", "../../src/lib/tasks/check-ignore.ts", "../../src/lib/tasks/clone.ts", "../../src/lib/parsers/parse-fetch.ts", "../../src/lib/tasks/fetch.ts", "../../src/lib/parsers/parse-move.ts", "../../src/lib/tasks/move.ts", "../../src/lib/tasks/pull.ts", "../../src/lib/responses/GetRemoteSummary.ts", "../../src/lib/tasks/remote.ts", "../../src/lib/tasks/stash-list.ts", "../../src/lib/tasks/sub-module.ts", "../../src/lib/responses/TagList.ts", "../../src/lib/tasks/tag.ts", "../../src/git.js", "../../src/lib/git-factory.ts", "../../src/lib/runners/promise-wrapped.ts", "../../src/index.js"],
+ "sourcesContent": ["import type { SimpleGitTask } from '../types';\n\n/**\n * The `GitError` is thrown when the underlying `git` process throws a\n * fatal exception (eg an `ENOENT` exception when attempting to use a\n * non-writable directory as the root for your repo), and acts as the\n * base class for more specific errors thrown by the parsing of the\n * git response or errors in the configuration of the task about to\n * be run.\n *\n * When an exception is thrown, pending tasks in the same instance will\n * not be executed. The recommended way to run a series of tasks that\n * can independently fail without needing to prevent future tasks from\n * running is to catch them individually:\n *\n * ```typescript\n import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';\n\n function catchTask (e: GitError) {\n return e.\n }\n\n const git = gitP(repoWorkingDir);\n const pulled: PullResult | GitError = await git.pull().catch(catchTask);\n const pushed: string | GitError = await git.pushTags().catch(catchTask);\n ```\n */\nexport class GitError extends Error {\n constructor(\n public task?: SimpleGitTask,\n message?: string\n ) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n", "import { GitError } from './git-error';\n\n/**\n * The `GitResponseError` is the wrapper for a parsed response that is treated as\n * a fatal error, for example attempting a `merge` can leave the repo in a corrupted\n * state when there are conflicts so the task will reject rather than resolve.\n *\n * For example, catching the merge conflict exception:\n *\n * ```typescript\n import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';\n\n const git = gitP(repoRoot);\n const mergeOptions: string[] = ['--no-ff', 'other-branch'];\n const mergeSummary: MergeSummary = await git.merge(mergeOptions)\n .catch((e: GitResponseError) => e.git);\n\n if (mergeSummary.failed) {\n // deal with the error\n }\n ```\n */\nexport class GitResponseError extends GitError {\n constructor(\n /**\n * `.git` access the parsed response that is treated as being an error\n */\n public readonly git: T,\n message?: string\n ) {\n super(undefined, message || String(git));\n }\n}\n", "const cache = new WeakMap();\n\nexport function pathspec(...paths: string[]) {\n const key = new String(paths);\n cache.set(key, paths);\n\n return key as string;\n}\n\nexport function isPathSpec(path: string | unknown): path is string {\n return path instanceof String && cache.has(path);\n}\n\nexport function toPaths(pathSpec: string): string[] {\n return cache.get(pathSpec) || [];\n}\n", "import { GitError } from './git-error';\nimport { SimpleGitOptions } from '../types';\n\n/**\n * The `GitConstructError` is thrown when an error occurs in the constructor\n * of the `simple-git` instance itself. Most commonly as a result of using\n * a `baseDir` option that points to a folder that either does not exist,\n * or cannot be read by the user the node script is running as.\n *\n * Check the `.message` property for more detail including the properties\n * passed to the constructor.\n */\nexport class GitConstructError extends GitError {\n constructor(\n public readonly config: SimpleGitOptions,\n message: string\n ) {\n super(undefined, message);\n }\n}\n", "import { SimpleGitOptions, SimpleGitTask } from '../types';\nimport { GitError } from './git-error';\n\nexport class GitPluginError extends GitError {\n constructor(\n public task?: SimpleGitTask,\n public readonly plugin?: keyof SimpleGitOptions,\n message?: string\n ) {\n super(task, message);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n", "import { GitError } from './git-error';\n\n/**\n * The `TaskConfigurationError` is thrown when a command was incorrectly\n * configured. An error of this kind means that no attempt was made to\n * run your command through the underlying `git` binary.\n *\n * Check the `.message` property for more detail on why your configuration\n * resulted in an error.\n */\nexport class TaskConfigurationError extends GitError {\n constructor(message?: string) {\n super(undefined, message);\n }\n}\n", "import { exists, FOLDER } from '@kwsites/file-exists';\nimport { Maybe } from '../types';\n\nexport const NULL = '\\0';\n\nexport const NOOP: (...args: any[]) => void = () => {};\n\n/**\n * Returns either the source argument when it is a `Function`, or the default\n * `NOOP` function constant\n */\nexport function asFunction any>(source: T | any): T {\n return typeof source === 'function' ? source : NOOP;\n}\n\n/**\n * Determines whether the supplied argument is both a function, and is not\n * the `NOOP` function.\n */\nexport function isUserFunction(source: T | any): source is T {\n return typeof source === 'function' && source !== NOOP;\n}\n\nexport function splitOn(input: string, char: string): [string, string] {\n const index = input.indexOf(char);\n if (index <= 0) {\n return [input, ''];\n }\n\n return [input.substr(0, index), input.substr(index + 1)];\n}\n\nexport function first(input: T, offset?: number): Maybe;\nexport function first(input: T, offset?: number): Maybe;\nexport function first(input: any[] | IArguments, offset = 0): Maybe {\n return isArrayLike(input) && input.length > offset ? input[offset] : undefined;\n}\n\nexport function last(input: T, offset?: number): Maybe;\nexport function last(input: T, offset?: number): Maybe;\nexport function last(input: T, offset?: number): Maybe;\nexport function last(input: unknown, offset = 0) {\n if (isArrayLike(input) && input.length > offset) {\n return input[input.length - 1 - offset];\n }\n}\n\ntype ArrayLike = T[] | IArguments | { [index: number]: T; length: number };\n\nfunction isArrayLike(input: any): input is ArrayLike {\n return !!(input && typeof input.length === 'number');\n}\n\nexport function toLinesWithContent(input = '', trimmed = true, separator = '\\n'): string[] {\n return input.split(separator).reduce((output, line) => {\n const lineContent = trimmed ? line.trim() : line;\n if (lineContent) {\n output.push(lineContent);\n }\n return output;\n }, [] as string[]);\n}\n\ntype LineWithContentCallback = (line: string) => T;\n\nexport function forEachLineWithContent(\n input: string,\n callback: LineWithContentCallback\n): T[] {\n return toLinesWithContent(input, true).map((line) => callback(line));\n}\n\nexport function folderExists(path: string): boolean {\n return exists(path, FOLDER);\n}\n\n/**\n * Adds `item` into the `target` `Array` or `Set` when it is not already present and returns the `item`.\n */\nexport function append(target: T[] | Set, item: T): typeof item {\n if (Array.isArray(target)) {\n if (!target.includes(item)) {\n target.push(item);\n }\n } else {\n target.add(item);\n }\n return item;\n}\n\n/**\n * Adds `item` into the `target` `Array` when it is not already present and returns the `target`.\n */\nexport function including(target: T[], item: T): typeof target {\n if (Array.isArray(target) && !target.includes(item)) {\n target.push(item);\n }\n\n return target;\n}\n\nexport function remove(target: Set | T[], item: T): T {\n if (Array.isArray(target)) {\n const index = target.indexOf(item);\n if (index >= 0) {\n target.splice(index, 1);\n }\n } else {\n target.delete(item);\n }\n return item;\n}\n\nexport const objectToString = Object.prototype.toString.call.bind(Object.prototype.toString) as (\n input: any\n) => string;\n\nexport function asArray(source: T | T[]): T[] {\n return Array.isArray(source) ? source : [source];\n}\n\nexport function asStringArray(source: T | T[]): string[] {\n return asArray(source).map(String);\n}\n\nexport function asNumber(source: string | null | undefined, onNaN = 0) {\n if (source == null) {\n return onNaN;\n }\n\n const num = parseInt(source, 10);\n return isNaN(num) ? onNaN : num;\n}\n\nexport function prefixedArray(input: T[], prefix: T): T[] {\n const output: T[] = [];\n for (let i = 0, max = input.length; i < max; i++) {\n output.push(prefix, input[i]);\n }\n return output;\n}\n\nexport function bufferToString(input: Buffer | Buffer[]): string {\n return (Array.isArray(input) ? Buffer.concat(input) : input).toString('utf-8');\n}\n\n/**\n * Get a new object from a source object with only the listed properties.\n */\nexport function pick(source: Record, properties: string[]) {\n return Object.assign(\n {},\n ...properties.map((property) => (property in source ? { [property]: source[property] } : {}))\n );\n}\n\nexport function delay(duration = 0): Promise {\n return new Promise((done) => setTimeout(done, duration));\n}\n\nexport function orVoid(input: T | false) {\n if (input === false) {\n return undefined;\n }\n return input;\n}\n", "import { Maybe, Options, Primitives } from '../types';\nimport { objectToString } from './util';\nimport { isPathSpec } from '../args/pathspec';\n\nexport interface ArgumentFilterPredicate {\n (input: any): input is T;\n}\n\nexport function filterType(\n input: K,\n filter: ArgumentFilterPredicate\n): K extends T ? T : undefined;\nexport function filterType(input: K, filter: ArgumentFilterPredicate, def: T): T;\nexport function filterType(input: K, filter: ArgumentFilterPredicate, def?: T): Maybe {\n if (filter(input)) {\n return input;\n }\n return arguments.length > 2 ? def : undefined;\n}\n\nexport const filterArray: ArgumentFilterPredicate> = (input): input is Array => {\n return Array.isArray(input);\n};\n\nexport function filterPrimitives(\n input: unknown,\n omit?: Array<'boolean' | 'string' | 'number'>\n): input is Primitives {\n const type = isPathSpec(input) ? 'string' : typeof input;\n\n return (\n /number|string|boolean/.test(type) &&\n (!omit || !omit.includes(type as 'boolean' | 'string' | 'number'))\n );\n}\n\nexport const filterString: ArgumentFilterPredicate = (input): input is string => {\n return typeof input === 'string';\n};\n\nexport const filterStringArray: ArgumentFilterPredicate = (input): input is string[] => {\n return Array.isArray(input) && input.every(filterString);\n};\n\nexport const filterStringOrStringArray: ArgumentFilterPredicate = (\n input\n): input is string | string[] => {\n return filterString(input) || (Array.isArray(input) && input.every(filterString));\n};\n\nexport function filterPlainObject(input: T | unknown): input is T;\nexport function filterPlainObject(input: T | unknown): input is T {\n return !!input && objectToString(input) === '[object Object]';\n}\n\nexport function filterFunction(input: unknown): input is Function {\n return typeof input === 'function';\n}\n\nexport const filterHasLength: ArgumentFilterPredicate<{ length: number }> = (\n input\n): input is { length: number } => {\n if (input == null || 'number|boolean|function'.includes(typeof input)) {\n return false;\n }\n return Array.isArray(input) || typeof input === 'string' || typeof input.length === 'number';\n};\n", "/**\n * Known process exit codes used by the task parsers to determine whether an error\n * was one they can automatically handle\n */\nexport enum ExitCodes {\n SUCCESS,\n ERROR,\n NOT_FOUND = -2,\n UNCLEAN = 128,\n}\n", "import { TaskResponseFormat } from '../types';\n\nexport class GitOutputStreams {\n constructor(\n public readonly stdOut: T,\n public readonly stdErr: T\n ) {}\n\n asStrings(): GitOutputStreams {\n return new GitOutputStreams(this.stdOut.toString('utf8'), this.stdErr.toString('utf8'));\n }\n}\n", "export class LineParser {\n protected matches: string[] = [];\n\n private _regExp: RegExp[];\n\n constructor(\n regExp: RegExp | RegExp[],\n useMatches?: (target: T, match: string[]) => boolean | void\n ) {\n this._regExp = Array.isArray(regExp) ? regExp : [regExp];\n if (useMatches) {\n this.useMatches = useMatches;\n }\n }\n\n parse = (line: (offset: number) => string | undefined, target: T): boolean => {\n this.resetMatches();\n\n if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {\n return false;\n }\n\n return this.useMatches(target, this.prepareMatches()) !== false;\n };\n\n // @ts-ignore\n protected useMatches(target: T, match: string[]): boolean | void {\n throw new Error(`LineParser:useMatches not implemented`);\n }\n\n protected resetMatches() {\n this.matches.length = 0;\n }\n\n protected prepareMatches() {\n return this.matches;\n }\n\n protected addMatch(reg: RegExp, index: number, line?: string) {\n const matched = line && reg.exec(line);\n if (matched) {\n this.pushMatch(index, matched);\n }\n\n return !!matched;\n }\n\n protected pushMatch(_index: number, matched: string[]) {\n this.matches.push(...matched.slice(1));\n }\n}\n\nexport class RemoteLineParser extends LineParser {\n protected addMatch(reg: RegExp, index: number, line?: string): boolean {\n return /^remote:\\s/.test(String(line)) && super.addMatch(reg, index, line);\n }\n\n protected pushMatch(index: number, matched: string[]) {\n if (index > 0 || matched.length > 1) {\n super.pushMatch(index, matched);\n }\n }\n}\n", "import { SimpleGitOptions } from '../types';\n\nconst defaultOptions: Omit = {\n binary: 'git',\n maxConcurrentProcesses: 5,\n config: [],\n trimmed: false,\n};\n\nexport function createInstanceConfig(\n ...options: Array | undefined>\n): SimpleGitOptions {\n const baseDir = process.cwd();\n const config: SimpleGitOptions = Object.assign(\n { baseDir, ...defaultOptions },\n ...options.filter((o) => typeof o === 'object' && o)\n );\n\n config.baseDir = config.baseDir || baseDir;\n config.trimmed = config.trimmed === true;\n\n return config;\n}\n", "import {\n filterArray,\n filterFunction,\n filterPlainObject,\n filterPrimitives,\n filterType,\n} from './argument-filters';\nimport { asFunction, isUserFunction, last } from './util';\nimport { Maybe, Options, OptionsValues } from '../types';\nimport { isPathSpec } from '../args/pathspec';\n\nexport function appendTaskOptions(\n options: Maybe,\n commands: string[] = []\n): string[] {\n if (!filterPlainObject(options)) {\n return commands;\n }\n\n return Object.keys(options).reduce((commands: string[], key: string) => {\n const value: OptionsValues = options[key];\n\n if (isPathSpec(value)) {\n commands.push(value);\n } else if (filterPrimitives(value, ['boolean'])) {\n commands.push(key + '=' + value);\n } else {\n commands.push(key);\n }\n\n return commands;\n }, commands);\n}\n\nexport function getTrailingOptions(\n args: IArguments,\n initialPrimitive = 0,\n objectOnly = false\n): string[] {\n const command: string[] = [];\n\n for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {\n if ('string|number'.includes(typeof args[i])) {\n command.push(String(args[i]));\n }\n }\n\n appendTaskOptions(trailingOptionsArgument(args), command);\n if (!objectOnly) {\n command.push(...trailingArrayArgument(args));\n }\n\n return command;\n}\n\nfunction trailingArrayArgument(args: IArguments) {\n const hasTrailingCallback = typeof last(args) === 'function';\n return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []);\n}\n\n/**\n * Given any number of arguments, returns the trailing options argument, ignoring a trailing function argument\n * if there is one. When not found, the return value is null.\n */\nexport function trailingOptionsArgument(args: IArguments): Maybe {\n const hasTrailingCallback = filterFunction(last(args));\n return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);\n}\n\n/**\n * Returns either the source argument when it is a `Function`, or the default\n * `NOOP` function constant\n */\nexport function trailingFunctionArgument(\n args: unknown[] | IArguments | unknown,\n includeNoop = true\n): Maybe<(...args: any[]) => unknown> {\n const callback = asFunction(last(args));\n return includeNoop || isUserFunction(callback) ? callback : undefined;\n}\n", "import type { MaybeArray, TaskParser, TaskResponseFormat } from '../types';\nimport { GitOutputStreams } from './git-output-streams';\nimport { LineParser } from './line-parser';\nimport { asArray, toLinesWithContent } from './util';\n\nexport function callTaskParser(\n parser: TaskParser,\n streams: GitOutputStreams\n) {\n return parser(streams.stdOut, streams.stdErr);\n}\n\nexport function parseStringResponse(\n result: T,\n parsers: LineParser[],\n texts: MaybeArray,\n trim = true\n): T {\n asArray(texts).forEach((text) => {\n for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {\n const line = (offset = 0) => {\n if (i + offset >= max) {\n return;\n }\n return lines[i + offset];\n };\n\n parsers.some(({ parse }) => parse(line, result));\n }\n });\n\n return result;\n}\n", "export * from './argument-filters';\nexport * from './exit-codes';\nexport * from './git-output-streams';\nexport * from './line-parser';\nexport * from './simple-git-options';\nexport * from './task-options';\nexport * from './task-parser';\nexport * from './util';\n", "import { ExitCodes } from '../utils';\nimport { Maybe, StringTask } from '../types';\n\nexport enum CheckRepoActions {\n BARE = 'bare',\n IN_TREE = 'tree',\n IS_REPO_ROOT = 'root',\n}\n\nconst onError: StringTask['onError'] = ({ exitCode }, error, done, fail) => {\n if (exitCode === ExitCodes.UNCLEAN && isNotRepoMessage(error)) {\n return done(Buffer.from('false'));\n }\n\n fail(error);\n};\n\nconst parser: StringTask['parser'] = (text) => {\n return text.trim() === 'true';\n};\n\nexport function checkIsRepoTask(action: Maybe): StringTask {\n switch (action) {\n case CheckRepoActions.BARE:\n return checkIsBareRepoTask();\n case CheckRepoActions.IS_REPO_ROOT:\n return checkIsRepoRootTask();\n }\n\n const commands = ['rev-parse', '--is-inside-work-tree'];\n\n return {\n commands,\n format: 'utf-8',\n onError,\n parser,\n };\n}\n\nexport function checkIsRepoRootTask(): StringTask {\n const commands = ['rev-parse', '--git-dir'];\n\n return {\n commands,\n format: 'utf-8',\n onError,\n parser(path) {\n return /^\\.(git)?$/.test(path.trim());\n },\n };\n}\n\nexport function checkIsBareRepoTask(): StringTask {\n const commands = ['rev-parse', '--is-bare-repository'];\n\n return {\n commands,\n format: 'utf-8',\n onError,\n parser,\n };\n}\n\nfunction isNotRepoMessage(error: Error): boolean {\n return /(Not a git repository|Kein Git-Repository)/i.test(String(error));\n}\n", "import { CleanSummary } from '../../../typings';\nimport { toLinesWithContent } from '../utils';\n\nexport class CleanResponse implements CleanSummary {\n public paths: string[] = [];\n public files: string[] = [];\n public folders: string[] = [];\n\n constructor(public readonly dryRun: boolean) {}\n}\n\nconst removalRegexp = /^[a-z]+\\s*/i;\nconst dryRunRemovalRegexp = /^[a-z]+\\s+[a-z]+\\s*/i;\nconst isFolderRegexp = /\\/$/;\n\nexport function cleanSummaryParser(dryRun: boolean, text: string): CleanSummary {\n const summary = new CleanResponse(dryRun);\n const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;\n\n toLinesWithContent(text).forEach((line) => {\n const removed = line.replace(regexp, '');\n\n summary.paths.push(removed);\n (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);\n });\n\n return summary;\n}\n", "import { TaskConfigurationError } from '../errors/task-configuration-error';\nimport type { BufferTask, EmptyTaskParser, SimpleGitTask, StringTask } from '../types';\n\nexport const EMPTY_COMMANDS: [] = [];\n\nexport type EmptyTask = {\n commands: typeof EMPTY_COMMANDS;\n format: 'empty';\n parser: EmptyTaskParser;\n onError?: undefined;\n};\n\nexport function adhocExecTask(parser: EmptyTaskParser): EmptyTask {\n return {\n commands: EMPTY_COMMANDS,\n format: 'empty',\n parser,\n };\n}\n\nexport function configurationErrorTask(error: Error | string): EmptyTask {\n return {\n commands: EMPTY_COMMANDS,\n format: 'empty',\n parser() {\n throw typeof error === 'string' ? new TaskConfigurationError(error) : error;\n },\n };\n}\n\nexport function straightThroughStringTask(commands: string[], trimmed = false): StringTask {\n return {\n commands,\n format: 'utf-8',\n parser(text) {\n return trimmed ? String(text).trim() : text;\n },\n };\n}\n\nexport function straightThroughBufferTask(commands: string[]): BufferTask {\n return {\n commands,\n format: 'buffer',\n parser(buffer) {\n return buffer;\n },\n };\n}\n\nexport function isBufferTask(task: SimpleGitTask): task is BufferTask {\n return task.format === 'buffer';\n}\n\nexport function isEmptyTask(task: SimpleGitTask): task is EmptyTask {\n return task.format === 'empty' || !task.commands.length;\n}\n", "import { CleanSummary } from '../../../typings';\nimport { cleanSummaryParser } from '../responses/CleanSummary';\nimport { Maybe, StringTask } from '../types';\nimport { asStringArray } from '../utils';\nimport { configurationErrorTask } from './task';\n\nexport const CONFIG_ERROR_INTERACTIVE_MODE = 'Git clean interactive mode is not supported';\nexport const CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter (\"n\" or \"f\") is required';\nexport const CONFIG_ERROR_UNKNOWN_OPTION = 'Git clean unknown option found in: ';\n\n/**\n * All supported option switches available for use in a `git.clean` operation\n */\nexport enum CleanOptions {\n DRY_RUN = 'n',\n FORCE = 'f',\n IGNORED_INCLUDED = 'x',\n IGNORED_ONLY = 'X',\n EXCLUDING = 'e',\n QUIET = 'q',\n RECURSIVE = 'd',\n}\n\n/**\n * The two modes `git.clean` can run in - one of these must be supplied in order\n * for the command to not throw a `TaskConfigurationError`\n */\nexport type CleanMode = CleanOptions.FORCE | CleanOptions.DRY_RUN;\n\nconst CleanOptionValues: Set = new Set([\n 'i',\n ...asStringArray(Object.values(CleanOptions as any)),\n]);\n\nexport function cleanWithOptionsTask(mode: CleanMode | string, customArgs: string[]) {\n const { cleanMode, options, valid } = getCleanOptions(mode);\n\n if (!cleanMode) {\n return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);\n }\n\n if (!valid.options) {\n return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));\n }\n\n options.push(...customArgs);\n\n if (options.some(isInteractiveMode)) {\n return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);\n }\n\n return cleanTask(cleanMode, options);\n}\n\nexport function cleanTask(mode: CleanMode, customArgs: string[]): StringTask {\n const commands: string[] = ['clean', `-${mode}`, ...customArgs];\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string): CleanSummary {\n return cleanSummaryParser(mode === CleanOptions.DRY_RUN, text);\n },\n };\n}\n\nexport function isCleanOptionsArray(input: string[]): input is CleanOptions[] {\n return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));\n}\n\nfunction getCleanOptions(input: string) {\n let cleanMode: Maybe;\n let options: string[] = [];\n let valid = { cleanMode: false, options: true };\n\n input\n .replace(/[^a-z]i/g, '')\n .split('')\n .forEach((char) => {\n if (isCleanMode(char)) {\n cleanMode = char;\n valid.cleanMode = true;\n } else {\n valid.options = valid.options && isKnownOption((options[options.length] = `-${char}`));\n }\n });\n\n return {\n cleanMode,\n options,\n valid,\n };\n}\n\nfunction isCleanMode(cleanMode?: string): cleanMode is CleanMode {\n return cleanMode === CleanOptions.FORCE || cleanMode === CleanOptions.DRY_RUN;\n}\n\nfunction isKnownOption(option: string): boolean {\n return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));\n}\n\nfunction isInteractiveMode(option: string): boolean {\n if (/^-[^\\-]/.test(option)) {\n return option.indexOf('i') > 0;\n }\n\n return option === '--interactive';\n}\n", "import { ConfigGetResult, ConfigListSummary, ConfigValues } from '../../../typings';\nimport { last, splitOn } from '../utils';\n\nexport class ConfigList implements ConfigListSummary {\n public files: string[] = [];\n public values: { [fileName: string]: ConfigValues } = Object.create(null);\n\n private _all: ConfigValues | undefined;\n\n public get all(): ConfigValues {\n if (!this._all) {\n this._all = this.files.reduce((all: ConfigValues, file: string) => {\n return Object.assign(all, this.values[file]);\n }, {});\n }\n\n return this._all;\n }\n\n public addFile(file: string): ConfigValues {\n if (!(file in this.values)) {\n const latest = last(this.files);\n this.values[file] = latest ? Object.create(this.values[latest]) : {};\n\n this.files.push(file);\n }\n\n return this.values[file];\n }\n\n public addValue(file: string, key: string, value: string) {\n const values = this.addFile(file);\n\n if (!values.hasOwnProperty(key)) {\n values[key] = value;\n } else if (Array.isArray(values[key])) {\n (values[key] as string[]).push(value);\n } else {\n values[key] = [values[key] as string, value];\n }\n\n this._all = undefined;\n }\n}\n\nexport function configListParser(text: string): ConfigList {\n const config = new ConfigList();\n\n for (const item of configParser(text)) {\n config.addValue(item.file, String(item.key), item.value);\n }\n\n return config;\n}\n\nexport function configGetParser(text: string, key: string): ConfigGetResult {\n let value: string | null = null;\n const values: string[] = [];\n const scopes: Map = new Map();\n\n for (const item of configParser(text, key)) {\n if (item.key !== key) {\n continue;\n }\n\n values.push((value = item.value));\n\n if (!scopes.has(item.file)) {\n scopes.set(item.file, []);\n }\n\n scopes.get(item.file)!.push(value);\n }\n\n return {\n key,\n paths: Array.from(scopes.keys()),\n scopes,\n value,\n values,\n };\n}\n\nfunction configFilePath(filePath: string): string {\n return filePath.replace(/^(file):/, '');\n}\n\nfunction* configParser(text: string, requestedKey: string | null = null) {\n const lines = text.split('\\0');\n\n for (let i = 0, max = lines.length - 1; i < max; ) {\n const file = configFilePath(lines[i++]);\n\n let value = lines[i++];\n let key = requestedKey;\n\n if (value.includes('\\n')) {\n const line = splitOn(value, '\\n');\n key = line[0];\n value = line[1];\n }\n\n yield { file, key, value };\n }\n}\n", "import type { ConfigGetResult, ConfigListSummary, SimpleGit } from '../../../typings';\nimport { configGetParser, configListParser } from '../responses/ConfigList';\nimport type { SimpleGitApi } from '../simple-git-api';\nimport type { StringTask } from '../types';\nimport { trailingFunctionArgument } from '../utils';\n\nexport enum GitConfigScope {\n system = 'system',\n global = 'global',\n local = 'local',\n worktree = 'worktree',\n}\n\nfunction asConfigScope(\n scope: GitConfigScope | unknown,\n fallback: T\n): GitConfigScope | T {\n if (typeof scope === 'string' && GitConfigScope.hasOwnProperty(scope)) {\n return scope as GitConfigScope;\n }\n return fallback;\n}\n\nfunction addConfigTask(\n key: string,\n value: string,\n append: boolean,\n scope: GitConfigScope\n): StringTask {\n const commands: string[] = ['config', `--${scope}`];\n\n if (append) {\n commands.push('--add');\n }\n\n commands.push(key, value);\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string): string {\n return text;\n },\n };\n}\n\nfunction getConfigTask(key: string, scope?: GitConfigScope): StringTask {\n const commands: string[] = ['config', '--null', '--show-origin', '--get-all', key];\n\n if (scope) {\n commands.splice(1, 0, `--${scope}`);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(text) {\n return configGetParser(text, key);\n },\n };\n}\n\nfunction listConfigTask(scope?: GitConfigScope): StringTask {\n const commands = ['config', '--list', '--show-origin', '--null'];\n\n if (scope) {\n commands.push(`--${scope}`);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string) {\n return configListParser(text);\n },\n };\n}\n\nexport default function (): Pick {\n return {\n addConfig(this: SimpleGitApi, key: string, value: string, ...rest: unknown[]) {\n return this._runTask(\n addConfigTask(\n key,\n value,\n rest[0] === true,\n asConfigScope(rest[1], GitConfigScope.local)\n ),\n trailingFunctionArgument(arguments)\n );\n },\n\n getConfig(this: SimpleGitApi, key: string, scope?: GitConfigScope) {\n return this._runTask(\n getConfigTask(key, asConfigScope(scope, undefined)),\n trailingFunctionArgument(arguments)\n );\n },\n\n listConfig(this: SimpleGitApi, ...rest: unknown[]) {\n return this._runTask(\n listConfigTask(asConfigScope(rest[0], undefined)),\n trailingFunctionArgument(arguments)\n );\n },\n };\n}\n", "export enum DiffNameStatus {\n ADDED = 'A',\n COPIED = 'C',\n DELETED = 'D',\n MODIFIED = 'M',\n RENAMED = 'R',\n CHANGED = 'T',\n UNMERGED = 'U',\n UNKNOWN = 'X',\n BROKEN = 'B',\n}\n\nconst diffNameStatus = new Set(Object.values(DiffNameStatus));\n\nexport function isDiffNameStatus(input: string): input is DiffNameStatus {\n return diffNameStatus.has(input as DiffNameStatus);\n}\n", "import { GrepResult, SimpleGit } from '../../../typings';\nimport { SimpleGitApi } from '../simple-git-api';\nimport {\n asNumber,\n forEachLineWithContent,\n getTrailingOptions,\n NULL,\n prefixedArray,\n trailingFunctionArgument,\n} from '../utils';\n\nimport { configurationErrorTask } from './task';\n\nconst disallowedOptions = ['-h'];\n\nconst Query = Symbol('grepQuery');\n\nexport interface GitGrepQuery extends Iterable {\n /** Adds one or more terms to be grouped as an \"and\" to any other terms */\n and(...and: string[]): this;\n\n /** Adds one or more search terms - git.grep will \"or\" this to other terms */\n param(...param: string[]): this;\n}\n\nclass GrepQuery implements GitGrepQuery {\n private [Query]: string[] = [];\n\n *[Symbol.iterator]() {\n for (const query of this[Query]) {\n yield query;\n }\n }\n\n and(...and: string[]) {\n and.length && this[Query].push('--and', '(', ...prefixedArray(and, '-e'), ')');\n return this;\n }\n\n param(...param: string[]) {\n this[Query].push(...prefixedArray(param, '-e'));\n return this;\n }\n}\n\n/**\n * Creates a new builder for a `git.grep` query with optional params\n */\nexport function grepQueryBuilder(...params: string[]): GitGrepQuery {\n return new GrepQuery().param(...params);\n}\n\nfunction parseGrep(grep: string): GrepResult {\n const paths: GrepResult['paths'] = new Set();\n const results: GrepResult['results'] = {};\n\n forEachLineWithContent(grep, (input) => {\n const [path, line, preview] = input.split(NULL);\n paths.add(path);\n (results[path] = results[path] || []).push({\n line: asNumber(line),\n path,\n preview,\n });\n });\n\n return {\n paths,\n results,\n };\n}\n\nexport default function (): Pick {\n return {\n grep(this: SimpleGitApi, searchTerm: string | GitGrepQuery) {\n const then = trailingFunctionArgument(arguments);\n const options = getTrailingOptions(arguments);\n\n for (const option of disallowedOptions) {\n if (options.includes(option)) {\n return this._runTask(\n configurationErrorTask(`git.grep: use of \"${option}\" is not supported.`),\n then\n );\n }\n }\n\n if (typeof searchTerm === 'string') {\n searchTerm = grepQueryBuilder().param(searchTerm);\n }\n\n const commands = ['grep', '--null', '-n', '--full-name', ...options, ...searchTerm];\n\n return this._runTask(\n {\n commands,\n format: 'utf-8',\n parser(stdOut) {\n return parseGrep(stdOut);\n },\n },\n then\n );\n },\n };\n}\n", "import { straightThroughStringTask } from './task';\nimport { Maybe, OptionFlags, Options } from '../types';\n\nexport enum ResetMode {\n MIXED = 'mixed',\n SOFT = 'soft',\n HARD = 'hard',\n MERGE = 'merge',\n KEEP = 'keep',\n}\n\nconst ResetModes = Array.from(Object.values(ResetMode));\n\nexport type ResetOptions = Options &\n OptionFlags<'-q' | '--quiet' | '--no-quiet' | '--pathspec-from-nul'> &\n OptionFlags<'--pathspec-from-file', string>;\n\nexport function resetTask(mode: Maybe, customArgs: string[]) {\n const commands: string[] = ['reset'];\n if (isValidResetMode(mode)) {\n commands.push(`--${mode}`);\n }\n commands.push(...customArgs);\n\n return straightThroughStringTask(commands);\n}\n\nexport function getResetMode(mode: ResetMode | any): Maybe {\n if (isValidResetMode(mode)) {\n return mode;\n }\n\n switch (typeof mode) {\n case 'string':\n case 'undefined':\n return ResetMode.SOFT;\n }\n\n return;\n}\n\nfunction isValidResetMode(mode: ResetMode | any): mode is ResetMode {\n return ResetModes.includes(mode);\n}\n", "import { pathspec } from './args/pathspec';\nimport { GitConstructError } from './errors/git-construct-error';\nimport { GitError } from './errors/git-error';\nimport { GitPluginError } from './errors/git-plugin-error';\nimport { GitResponseError } from './errors/git-response-error';\nimport { TaskConfigurationError } from './errors/task-configuration-error';\nimport { CheckRepoActions } from './tasks/check-is-repo';\nimport { CleanOptions } from './tasks/clean';\nimport { GitConfigScope } from './tasks/config';\nimport { DiffNameStatus } from './tasks/diff-name-status';\nimport { grepQueryBuilder } from './tasks/grep';\nimport { ResetMode } from './tasks/reset';\n\nexport {\n CheckRepoActions,\n CleanOptions,\n DiffNameStatus,\n GitConfigScope,\n GitConstructError,\n GitError,\n GitPluginError,\n GitResponseError,\n ResetMode,\n TaskConfigurationError,\n grepQueryBuilder,\n pathspec,\n};\n", "import { SimpleGitOptions } from '../types';\nimport { SimpleGitPlugin } from './simple-git-plugin';\nimport { GitPluginError } from '../errors/git-plugin-error';\n\nexport function abortPlugin(signal: SimpleGitOptions['abort']) {\n if (!signal) {\n return;\n }\n\n const onSpawnAfter: SimpleGitPlugin<'spawn.after'> = {\n type: 'spawn.after',\n action(_data, context) {\n function kill() {\n context.kill(new GitPluginError(undefined, 'abort', 'Abort signal received'));\n }\n\n signal.addEventListener('abort', kill);\n\n context.spawned.on('close', () => signal.removeEventListener('abort', kill));\n },\n };\n\n const onSpawnBefore: SimpleGitPlugin<'spawn.before'> = {\n type: 'spawn.before',\n action(_data, context) {\n if (signal.aborted) {\n context.kill(new GitPluginError(undefined, 'abort', 'Abort already signaled'));\n }\n },\n };\n\n return [onSpawnBefore, onSpawnAfter];\n}\n", "import type { SimpleGitPlugin } from './simple-git-plugin';\n\nimport { GitPluginError } from '../errors/git-plugin-error';\nimport type { SimpleGitPluginConfig } from '../types';\n\nfunction isConfigSwitch(arg: string | unknown) {\n return typeof arg === 'string' && arg.trim().toLowerCase() === '-c';\n}\n\nfunction preventProtocolOverride(arg: string, next: string) {\n if (!isConfigSwitch(arg)) {\n return;\n }\n\n if (!/^\\s*protocol(.[a-z]+)?.allow/.test(next)) {\n return;\n }\n\n throw new GitPluginError(\n undefined,\n 'unsafe',\n 'Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol'\n );\n}\n\nfunction preventUploadPack(arg: string, method: string) {\n if (/^\\s*--(upload|receive)-pack/.test(arg)) {\n throw new GitPluginError(\n undefined,\n 'unsafe',\n `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`\n );\n }\n\n if (method === 'clone' && /^\\s*-u\\b/.test(arg)) {\n throw new GitPluginError(\n undefined,\n 'unsafe',\n `Use of clone with option -u is not permitted without enabling allowUnsafePack`\n );\n }\n\n if (method === 'push' && /^\\s*--exec\\b/.test(arg)) {\n throw new GitPluginError(\n undefined,\n 'unsafe',\n `Use of push with option --exec is not permitted without enabling allowUnsafePack`\n );\n }\n}\n\nexport function blockUnsafeOperationsPlugin({\n allowUnsafeProtocolOverride = false,\n allowUnsafePack = false,\n}: SimpleGitPluginConfig['unsafe'] = {}): SimpleGitPlugin<'spawn.args'> {\n return {\n type: 'spawn.args',\n action(args, context) {\n args.forEach((current, index) => {\n const next = index < args.length ? args[index + 1] : '';\n\n allowUnsafeProtocolOverride || preventProtocolOverride(current, next);\n allowUnsafePack || preventUploadPack(current, context.method);\n });\n\n return args;\n },\n };\n}\n", "import { prefixedArray } from '../utils';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nexport function commandConfigPrefixingPlugin(\n configuration: string[]\n): SimpleGitPlugin<'spawn.args'> {\n const prefix = prefixedArray(configuration, '-c');\n\n return {\n type: 'spawn.args',\n action(data) {\n return [...prefix, ...data];\n },\n };\n}\n", "import { deferred, DeferredPromise } from '@kwsites/promise-deferred';\nimport { SimpleGitPluginConfig } from '../types';\nimport { delay } from '../utils';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nconst never = deferred().promise;\n\nexport function completionDetectionPlugin({\n onClose = true,\n onExit = 50,\n}: SimpleGitPluginConfig['completion'] = {}): SimpleGitPlugin<'spawn.after'> {\n function createEvents() {\n let exitCode = -1;\n const events = {\n close: deferred(),\n closeTimeout: deferred(),\n exit: deferred(),\n exitTimeout: deferred(),\n };\n\n const result = Promise.race([\n onClose === false ? never : events.closeTimeout.promise,\n onExit === false ? never : events.exitTimeout.promise,\n ]);\n\n configureTimeout(onClose, events.close, events.closeTimeout);\n configureTimeout(onExit, events.exit, events.exitTimeout);\n\n return {\n close(code: number) {\n exitCode = code;\n events.close.done();\n },\n exit(code: number) {\n exitCode = code;\n events.exit.done();\n },\n get exitCode() {\n return exitCode;\n },\n result,\n };\n }\n\n function configureTimeout(\n flag: boolean | number,\n event: DeferredPromise,\n timeout: DeferredPromise\n ) {\n if (flag === false) {\n return;\n }\n\n (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);\n }\n\n return {\n type: 'spawn.after',\n async action(_data, { spawned, close }) {\n const events = createEvents();\n\n let deferClose = true;\n let quickClose = () => void (deferClose = false);\n\n spawned.stdout?.on('data', quickClose);\n spawned.stderr?.on('data', quickClose);\n spawned.on('error', quickClose);\n\n spawned.on('close', (code: number) => events.close(code));\n spawned.on('exit', (code: number) => events.exit(code));\n\n try {\n await events.result;\n if (deferClose) {\n await delay(50);\n }\n close(events.exitCode);\n } catch (err) {\n close(events.exitCode, err as Error);\n }\n },\n };\n}\n", "import type { SimpleGitOptions } from '../types';\n\nimport { GitPluginError } from '../errors/git-plugin-error';\nimport { asArray } from '../utils';\nimport { PluginStore } from './plugin-store';\n\nconst WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;\nconst WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;\n\nfunction isBadArgument(arg: string) {\n return !arg || !/^([a-z]:)?([a-z0-9/.\\\\_-]+)$/i.test(arg);\n}\n\nfunction toBinaryConfig(\n input: string[],\n allowUnsafe: boolean\n): { binary: string; prefix?: string } {\n if (input.length < 1 || input.length > 2) {\n throw new GitPluginError(undefined, 'binary', WRONG_NUMBER_ERR);\n }\n\n const isBad = input.some(isBadArgument);\n if (isBad) {\n if (allowUnsafe) {\n console.warn(WRONG_CHARS_ERR);\n } else {\n throw new GitPluginError(undefined, 'binary', WRONG_CHARS_ERR);\n }\n }\n\n const [binary, prefix] = input;\n return {\n binary,\n prefix,\n };\n}\n\nexport function customBinaryPlugin(\n plugins: PluginStore,\n input: SimpleGitOptions['binary'] = ['git'],\n allowUnsafe = false\n) {\n let config = toBinaryConfig(asArray(input), allowUnsafe);\n\n plugins.on('binary', (input) => {\n config = toBinaryConfig(asArray(input), allowUnsafe);\n });\n\n plugins.append('spawn.binary', () => {\n return config.binary;\n });\n\n plugins.append('spawn.args', (data) => {\n return config.prefix ? [config.prefix, ...data] : data;\n });\n}\n", "import { GitError } from '../errors/git-error';\nimport { GitExecutorResult, SimpleGitPluginConfig } from '../types';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\ntype TaskResult = Omit;\n\nfunction isTaskError(result: TaskResult) {\n return !!(result.exitCode && result.stdErr.length);\n}\n\nfunction getErrorMessage(result: TaskResult) {\n return Buffer.concat([...result.stdOut, ...result.stdErr]);\n}\n\nexport function errorDetectionHandler(\n overwrite = false,\n isError = isTaskError,\n errorMessage: (result: TaskResult) => Buffer | Error = getErrorMessage\n) {\n return (error: Buffer | Error | undefined, result: TaskResult) => {\n if ((!overwrite && error) || !isError(result)) {\n return error;\n }\n\n return errorMessage(result);\n };\n}\n\nexport function errorDetectionPlugin(\n config: SimpleGitPluginConfig['errors']\n): SimpleGitPlugin<'task.error'> {\n return {\n type: 'task.error',\n action(data, context) {\n const error = config(data.error, {\n stdErr: context.stdErr,\n stdOut: context.stdOut,\n exitCode: context.exitCode,\n });\n\n if (Buffer.isBuffer(error)) {\n return { error: new GitError(undefined, error.toString('utf-8')) };\n }\n\n return {\n error,\n };\n },\n };\n}\n", "import { EventEmitter } from 'node:events';\n\nimport type {\n SimpleGitPlugin,\n SimpleGitPluginType,\n SimpleGitPluginTypes,\n} from './simple-git-plugin';\nimport { append, asArray } from '../utils';\nimport type { SimpleGitPluginConfig } from '../types';\n\nexport class PluginStore {\n private plugins: Set> = new Set();\n private events = new EventEmitter();\n\n on(\n type: K,\n listener: (data: SimpleGitPluginConfig[K]) => void\n ) {\n this.events.on(type, listener);\n }\n\n reconfigure(type: K, data: SimpleGitPluginConfig[K]) {\n this.events.emit(type, data);\n }\n\n public append(type: T, action: SimpleGitPlugin['action']) {\n const plugin = append(this.plugins, { type, action });\n\n return () => this.plugins.delete(plugin);\n }\n\n public add(\n plugin: void | SimpleGitPlugin | SimpleGitPlugin[]\n ) {\n const plugins: SimpleGitPlugin[] = [];\n\n asArray(plugin).forEach((plugin) => plugin && this.plugins.add(append(plugins, plugin)));\n\n return () => {\n plugins.forEach((plugin) => this.plugins.delete(plugin));\n };\n }\n\n public exec(\n type: T,\n data: SimpleGitPluginTypes[T]['data'],\n context: SimpleGitPluginTypes[T]['context']\n ): typeof data {\n let output = data;\n const contextual = Object.freeze(Object.create(context));\n\n for (const plugin of this.plugins) {\n if (plugin.type === type) {\n output = plugin.action(output, contextual);\n }\n }\n\n return output;\n }\n}\n", "import { SimpleGitOptions } from '../types';\nimport { asNumber, including } from '../utils';\n\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nexport function progressMonitorPlugin(progress: Exclude) {\n const progressCommand = '--progress';\n const progressMethods = ['checkout', 'clone', 'fetch', 'pull', 'push'];\n\n const onProgress: SimpleGitPlugin<'spawn.after'> = {\n type: 'spawn.after',\n action(_data, context) {\n if (!context.commands.includes(progressCommand)) {\n return;\n }\n\n context.spawned.stderr?.on('data', (chunk: Buffer) => {\n const message = /^([\\s\\S]+?):\\s*(\\d+)% \\((\\d+)\\/(\\d+)\\)/.exec(chunk.toString('utf8'));\n if (!message) {\n return;\n }\n\n progress({\n method: context.method,\n stage: progressEventStage(message[1]),\n progress: asNumber(message[2]),\n processed: asNumber(message[3]),\n total: asNumber(message[4]),\n });\n });\n },\n };\n\n const onArgs: SimpleGitPlugin<'spawn.args'> = {\n type: 'spawn.args',\n action(args, context) {\n if (!progressMethods.includes(context.method)) {\n return args;\n }\n\n return including(args, progressCommand);\n },\n };\n\n return [onArgs, onProgress];\n}\n\nfunction progressEventStage(input: string) {\n return String(input.toLowerCase().split(' ', 1)) || 'unknown';\n}\n", "import { ChildProcess, SpawnOptions } from 'child_process';\nimport { GitExecutorResult } from '../types';\n\ntype SimpleGitTaskPluginContext = {\n readonly method: string;\n readonly commands: string[];\n};\n\nexport interface SimpleGitPluginTypes {\n 'spawn.args': {\n data: string[];\n context: SimpleGitTaskPluginContext & {};\n };\n 'spawn.binary': {\n data: string;\n context: SimpleGitTaskPluginContext & {};\n };\n 'spawn.options': {\n data: Partial;\n context: SimpleGitTaskPluginContext & {};\n };\n 'spawn.before': {\n data: void;\n context: SimpleGitTaskPluginContext & {\n kill(reason: Error): void;\n };\n };\n 'spawn.after': {\n data: void;\n context: SimpleGitTaskPluginContext & {\n spawned: ChildProcess;\n close(exitCode: number, reason?: Error): void;\n kill(reason: Error): void;\n };\n };\n 'task.error': {\n data: { error?: Error };\n context: SimpleGitTaskPluginContext & GitExecutorResult;\n };\n}\n\nexport type SimpleGitPluginType = keyof SimpleGitPluginTypes;\n\nexport interface SimpleGitPlugin {\n action(\n data: SimpleGitPluginTypes[T]['data'],\n context: SimpleGitPluginTypes[T]['context']\n ): typeof data;\n\n type: T;\n}\n", "import { SpawnOptions } from 'child_process';\nimport { pick } from '../utils';\nimport { SimpleGitPlugin } from './simple-git-plugin';\n\nexport function spawnOptionsPlugin(\n spawnOptions: Partial\n): SimpleGitPlugin<'spawn.options'> {\n const options = pick(spawnOptions, ['uid', 'gid']);\n\n return {\n type: 'spawn.options',\n action(data) {\n return { ...options, ...data };\n },\n };\n}\n", "import type { SimpleGitPlugin } from './simple-git-plugin';\n\nimport type { SimpleGitOptions } from '../types';\nimport { GitPluginError } from '../errors/git-plugin-error';\n\nexport function timeoutPlugin({\n block,\n stdErr = true,\n stdOut = true,\n}: Exclude): SimpleGitPlugin<'spawn.after'> | void {\n if (block > 0) {\n return {\n type: 'spawn.after',\n action(_data, context) {\n let timeout: NodeJS.Timeout;\n\n function wait() {\n timeout && clearTimeout(timeout);\n timeout = setTimeout(kill, block);\n }\n\n function stop() {\n context.spawned.stdout?.off('data', wait);\n context.spawned.stderr?.off('data', wait);\n context.spawned.off('exit', stop);\n context.spawned.off('close', stop);\n timeout && clearTimeout(timeout);\n }\n\n function kill() {\n stop();\n context.kill(new GitPluginError(undefined, 'timeout', `block timeout reached`));\n }\n\n stdOut && context.spawned.stdout?.on('data', wait);\n stdErr && context.spawned.stderr?.on('data', wait);\n context.spawned.on('exit', stop);\n context.spawned.on('close', stop);\n\n wait();\n },\n };\n }\n}\n", "export * from './abort-plugin';\nexport * from './block-unsafe-operations-plugin';\nexport * from './command-config-prefixing-plugin';\nexport * from './completion-detection.plugin';\nexport * from './custom-binary.plugin';\nexport * from './error-detection.plugin';\nexport * from './plugin-store';\nexport * from './progress-monitor-plugin';\nexport * from './simple-git-plugin';\nexport * from './spawn-options-plugin';\nexport * from './timout-plugin';\n", "import { SimpleGitPlugin } from './simple-git-plugin';\nimport { isPathSpec, toPaths } from '../args/pathspec';\n\nexport function suffixPathsPlugin(): SimpleGitPlugin<'spawn.args'> {\n return {\n type: 'spawn.args',\n action(data) {\n const prefix: string[] = [];\n let suffix: undefined | string[];\n function append(args: string[]) {\n (suffix = suffix || []).push(...args);\n }\n\n for (let i = 0; i < data.length; i++) {\n const param = data[i];\n\n if (isPathSpec(param)) {\n append(toPaths(param));\n continue;\n }\n\n if (param === '--') {\n append(\n data.slice(i + 1).flatMap((item) => (isPathSpec(item) && toPaths(item)) || item)\n );\n break;\n }\n\n prefix.push(param);\n }\n\n return !suffix ? prefix : [...prefix, '--', ...suffix.map(String)];\n },\n };\n}\n", "import debug, { Debugger } from 'debug';\nimport {\n append,\n filterHasLength,\n filterString,\n filterType,\n NOOP,\n objectToString,\n remove,\n} from './utils';\nimport { Maybe } from './types';\n\ndebug.formatters.L = (value: any) => String(filterHasLength(value) ? value.length : '-');\ndebug.formatters.B = (value: Buffer) => {\n if (Buffer.isBuffer(value)) {\n return value.toString('utf8');\n }\n return objectToString(value);\n};\n\ntype OutputLoggingHandler = (message: string, ...args: any[]) => void;\n\nfunction createLog() {\n return debug('simple-git');\n}\n\nexport interface OutputLogger extends OutputLoggingHandler {\n readonly label: string;\n\n info: OutputLoggingHandler;\n step(nextStep?: string): OutputLogger;\n sibling(name: string): OutputLogger;\n}\n\nfunction prefixedLogger(\n to: Debugger,\n prefix: string,\n forward?: OutputLoggingHandler\n): OutputLoggingHandler {\n if (!prefix || !String(prefix).replace(/\\s*/, '')) {\n return !forward\n ? to\n : (message, ...args) => {\n to(message, ...args);\n forward(message, ...args);\n };\n }\n\n return (message, ...args) => {\n to(`%s ${message}`, prefix, ...args);\n if (forward) {\n forward(message, ...args);\n }\n };\n}\n\nfunction childLoggerName(\n name: Maybe,\n childDebugger: Maybe,\n { namespace: parentNamespace }: Debugger\n): string {\n if (typeof name === 'string') {\n return name;\n }\n const childNamespace = (childDebugger && childDebugger.namespace) || '';\n\n if (childNamespace.startsWith(parentNamespace)) {\n return childNamespace.substr(parentNamespace.length + 1);\n }\n\n return childNamespace || parentNamespace;\n}\n\nexport function createLogger(\n label: string,\n verbose?: string | Debugger,\n initialStep?: string,\n infoDebugger = createLog()\n): OutputLogger {\n const labelPrefix = (label && `[${label}]`) || '';\n\n const spawned: OutputLogger[] = [];\n const debugDebugger: Maybe =\n typeof verbose === 'string' ? infoDebugger.extend(verbose) : verbose;\n const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);\n\n return step(initialStep);\n\n function sibling(name: string, initial?: string) {\n return append(\n spawned,\n createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)\n );\n }\n\n function step(phase?: string) {\n const stepPrefix = (phase && `[${phase}]`) || '';\n const debug = (debugDebugger && prefixedLogger(debugDebugger, stepPrefix)) || NOOP;\n const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug);\n\n return Object.assign(debugDebugger ? debug : info, {\n label,\n sibling,\n info,\n step,\n });\n }\n}\n\n/**\n * The `GitLogger` is used by the main `SimpleGit` runner to handle logging\n * any warnings or errors.\n */\nexport class GitLogger {\n public error: OutputLoggingHandler;\n\n public warn: OutputLoggingHandler;\n\n constructor(private _out: Debugger = createLog()) {\n this.error = prefixedLogger(_out, '[ERROR]');\n this.warn = prefixedLogger(_out, '[WARN]');\n }\n\n silent(silence = false) {\n if (silence !== this._out.enabled) {\n return;\n }\n\n const { namespace } = this._out;\n const env = (process.env.DEBUG || '').split(',').filter((s) => !!s);\n const hasOn = env.includes(namespace);\n const hasOff = env.includes(`-${namespace}`);\n\n // enabling the log\n if (!silence) {\n if (hasOff) {\n remove(env, `-${namespace}`);\n } else {\n env.push(namespace);\n }\n } else {\n if (hasOn) {\n remove(env, namespace);\n } else {\n env.push(`-${namespace}`);\n }\n }\n\n debug.enable(env.join(','));\n }\n}\n", "import { SimpleGitTask } from '../types';\nimport { GitError } from '../errors/git-error';\nimport { createLogger, OutputLogger } from '../git-logger';\n\ntype AnySimpleGitTask = SimpleGitTask;\n\ntype TaskInProgress = {\n name: string;\n logger: OutputLogger;\n task: AnySimpleGitTask;\n};\n\nexport class TasksPendingQueue {\n private _queue: Map = new Map();\n\n constructor(private logLabel = 'GitExecutor') {}\n\n private withProgress(task: AnySimpleGitTask) {\n return this._queue.get(task);\n }\n\n private createProgress(task: AnySimpleGitTask): TaskInProgress {\n const name = TasksPendingQueue.getName(task.commands[0]);\n const logger = createLogger(this.logLabel, name);\n\n return {\n task,\n logger,\n name,\n };\n }\n\n push(task: AnySimpleGitTask): TaskInProgress {\n const progress = this.createProgress(task);\n progress.logger('Adding task to the queue, commands = %o', task.commands);\n\n this._queue.set(task, progress);\n\n return progress;\n }\n\n fatal(err: GitError) {\n for (const [task, { logger }] of Array.from(this._queue.entries())) {\n if (task === err.task) {\n logger.info(`Failed %o`, err);\n logger(\n `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`\n );\n } else {\n logger.info(\n `A fatal exception occurred in a previous task, the queue has been purged: %o`,\n err.message\n );\n }\n\n this.complete(task);\n }\n\n if (this._queue.size !== 0) {\n throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);\n }\n }\n\n complete(task: AnySimpleGitTask) {\n const progress = this.withProgress(task);\n if (progress) {\n this._queue.delete(task);\n }\n }\n\n attempt(task: AnySimpleGitTask): TaskInProgress {\n const progress = this.withProgress(task);\n if (!progress) {\n throw new GitError(undefined, 'TasksPendingQueue: attempt called for an unknown task');\n }\n progress.logger('Starting task');\n\n return progress;\n }\n\n static getName(name = 'empty') {\n return `task:${name}:${++TasksPendingQueue.counter}`;\n }\n\n private static counter = 0;\n}\n", "import { spawn, SpawnOptions } from 'child_process';\nimport { GitError } from '../errors/git-error';\nimport { OutputLogger } from '../git-logger';\nimport { PluginStore } from '../plugins';\nimport { EmptyTask, isBufferTask, isEmptyTask } from '../tasks/task';\nimport {\n GitExecutorResult,\n Maybe,\n outputHandler,\n RunnableTask,\n SimpleGitExecutor,\n SimpleGitTask,\n} from '../types';\nimport { callTaskParser, first, GitOutputStreams, objectToString } from '../utils';\nimport { Scheduler } from './scheduler';\nimport { TasksPendingQueue } from './tasks-pending-queue';\n\nexport class GitExecutorChain implements SimpleGitExecutor {\n private _chain: Promise = Promise.resolve();\n private _queue = new TasksPendingQueue();\n private _cwd: string | undefined;\n\n public get cwd() {\n return this._cwd || this._executor.cwd;\n }\n\n public set cwd(cwd: string) {\n this._cwd = cwd;\n }\n\n public get env() {\n return this._executor.env;\n }\n\n public get outputHandler() {\n return this._executor.outputHandler;\n }\n\n constructor(\n private _executor: SimpleGitExecutor,\n private _scheduler: Scheduler,\n private _plugins: PluginStore\n ) {}\n\n public chain() {\n return this;\n }\n\n public push(task: SimpleGitTask): Promise {\n this._queue.push(task);\n\n return (this._chain = this._chain.then(() => this.attemptTask(task)));\n }\n\n private async attemptTask(task: SimpleGitTask): Promise {\n const onScheduleComplete = await this._scheduler.next();\n const onQueueComplete = () => this._queue.complete(task);\n\n try {\n const { logger } = this._queue.attempt(task);\n return (await (isEmptyTask(task)\n ? this.attemptEmptyTask(task, logger)\n : this.attemptRemoteTask(task, logger))) as R;\n } catch (e) {\n throw this.onFatalException(task, e as Error);\n } finally {\n onQueueComplete();\n onScheduleComplete();\n }\n }\n\n private onFatalException(task: SimpleGitTask, e: Error) {\n const gitError =\n e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));\n\n this._chain = Promise.resolve();\n this._queue.fatal(gitError);\n\n return gitError;\n }\n\n private async attemptRemoteTask(task: RunnableTask, logger: OutputLogger) {\n const binary = this._plugins.exec('spawn.binary', '', pluginContext(task, task.commands));\n const args = this._plugins.exec(\n 'spawn.args',\n [...task.commands],\n pluginContext(task, task.commands)\n );\n\n const raw = await this.gitResponse(\n task,\n binary,\n args,\n this.outputHandler,\n logger.step('SPAWN')\n );\n const outputStreams = await this.handleTaskData(task, args, raw, logger.step('HANDLE'));\n\n logger(`passing response to task's parser as a %s`, task.format);\n\n if (isBufferTask(task)) {\n return callTaskParser(task.parser, outputStreams);\n }\n\n return callTaskParser(task.parser, outputStreams.asStrings());\n }\n\n private async attemptEmptyTask(task: EmptyTask, logger: OutputLogger) {\n logger(`empty task bypassing child process to call to task's parser`);\n return task.parser(this);\n }\n\n private handleTaskData(\n task: SimpleGitTask,\n args: string[],\n result: GitExecutorResult,\n logger: OutputLogger\n ): Promise {\n const { exitCode, rejection, stdOut, stdErr } = result;\n\n return new Promise((done, fail) => {\n logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);\n\n const { error } = this._plugins.exec(\n 'task.error',\n { error: rejection },\n {\n ...pluginContext(task, args),\n ...result,\n }\n );\n\n if (error && task.onError) {\n logger.info(`exitCode=%s handling with custom error handler`);\n\n return task.onError(\n result,\n error,\n (newStdOut) => {\n logger.info(`custom error handler treated as success`);\n logger(`custom error returned a %s`, objectToString(newStdOut));\n\n done(\n new GitOutputStreams(\n Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut,\n Buffer.concat(stdErr)\n )\n );\n },\n fail\n );\n }\n\n if (error) {\n logger.info(\n `handling as error: exitCode=%s stdErr=%s rejection=%o`,\n exitCode,\n stdErr.length,\n rejection\n );\n return fail(error);\n }\n\n logger.info(`retrieving task output complete`);\n done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));\n });\n }\n\n private async gitResponse(\n task: SimpleGitTask,\n command: string,\n args: string[],\n outputHandler: Maybe,\n logger: OutputLogger\n ): Promise {\n const outputLogger = logger.sibling('output');\n const spawnOptions: SpawnOptions = this._plugins.exec(\n 'spawn.options',\n {\n cwd: this.cwd,\n env: this.env,\n windowsHide: true,\n },\n pluginContext(task, task.commands)\n );\n\n return new Promise((done) => {\n const stdOut: Buffer[] = [];\n const stdErr: Buffer[] = [];\n\n logger.info(`%s %o`, command, args);\n logger('%O', spawnOptions);\n\n let rejection = this._beforeSpawn(task, args);\n if (rejection) {\n return done({\n stdOut,\n stdErr,\n exitCode: 9901,\n rejection,\n });\n }\n\n this._plugins.exec('spawn.before', undefined, {\n ...pluginContext(task, args),\n kill(reason) {\n rejection = reason || rejection;\n },\n });\n\n const spawned = spawn(command, args, spawnOptions);\n\n spawned.stdout!.on(\n 'data',\n onDataReceived(stdOut, 'stdOut', logger, outputLogger.step('stdOut'))\n );\n spawned.stderr!.on(\n 'data',\n onDataReceived(stdErr, 'stdErr', logger, outputLogger.step('stdErr'))\n );\n\n spawned.on('error', onErrorReceived(stdErr, logger));\n\n if (outputHandler) {\n logger(`Passing child process stdOut/stdErr to custom outputHandler`);\n outputHandler(command, spawned.stdout!, spawned.stderr!, [...args]);\n }\n\n this._plugins.exec('spawn.after', undefined, {\n ...pluginContext(task, args),\n spawned,\n close(exitCode: number, reason?: Error) {\n done({\n stdOut,\n stdErr,\n exitCode,\n rejection: rejection || reason,\n });\n },\n kill(reason: Error) {\n if (spawned.killed) {\n return;\n }\n\n rejection = reason;\n spawned.kill('SIGINT');\n },\n });\n });\n }\n\n private _beforeSpawn(task: SimpleGitTask, args: string[]) {\n let rejection: Maybe;\n this._plugins.exec('spawn.before', undefined, {\n ...pluginContext(task, args),\n kill(reason) {\n rejection = reason || rejection;\n },\n });\n\n return rejection;\n }\n}\n\nfunction pluginContext(task: SimpleGitTask, commands: string[]) {\n return {\n method: first(task.commands) || '',\n commands,\n };\n}\n\nfunction onErrorReceived(target: Buffer[], logger: OutputLogger) {\n return (err: Error) => {\n logger(`[ERROR] child process exception %o`, err);\n target.push(Buffer.from(String(err.stack), 'ascii'));\n };\n}\n\nfunction onDataReceived(\n target: Buffer[],\n name: string,\n logger: OutputLogger,\n output: OutputLogger\n) {\n return (buffer: Buffer) => {\n logger(`%s received %L bytes`, name, buffer);\n output(`%B`, buffer);\n target.push(buffer);\n };\n}\n", "import type { PluginStore } from '../plugins';\nimport type { GitExecutorEnv, outputHandler, SimpleGitExecutor, SimpleGitTask } from '../types';\n\nimport { GitExecutorChain } from './git-executor-chain';\nimport { Scheduler } from './scheduler';\n\nexport class GitExecutor implements SimpleGitExecutor {\n private _chain = new GitExecutorChain(this, this._scheduler, this._plugins);\n\n public env: GitExecutorEnv;\n public outputHandler?: outputHandler;\n\n constructor(\n public cwd: string,\n private _scheduler: Scheduler,\n private _plugins: PluginStore\n ) {}\n\n chain(): SimpleGitExecutor {\n return new GitExecutorChain(this, this._scheduler, this._plugins);\n }\n\n push(task: SimpleGitTask): Promise {\n return this._chain.push(task);\n }\n}\n", "import { GitError } from './errors/git-error';\nimport { GitResponseError } from './errors/git-response-error';\nimport { SimpleGitTask, SimpleGitTaskCallback } from './types';\nimport { NOOP } from './utils';\n\nexport function taskCallback(\n task: SimpleGitTask,\n response: Promise,\n callback: SimpleGitTaskCallback = NOOP\n) {\n const onSuccess = (data: R) => {\n callback(null, data);\n };\n\n const onError = (err: GitError | GitResponseError) => {\n if (err?.task === task) {\n callback(\n err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,\n undefined as any\n );\n }\n };\n\n response.then(onSuccess, onError);\n}\n\nfunction addDeprecationNoticeToError(err: GitResponseError) {\n let log = (name: string) => {\n console.warn(\n `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`\n );\n log = NOOP;\n };\n\n return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));\n\n function descriptorReducer(all: PropertyDescriptorMap, name: string): typeof all {\n if (name in err) {\n return all;\n }\n\n all[name] = {\n enumerable: false,\n configurable: false,\n get() {\n log(name);\n return err.git[name];\n },\n };\n\n return all;\n }\n}\n", "import { folderExists } from '../utils';\nimport { SimpleGitExecutor } from '../types';\nimport { adhocExecTask } from './task';\n\nexport function changeWorkingDirectoryTask(directory: string, root?: SimpleGitExecutor) {\n return adhocExecTask((instance: SimpleGitExecutor) => {\n if (!folderExists(directory)) {\n throw new Error(`Git.cwd: cannot change to non-directory \"${directory}\"`);\n }\n\n return ((root || instance).cwd = directory);\n });\n}\n", "import type { SimpleGit } from '../../../typings';\nimport type { SimpleGitApi } from '../simple-git-api';\nimport { getTrailingOptions, remove, trailingFunctionArgument } from '../utils';\nimport { straightThroughStringTask } from './task';\n\nfunction checkoutTask(args: string[]) {\n const commands = ['checkout', ...args];\n if (commands[1] === '-b' && commands.includes('-B')) {\n commands[1] = remove(commands, '-B');\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport default function (): Pick {\n return {\n checkout(this: SimpleGitApi) {\n return this._runTask(\n checkoutTask(getTrailingOptions(arguments, 1)),\n trailingFunctionArgument(arguments)\n );\n },\n\n checkoutBranch(this: SimpleGitApi, branchName, startPoint) {\n return this._runTask(\n checkoutTask(['-b', branchName, startPoint, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n },\n\n checkoutLocalBranch(this: SimpleGitApi, branchName) {\n return this._runTask(\n checkoutTask(['-b', branchName, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n },\n };\n}\n", "import { CommitResult } from '../../../typings';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser[] = [\n new LineParser(/^\\[([^\\s]+)( \\([^)]+\\))? ([^\\]]+)/, (result, [branch, root, commit]) => {\n result.branch = branch;\n result.commit = commit;\n result.root = !!root;\n }),\n new LineParser(/\\s*Author:\\s(.+)/i, (result, [author]) => {\n const parts = author.split('<');\n const email = parts.pop();\n\n if (!email || !email.includes('@')) {\n return;\n }\n\n result.author = {\n email: email.substr(0, email.length - 1),\n name: parts.join('<').trim(),\n };\n }),\n new LineParser(\n /(\\d+)[^,]*(?:,\\s*(\\d+)[^,]*)(?:,\\s*(\\d+))/g,\n (result, [changes, insertions, deletions]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n result.summary.insertions = parseInt(insertions, 10) || 0;\n result.summary.deletions = parseInt(deletions, 10) || 0;\n }\n ),\n new LineParser(\n /^(\\d+)[^,]*(?:,\\s*(\\d+)[^(]+\\(([+-]))?/,\n (result, [changes, lines, direction]) => {\n result.summary.changes = parseInt(changes, 10) || 0;\n const count = parseInt(lines, 10) || 0;\n if (direction === '-') {\n result.summary.deletions = count;\n } else if (direction === '+') {\n result.summary.insertions = count;\n }\n }\n ),\n];\n\nexport function parseCommitResult(stdOut: string): CommitResult {\n const result: CommitResult = {\n author: null,\n branch: '',\n commit: '',\n root: false,\n summary: {\n changes: 0,\n insertions: 0,\n deletions: 0,\n },\n };\n return parseStringResponse(result, parsers, stdOut);\n}\n", "import type { CommitResult, SimpleGit } from '../../../typings';\nimport type { SimpleGitApi } from '../simple-git-api';\nimport type { StringTask } from '../types';\nimport { parseCommitResult } from '../parsers/parse-commit';\nimport {\n asArray,\n filterArray,\n filterStringOrStringArray,\n filterType,\n getTrailingOptions,\n prefixedArray,\n trailingFunctionArgument,\n} from '../utils';\nimport { configurationErrorTask } from './task';\n\nexport function commitTask(\n message: string[],\n files: string[],\n customArgs: string[]\n): StringTask {\n const commands: string[] = [\n '-c',\n 'core.abbrev=40',\n 'commit',\n ...prefixedArray(message, '-m'),\n ...files,\n ...customArgs,\n ];\n\n return {\n commands,\n format: 'utf-8',\n parser: parseCommitResult,\n };\n}\n\nexport default function (): Pick {\n return {\n commit(this: SimpleGitApi, message: string | string[], ...rest: unknown[]) {\n const next = trailingFunctionArgument(arguments);\n const task =\n rejectDeprecatedSignatures(message) ||\n commitTask(\n asArray(message),\n asArray(filterType(rest[0], filterStringOrStringArray, [])),\n [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]\n );\n\n return this._runTask(task, next);\n },\n };\n\n function rejectDeprecatedSignatures(message?: unknown) {\n return (\n !filterStringOrStringArray(message) &&\n configurationErrorTask(\n `git.commit: requires the commit message to be supplied as a string/string[]`\n )\n );\n }\n}\n", "import { Response, SimpleGit } from '../../../typings';\nimport { SimpleGitApi } from '../simple-git-api';\nimport { trailingFunctionArgument } from '../utils';\nimport { straightThroughStringTask } from './task';\n\nexport default function (): Pick {\n return {\n firstCommit(this: SimpleGitApi): Response {\n return this._runTask(\n straightThroughStringTask(['rev-list', '--max-parents=0', 'HEAD'], true),\n trailingFunctionArgument(arguments)\n );\n },\n };\n}\n", "import { straightThroughStringTask } from './task';\nimport { StringTask } from '../types';\n\n/**\n * Task used by `git.hashObject`\n */\nexport function hashObjectTask(filePath: string, write: boolean): StringTask {\n const commands = ['hash-object', filePath];\n if (write) {\n commands.push('-w');\n }\n\n return straightThroughStringTask(commands, true);\n}\n", "import { InitResult } from '../../../typings';\n\nexport class InitSummary implements InitResult {\n constructor(\n public readonly bare: boolean,\n public readonly path: string,\n public readonly existing: boolean,\n public readonly gitDir: string\n ) {}\n}\n\nconst initResponseRegex = /^Init.+ repository in (.+)$/;\nconst reInitResponseRegex = /^Rein.+ in (.+)$/;\n\nexport function parseInit(bare: boolean, path: string, text: string) {\n const response = String(text).trim();\n let result;\n\n if ((result = initResponseRegex.exec(response))) {\n return new InitSummary(bare, path, false, result[1]);\n }\n\n if ((result = reInitResponseRegex.exec(response))) {\n return new InitSummary(bare, path, true, result[1]);\n }\n\n let gitDir = '';\n const tokens = response.split(' ');\n while (tokens.length) {\n const token = tokens.shift();\n if (token === 'in') {\n gitDir = tokens.join(' ');\n break;\n }\n }\n\n return new InitSummary(bare, path, /^re/i.test(response), gitDir);\n}\n", "import { InitResult } from '../../../typings';\nimport { parseInit } from '../responses/InitSummary';\nimport { StringTask } from '../types';\n\nconst bareCommand = '--bare';\n\nfunction hasBareCommand(command: string[]) {\n return command.includes(bareCommand);\n}\n\nexport function initTask(bare = false, path: string, customArgs: string[]): StringTask {\n const commands = ['init', ...customArgs];\n if (bare && !hasBareCommand(commands)) {\n commands.splice(1, 0, bareCommand);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(text: string): InitResult {\n return parseInit(commands.includes('--bare'), path, text);\n },\n };\n}\n", "export enum LogFormat {\n NONE = '',\n STAT = '--stat',\n NUM_STAT = '--numstat',\n NAME_ONLY = '--name-only',\n NAME_STATUS = '--name-status',\n}\n\nconst logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;\n\nexport function logFormatFromCommand(customArgs: string[]) {\n for (let i = 0; i < customArgs.length; i++) {\n const format = logFormatRegex.exec(customArgs[i]);\n if (format) {\n return `--${format[1]}` as LogFormat;\n }\n }\n\n return LogFormat.NONE;\n}\n\nexport function isLogFormat(customArg: string | unknown) {\n return logFormatRegex.test(customArg as string);\n}\n", "import { DiffResult, DiffResultBinaryFile, DiffResultTextFile } from '../../../typings';\n\n/***\n * The DiffSummary is returned as a response to getting `git().status()`\n */\nexport class DiffSummary implements DiffResult {\n changed = 0;\n deletions = 0;\n insertions = 0;\n\n files: Array = [];\n}\n", "import { DiffResult } from '../../../typings';\nimport { LogFormat } from '../args/log-format';\nimport { DiffSummary } from '../responses/DiffSummary';\nimport { isDiffNameStatus } from '../tasks/diff-name-status';\nimport { asNumber, LineParser, orVoid, parseStringResponse } from '../utils';\n\nconst statParser = [\n new LineParser(\n /^(.+)\\s+\\|\\s+(\\d+)(\\s+[+\\-]+)?$/,\n (result, [file, changes, alterations = '']) => {\n result.files.push({\n file: file.trim(),\n changes: asNumber(changes),\n insertions: alterations.replace(/[^+]/g, '').length,\n deletions: alterations.replace(/[^-]/g, '').length,\n binary: false,\n });\n }\n ),\n new LineParser(\n /^(.+) \\|\\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,\n (result, [file, before, after]) => {\n result.files.push({\n file: file.trim(),\n before: asNumber(before),\n after: asNumber(after),\n binary: true,\n });\n }\n ),\n new LineParser(\n /(\\d+) files? changed\\s*((?:, \\d+ [^,]+){0,2})/,\n (result, [changed, summary]) => {\n const inserted = /(\\d+) i/.exec(summary);\n const deleted = /(\\d+) d/.exec(summary);\n\n result.changed = asNumber(changed);\n result.insertions = asNumber(inserted?.[1]);\n result.deletions = asNumber(deleted?.[1]);\n }\n ),\n];\n\nconst numStatParser = [\n new LineParser(\n /(\\d+)\\t(\\d+)\\t(.+)$/,\n (result, [changesInsert, changesDelete, file]) => {\n const insertions = asNumber(changesInsert);\n const deletions = asNumber(changesDelete);\n\n result.changed++;\n result.insertions += insertions;\n result.deletions += deletions;\n\n result.files.push({\n file,\n changes: insertions + deletions,\n insertions,\n deletions,\n binary: false,\n });\n }\n ),\n new LineParser(/-\\t-\\t(.+)$/, (result, [file]) => {\n result.changed++;\n\n result.files.push({\n file,\n after: 0,\n before: 0,\n binary: true,\n });\n }),\n];\n\nconst nameOnlyParser = [\n new LineParser(/(.+)$/, (result, [file]) => {\n result.changed++;\n result.files.push({\n file,\n changes: 0,\n insertions: 0,\n deletions: 0,\n binary: false,\n });\n }),\n];\n\nconst nameStatusParser = [\n new LineParser(\n /([ACDMRTUXB])([0-9]{0,3})\\t(.[^\\t]*)(\\t(.[^\\t]*))?$/,\n (result, [status, _similarity, from, _to, to]) => {\n result.changed++;\n result.files.push({\n file: to ?? from,\n changes: 0,\n status: orVoid(isDiffNameStatus(status) && status),\n insertions: 0,\n deletions: 0,\n binary: false,\n });\n }\n ),\n];\n\nconst diffSummaryParsers: Record[]> = {\n [LogFormat.NONE]: statParser,\n [LogFormat.STAT]: statParser,\n [LogFormat.NUM_STAT]: numStatParser,\n [LogFormat.NAME_STATUS]: nameStatusParser,\n [LogFormat.NAME_ONLY]: nameOnlyParser,\n};\n\nexport function getDiffParser(format = LogFormat.NONE) {\n const parser = diffSummaryParsers[format];\n\n return (stdOut: string) => parseStringResponse(new DiffSummary(), parser, stdOut, false);\n}\n", "import { ListLogLine, LogResult } from '../../../typings';\nimport { toLinesWithContent } from '../utils';\nimport { getDiffParser } from './parse-diff-summary';\nimport { LogFormat } from '../args/log-format';\n\nexport const START_BOUNDARY = '\u00F2\u00F2\u00F2\u00F2\u00F2\u00F2 ';\n\nexport const COMMIT_BOUNDARY = ' \u00F2\u00F2';\n\nexport const SPLITTER = ' \u00F2 ';\n\nconst defaultFieldNames = ['hash', 'date', 'message', 'refs', 'author_name', 'author_email'];\n\nfunction lineBuilder(tokens: string[], fields: string[]): any {\n return fields.reduce(\n (line, field, index) => {\n line[field] = tokens[index] || '';\n return line;\n },\n Object.create({ diff: null }) as any\n );\n}\n\nexport function createListLogSummaryParser(\n splitter = SPLITTER,\n fields = defaultFieldNames,\n logFormat = LogFormat.NONE\n) {\n const parseDiffResult = getDiffParser(logFormat);\n\n return function (stdOut: string): LogResult {\n const all: ReadonlyArray = toLinesWithContent(\n stdOut,\n true,\n START_BOUNDARY\n ).map(function (item) {\n const lineDetail = item.trim().split(COMMIT_BOUNDARY);\n const listLogLine: T & ListLogLine = lineBuilder(\n lineDetail[0].trim().split(splitter),\n fields\n );\n\n if (lineDetail.length > 1 && !!lineDetail[1].trim()) {\n listLogLine.diff = parseDiffResult(lineDetail[1]);\n }\n\n return listLogLine;\n });\n\n return {\n all,\n latest: (all.length && all[0]) || null,\n total: all.length,\n };\n };\n}\n", "import { StringTask } from '../types';\nimport { DiffResult } from '../../../typings';\nimport { isLogFormat, LogFormat, logFormatFromCommand } from '../args/log-format';\nimport { getDiffParser } from '../parsers/parse-diff-summary';\nimport { configurationErrorTask, EmptyTask } from './task';\n\nexport function diffSummaryTask(customArgs: string[]): StringTask | EmptyTask {\n let logFormat = logFormatFromCommand(customArgs);\n\n const commands = ['diff'];\n\n if (logFormat === LogFormat.NONE) {\n logFormat = LogFormat.STAT;\n commands.push('--stat=4096');\n }\n\n commands.push(...customArgs);\n\n return (\n validateLogFormatConfig(commands) || {\n commands,\n format: 'utf-8',\n parser: getDiffParser(logFormat),\n }\n );\n}\n\nexport function validateLogFormatConfig(customArgs: unknown[]): EmptyTask | void {\n const flags = customArgs.filter(isLogFormat);\n\n if (flags.length > 1) {\n return configurationErrorTask(\n `Summary flags are mutually exclusive - pick one of ${flags.join(',')}`\n );\n }\n\n if (flags.length && customArgs.includes('-z')) {\n return configurationErrorTask(\n `Summary flag ${flags} parsing is not compatible with null termination option '-z'`\n );\n }\n}\n", "import type { Options, StringTask } from '../types';\nimport type { LogResult, SimpleGit } from '../../../typings';\nimport { logFormatFromCommand } from '../args/log-format';\nimport { pathspec } from '../args/pathspec';\nimport {\n COMMIT_BOUNDARY,\n createListLogSummaryParser,\n SPLITTER,\n START_BOUNDARY,\n} from '../parsers/parse-list-log-summary';\nimport {\n appendTaskOptions,\n filterArray,\n filterPrimitives,\n filterString,\n filterType,\n trailingFunctionArgument,\n trailingOptionsArgument,\n} from '../utils';\nimport { SimpleGitApi } from '../simple-git-api';\nimport { configurationErrorTask } from './task';\nimport { validateLogFormatConfig } from './diff';\n\nenum excludeOptions {\n '--pretty',\n 'max-count',\n 'maxCount',\n 'n',\n 'file',\n 'format',\n 'from',\n 'to',\n 'splitter',\n 'symmetric',\n 'mailMap',\n 'multiLine',\n 'strictDate',\n}\n\nexport interface DefaultLogFields {\n hash: string;\n date: string;\n message: string;\n refs: string;\n body: string;\n author_name: string;\n author_email: string;\n}\n\nexport type LogOptions = {\n file?: string;\n format?: T;\n from?: string;\n mailMap?: boolean;\n maxCount?: number;\n multiLine?: boolean;\n splitter?: string;\n strictDate?: boolean;\n symmetric?: boolean;\n to?: string;\n};\n\ninterface ParsedLogOptions {\n fields: string[];\n splitter: string;\n commands: string[];\n}\n\nfunction prettyFormat(\n format: Record,\n splitter: string\n): [string[], string] {\n const fields: string[] = [];\n const formatStr: string[] = [];\n\n Object.keys(format).forEach((field) => {\n fields.push(field);\n formatStr.push(String(format[field]));\n });\n\n return [fields, formatStr.join(splitter)];\n}\n\nfunction userOptions(input: T): Options {\n return Object.keys(input).reduce((out, key) => {\n if (!(key in excludeOptions)) {\n out[key] = input[key];\n }\n return out;\n }, {} as Options);\n}\n\nexport function parseLogOptions(\n opt: Options | LogOptions = {},\n customArgs: string[] = []\n): ParsedLogOptions {\n const splitter = filterType(opt.splitter, filterString, SPLITTER);\n const format =\n !filterPrimitives(opt.format) && opt.format\n ? opt.format\n : {\n hash: '%H',\n date: opt.strictDate === false ? '%ai' : '%aI',\n message: '%s',\n refs: '%D',\n body: opt.multiLine ? '%B' : '%b',\n author_name: opt.mailMap !== false ? '%aN' : '%an',\n author_email: opt.mailMap !== false ? '%aE' : '%ae',\n };\n\n const [fields, formatStr] = prettyFormat(format, splitter);\n\n const suffix: string[] = [];\n const command: string[] = [\n `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,\n ...customArgs,\n ];\n\n const maxCount: number | undefined = (opt as any).n || (opt as any)['max-count'] || opt.maxCount;\n if (maxCount) {\n command.push(`--max-count=${maxCount}`);\n }\n\n if (opt.from || opt.to) {\n const rangeOperator = opt.symmetric !== false ? '...' : '..';\n suffix.push(`${opt.from || ''}${rangeOperator}${opt.to || ''}`);\n }\n\n if (filterString(opt.file)) {\n command.push('--follow', pathspec(opt.file));\n }\n\n appendTaskOptions(userOptions(opt as Options), command);\n\n return {\n fields,\n splitter,\n commands: [...command, ...suffix],\n };\n}\n\nexport function logTask(\n splitter: string,\n fields: string[],\n customArgs: string[]\n): StringTask> {\n const parser = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));\n\n return {\n commands: ['log', ...customArgs],\n format: 'utf-8',\n parser,\n };\n}\n\nexport default function (): Pick {\n return {\n log(this: SimpleGitApi, ...rest: unknown[]) {\n const next = trailingFunctionArgument(arguments);\n const options = parseLogOptions(\n trailingOptionsArgument(arguments),\n filterType(arguments[0], filterArray)\n );\n const task =\n rejectDeprecatedSignatures(...rest) ||\n validateLogFormatConfig(options.commands) ||\n createLogTask(options);\n\n return this._runTask(task, next);\n },\n };\n\n function createLogTask(options: ParsedLogOptions) {\n return logTask(options.splitter, options.fields, options.commands);\n }\n\n function rejectDeprecatedSignatures(from?: unknown, to?: unknown) {\n return (\n filterString(from) &&\n filterString(to) &&\n configurationErrorTask(\n `git.log(string, string) should be replaced with git.log({ from: string, to: string })`\n )\n );\n }\n}\n", "import {\n MergeConflict,\n MergeConflictDeletion,\n MergeDetail,\n MergeResultStatus,\n} from '../../../typings';\n\nexport class MergeSummaryConflict implements MergeConflict {\n constructor(\n public readonly reason: string,\n public readonly file: string | null = null,\n public readonly meta?: MergeConflictDeletion\n ) {}\n\n toString() {\n return `${this.file}:${this.reason}`;\n }\n}\n\nexport class MergeSummaryDetail implements MergeDetail {\n public conflicts: MergeConflict[] = [];\n public merges: string[] = [];\n public result: MergeResultStatus = 'success';\n\n get failed() {\n return this.conflicts.length > 0;\n }\n\n get reason() {\n return this.result;\n }\n\n toString() {\n if (this.conflicts.length) {\n return `CONFLICTS: ${this.conflicts.join(', ')}`;\n }\n\n return 'OK';\n }\n}\n", "import {\n PullDetailFileChanges,\n PullDetailSummary,\n PullFailedResult,\n PullResult,\n} from '../../../typings';\n\nexport class PullSummary implements PullResult {\n public remoteMessages = {\n all: [],\n };\n public created = [];\n public deleted: string[] = [];\n public files: string[] = [];\n public deletions: PullDetailFileChanges = {};\n public insertions: PullDetailFileChanges = {};\n public summary: PullDetailSummary = {\n changes: 0,\n deletions: 0,\n insertions: 0,\n };\n}\n\nexport class PullFailedSummary implements PullFailedResult {\n remote = '';\n hash = {\n local: '',\n remote: '',\n };\n branch = {\n local: '',\n remote: '',\n };\n message = '';\n\n toString() {\n return this.message;\n }\n}\n", "import {\n RemoteMessageResult,\n RemoteMessages,\n RemoteMessagesObjectEnumeration,\n} from '../../../typings';\nimport { asNumber, RemoteLineParser } from '../utils';\n\nfunction objectEnumerationResult(\n remoteMessages: T\n): RemoteMessagesObjectEnumeration {\n return (remoteMessages.objects = remoteMessages.objects || {\n compressing: 0,\n counting: 0,\n enumerating: 0,\n packReused: 0,\n reused: { count: 0, delta: 0 },\n total: { count: 0, delta: 0 },\n });\n}\n\nfunction asObjectCount(source: string) {\n const count = /^\\s*(\\d+)/.exec(source);\n const delta = /delta (\\d+)/i.exec(source);\n\n return {\n count: asNumber((count && count[1]) || '0'),\n delta: asNumber((delta && delta[1]) || '0'),\n };\n}\n\nexport const remoteMessagesObjectParsers: RemoteLineParser>[] =\n [\n new RemoteLineParser(\n /^remote:\\s*(enumerating|counting|compressing) objects: (\\d+),/i,\n (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n\n Object.assign(enumeration, { [key]: asNumber(count) });\n }\n ),\n new RemoteLineParser(\n /^remote:\\s*(enumerating|counting|compressing) objects: \\d+% \\(\\d+\\/(\\d+)\\),/i,\n (result, [action, count]) => {\n const key = action.toLowerCase();\n const enumeration = objectEnumerationResult(result.remoteMessages);\n\n Object.assign(enumeration, { [key]: asNumber(count) });\n }\n ),\n new RemoteLineParser(\n /total ([^,]+), reused ([^,]+), pack-reused (\\d+)/i,\n (result, [total, reused, packReused]) => {\n const objects = objectEnumerationResult(result.remoteMessages);\n objects.total = asObjectCount(total);\n objects.reused = asObjectCount(reused);\n objects.packReused = asNumber(packReused);\n }\n ),\n ];\n", "import { PushResultRemoteMessages, RemoteMessageResult, RemoteMessages } from '../../../typings';\nimport { asNumber, parseStringResponse, RemoteLineParser } from '../utils';\nimport { remoteMessagesObjectParsers } from './parse-remote-objects';\n\nconst parsers: RemoteLineParser>[] =\n [\n new RemoteLineParser(/^remote:\\s*(.+)$/, (result, [text]) => {\n result.remoteMessages.all.push(text.trim());\n return false;\n }),\n ...remoteMessagesObjectParsers,\n new RemoteLineParser(\n [/create a (?:pull|merge) request/i, /\\s(https?:\\/\\/\\S+)$/],\n (result, [pullRequestUrl]) => {\n (result.remoteMessages as PushResultRemoteMessages).pullRequestUrl = pullRequestUrl;\n }\n ),\n new RemoteLineParser(\n [/found (\\d+) vulnerabilities.+\\(([^)]+)\\)/i, /\\s(https?:\\/\\/\\S+)$/],\n (result, [count, summary, url]) => {\n (result.remoteMessages as PushResultRemoteMessages).vulnerabilities = {\n count: asNumber(count),\n summary,\n url,\n };\n }\n ),\n ];\n\nexport function parseRemoteMessages(\n _stdOut: string,\n stdErr: string\n): RemoteMessageResult {\n return parseStringResponse({ remoteMessages: new RemoteMessageSummary() as T }, parsers, stdErr);\n}\n\nexport class RemoteMessageSummary implements RemoteMessages {\n public readonly all: string[] = [];\n}\n", "import { PullDetail, PullFailedResult, PullResult, RemoteMessages } from '../../../typings';\nimport { PullFailedSummary, PullSummary } from '../responses/PullSummary';\nimport { TaskParser } from '../types';\nimport { append, LineParser, parseStringResponse } from '../utils';\nimport { parseRemoteMessages } from './parse-remote-messages';\n\nconst FILE_UPDATE_REGEX = /^\\s*(.+?)\\s+\\|\\s+\\d+\\s*(\\+*)(-*)/;\nconst SUMMARY_REGEX = /(\\d+)\\D+((\\d+)\\D+\\(\\+\\))?(\\D+(\\d+)\\D+\\(-\\))?/;\nconst ACTION_REGEX = /^(create|delete) mode \\d+ (.+)/;\n\nconst parsers: LineParser[] = [\n new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {\n result.files.push(file);\n\n if (insertions) {\n result.insertions[file] = insertions.length;\n }\n\n if (deletions) {\n result.deletions[file] = deletions.length;\n }\n }),\n new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {\n if (insertions !== undefined || deletions !== undefined) {\n result.summary.changes = +changes || 0;\n result.summary.insertions = +insertions || 0;\n result.summary.deletions = +deletions || 0;\n return true;\n }\n return false;\n }),\n new LineParser(ACTION_REGEX, (result, [action, file]) => {\n append(result.files, file);\n append(action === 'create' ? result.created : result.deleted, file);\n }),\n];\n\nconst errorParsers: LineParser[] = [\n new LineParser(/^from\\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),\n new LineParser(/^fatal:\\s(.+)$/, (result, [message]) => void (result.message = message)),\n new LineParser(\n /([a-z0-9]+)\\.\\.([a-z0-9]+)\\s+(\\S+)\\s+->\\s+(\\S+)$/,\n (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {\n result.branch.local = branchLocal;\n result.hash.local = hashLocal;\n result.branch.remote = branchRemote;\n result.hash.remote = hashRemote;\n }\n ),\n];\n\nexport const parsePullDetail: TaskParser = (stdOut, stdErr) => {\n return parseStringResponse(new PullSummary(), parsers, [stdOut, stdErr]);\n};\n\nexport const parsePullResult: TaskParser = (stdOut, stdErr) => {\n return Object.assign(\n new PullSummary(),\n parsePullDetail(stdOut, stdErr),\n parseRemoteMessages(stdOut, stdErr)\n );\n};\n\nexport function parsePullErrorResult(stdOut: string, stdErr: string) {\n const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);\n\n return pullError.message && pullError;\n}\n", "import { MergeDetail, MergeResult } from '../../../typings';\nimport { MergeSummaryConflict, MergeSummaryDetail } from '../responses/MergeSummary';\nimport { TaskParser } from '../types';\nimport { LineParser, parseStringResponse } from '../utils';\nimport { parsePullResult } from './parse-pull';\n\nconst parsers: LineParser[] = [\n new LineParser(/^Auto-merging\\s+(.+)$/, (summary, [autoMerge]) => {\n summary.merges.push(autoMerge);\n }),\n new LineParser(/^CONFLICT\\s+\\((.+)\\): Merge conflict in (.+)$/, (summary, [reason, file]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file));\n }),\n new LineParser(\n /^CONFLICT\\s+\\((.+\\/delete)\\): (.+) deleted in (.+) and/,\n (summary, [reason, file, deleteRef]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));\n }\n ),\n new LineParser(/^CONFLICT\\s+\\((.+)\\):/, (summary, [reason]) => {\n summary.conflicts.push(new MergeSummaryConflict(reason, null));\n }),\n new LineParser(/^Automatic merge failed;\\s+(.+)$/, (summary, [result]) => {\n summary.result = result;\n }),\n];\n\n/**\n * Parse the complete response from `git.merge`\n */\nexport const parseMergeResult: TaskParser = (stdOut, stdErr) => {\n return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));\n};\n\n/**\n * Parse the merge specific detail (ie: not the content also available in the pull detail) from `git.mnerge`\n * @param stdOut\n */\nexport const parseMergeDetail: TaskParser = (stdOut) => {\n return parseStringResponse(new MergeSummaryDetail(), parsers, stdOut);\n};\n", "import { MergeResult } from '../../../typings';\nimport { GitResponseError } from '../errors/git-response-error';\nimport { parseMergeResult } from '../parsers/parse-merge';\nimport { StringTask } from '../types';\nimport { configurationErrorTask, EmptyTask } from './task';\n\nexport function mergeTask(customArgs: string[]): EmptyTask | StringTask {\n if (!customArgs.length) {\n return configurationErrorTask('Git.merge requires at least one option');\n }\n\n return {\n commands: ['merge', ...customArgs],\n format: 'utf-8',\n parser(stdOut, stdErr): MergeResult {\n const merge = parseMergeResult(stdOut, stdErr);\n if (merge.failed) {\n throw new GitResponseError(merge);\n }\n\n return merge;\n },\n };\n}\n", "import {\n PushDetail,\n PushResult,\n PushResultPushedItem,\n PushResultRemoteMessages,\n} from '../../../typings';\nimport { TaskParser } from '../types';\nimport { LineParser, parseStringResponse } from '../utils';\nimport { parseRemoteMessages } from './parse-remote-messages';\n\nfunction pushResultPushedItem(local: string, remote: string, status: string): PushResultPushedItem {\n const deleted = status.includes('deleted');\n const tag = status.includes('tag') || /^refs\\/tags/.test(local);\n const alreadyUpdated = !status.includes('new');\n\n return {\n deleted,\n tag,\n branch: !tag,\n new: !alreadyUpdated,\n alreadyUpdated,\n local,\n remote,\n };\n}\n\nconst parsers: LineParser[] = [\n new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {\n result.repo = repo;\n }),\n new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {\n result.ref = {\n ...(result.ref || {}),\n local,\n };\n }),\n new LineParser(/^[=*-]\\s+([^:]+):(\\S+)\\s+\\[(.+)]$/, (result, [local, remote, type]) => {\n result.pushed.push(pushResultPushedItem(local, remote, type));\n }),\n new LineParser(\n /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,\n (result, [local, remote, remoteName]) => {\n result.branch = {\n ...(result.branch || {}),\n local,\n remote,\n remoteName,\n };\n }\n ),\n new LineParser(\n /^([^:]+):(\\S+)\\s+([a-z0-9]+)\\.\\.([a-z0-9]+)$/,\n (result, [local, remote, from, to]) => {\n result.update = {\n head: {\n local,\n remote,\n },\n hash: {\n from,\n to,\n },\n };\n }\n ),\n];\n\nexport const parsePushResult: TaskParser = (stdOut, stdErr) => {\n const pushDetail = parsePushDetail(stdOut, stdErr);\n const responseDetail = parseRemoteMessages(stdOut, stdErr);\n\n return {\n ...pushDetail,\n ...responseDetail,\n };\n};\n\nexport const parsePushDetail: TaskParser = (stdOut, stdErr) => {\n return parseStringResponse({ pushed: [] }, parsers, [stdOut, stdErr]);\n};\n", "import { PushResult } from '../../../typings';\nimport { parsePushResult as parser } from '../parsers/parse-push';\nimport { StringTask } from '../types';\nimport { append, remove } from '../utils';\n\ntype PushRef = { remote?: string; branch?: string };\n\nexport function pushTagsTask(ref: PushRef = {}, customArgs: string[]): StringTask {\n append(customArgs, '--tags');\n return pushTask(ref, customArgs);\n}\n\nexport function pushTask(ref: PushRef = {}, customArgs: string[]): StringTask {\n const commands = ['push', ...customArgs];\n if (ref.branch) {\n commands.splice(1, 0, ref.branch);\n }\n if (ref.remote) {\n commands.splice(1, 0, ref.remote);\n }\n\n remove(commands, '-v');\n append(commands, '--verbose');\n append(commands, '--porcelain');\n\n return {\n commands,\n format: 'utf-8',\n parser,\n };\n}\n", "import { SimpleGit } from '../../../typings';\nimport { SimpleGitApi } from '../simple-git-api';\nimport { getTrailingOptions, trailingFunctionArgument } from '../utils';\nimport { straightThroughBufferTask, straightThroughStringTask } from './task';\n\nexport default function (): Pick {\n return {\n showBuffer(this: SimpleGitApi) {\n const commands = ['show', ...getTrailingOptions(arguments, 1)];\n if (!commands.includes('--binary')) {\n commands.splice(1, 0, '--binary');\n }\n\n return this._runTask(\n straightThroughBufferTask(commands),\n trailingFunctionArgument(arguments)\n );\n },\n\n show(this: SimpleGitApi) {\n const commands = ['show', ...getTrailingOptions(arguments, 1)];\n return this._runTask(\n straightThroughStringTask(commands),\n trailingFunctionArgument(arguments)\n );\n },\n };\n}\n", "import { FileStatusResult } from '../../../typings';\n\nexport const fromPathRegex = /^(.+) -> (.+)$/;\n\nexport class FileStatusSummary implements FileStatusResult {\n public readonly from: string | undefined;\n\n constructor(\n public path: string,\n public index: string,\n public working_dir: string\n ) {\n if ('R' === index + working_dir) {\n const detail = fromPathRegex.exec(path) || [null, path, path];\n this.from = detail[1] || '';\n this.path = detail[2] || '';\n }\n }\n}\n", "import { StatusResult } from '../../../typings';\nimport { append, NULL } from '../utils';\nimport { FileStatusSummary } from './FileStatusSummary';\n\ntype StatusLineParser = (result: StatusResult, file: string) => void;\n\nexport class StatusSummary implements StatusResult {\n public not_added = [];\n public conflicted = [];\n public created = [];\n public deleted = [];\n public ignored = undefined;\n public modified = [];\n public renamed = [];\n public files = [];\n public staged = [];\n public ahead = 0;\n public behind = 0;\n public current = null;\n public tracking = null;\n public detached = false;\n\n public isClean = () => {\n return !this.files.length;\n };\n}\n\nenum PorcelainFileStatus {\n ADDED = 'A',\n DELETED = 'D',\n MODIFIED = 'M',\n RENAMED = 'R',\n COPIED = 'C',\n UNMERGED = 'U',\n UNTRACKED = '?',\n IGNORED = '!',\n NONE = ' ',\n}\n\nfunction renamedFile(line: string) {\n const [to, from] = line.split(NULL);\n\n return {\n from: from || to,\n to,\n };\n}\n\nfunction parser(\n indexX: PorcelainFileStatus,\n indexY: PorcelainFileStatus,\n handler: StatusLineParser\n): [string, StatusLineParser] {\n return [`${indexX}${indexY}`, handler];\n}\n\nfunction conflicts(indexX: PorcelainFileStatus, ...indexY: PorcelainFileStatus[]) {\n return indexY.map((y) => parser(indexX, y, (result, file) => append(result.conflicted, file)));\n}\n\nconst parsers: Map = new Map([\n parser(PorcelainFileStatus.NONE, PorcelainFileStatus.ADDED, (result, file) =>\n append(result.created, file)\n ),\n parser(PorcelainFileStatus.NONE, PorcelainFileStatus.DELETED, (result, file) =>\n append(result.deleted, file)\n ),\n parser(PorcelainFileStatus.NONE, PorcelainFileStatus.MODIFIED, (result, file) =>\n append(result.modified, file)\n ),\n\n parser(\n PorcelainFileStatus.ADDED,\n PorcelainFileStatus.NONE,\n (result, file) => append(result.created, file) && append(result.staged, file)\n ),\n parser(\n PorcelainFileStatus.ADDED,\n PorcelainFileStatus.MODIFIED,\n (result, file) =>\n append(result.created, file) &&\n append(result.staged, file) &&\n append(result.modified, file)\n ),\n\n parser(\n PorcelainFileStatus.DELETED,\n PorcelainFileStatus.NONE,\n (result, file) => append(result.deleted, file) && append(result.staged, file)\n ),\n\n parser(\n PorcelainFileStatus.MODIFIED,\n PorcelainFileStatus.NONE,\n (result, file) => append(result.modified, file) && append(result.staged, file)\n ),\n parser(\n PorcelainFileStatus.MODIFIED,\n PorcelainFileStatus.MODIFIED,\n (result, file) => append(result.modified, file) && append(result.staged, file)\n ),\n\n parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.NONE, (result, file) => {\n append(result.renamed, renamedFile(file));\n }),\n parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.MODIFIED, (result, file) => {\n const renamed = renamedFile(file);\n append(result.renamed, renamed);\n append(result.modified, renamed.to);\n }),\n parser(PorcelainFileStatus.IGNORED, PorcelainFileStatus.IGNORED, (_result, _file) => {\n append((_result.ignored = _result.ignored || []), _file);\n }),\n\n parser(PorcelainFileStatus.UNTRACKED, PorcelainFileStatus.UNTRACKED, (result, file) =>\n append(result.not_added, file)\n ),\n\n ...conflicts(PorcelainFileStatus.ADDED, PorcelainFileStatus.ADDED, PorcelainFileStatus.UNMERGED),\n ...conflicts(\n PorcelainFileStatus.DELETED,\n PorcelainFileStatus.DELETED,\n PorcelainFileStatus.UNMERGED\n ),\n ...conflicts(\n PorcelainFileStatus.UNMERGED,\n PorcelainFileStatus.ADDED,\n PorcelainFileStatus.DELETED,\n PorcelainFileStatus.UNMERGED\n ),\n\n [\n '##',\n (result, line) => {\n const aheadReg = /ahead (\\d+)/;\n const behindReg = /behind (\\d+)/;\n const currentReg = /^(.+?(?=(?:\\.{3}|\\s|$)))/;\n const trackingReg = /\\.{3}(\\S*)/;\n const onEmptyBranchReg = /\\son\\s([\\S]+)$/;\n let regexResult;\n\n regexResult = aheadReg.exec(line);\n result.ahead = (regexResult && +regexResult[1]) || 0;\n\n regexResult = behindReg.exec(line);\n result.behind = (regexResult && +regexResult[1]) || 0;\n\n regexResult = currentReg.exec(line);\n result.current = regexResult && regexResult[1];\n\n regexResult = trackingReg.exec(line);\n result.tracking = regexResult && regexResult[1];\n\n regexResult = onEmptyBranchReg.exec(line);\n result.current = (regexResult && regexResult[1]) || result.current;\n\n result.detached = /\\(no branch\\)/.test(line);\n },\n ],\n]);\n\nexport const parseStatusSummary = function (text: string): StatusResult {\n const lines = text.split(NULL);\n const status = new StatusSummary();\n\n for (let i = 0, l = lines.length; i < l; ) {\n let line = lines[i++].trim();\n\n if (!line) {\n continue;\n }\n\n if (line.charAt(0) === PorcelainFileStatus.RENAMED) {\n line += NULL + (lines[i++] || '');\n }\n\n splitLine(status, line);\n }\n\n return status;\n};\n\nfunction splitLine(result: StatusResult, lineStr: string) {\n const trimmed = lineStr.trim();\n switch (' ') {\n case trimmed.charAt(2):\n return data(trimmed.charAt(0), trimmed.charAt(1), trimmed.substr(3));\n case trimmed.charAt(1):\n return data(PorcelainFileStatus.NONE, trimmed.charAt(0), trimmed.substr(2));\n default:\n return;\n }\n\n function data(index: string, workingDir: string, path: string) {\n const raw = `${index}${workingDir}`;\n const handler = parsers.get(raw);\n\n if (handler) {\n handler(result, path);\n }\n\n if (raw !== '##' && raw !== '!!') {\n result.files.push(new FileStatusSummary(path.replace(/\\0.+$/, ''), index, workingDir));\n }\n }\n}\n", "import { StatusResult } from '../../../typings';\nimport { parseStatusSummary } from '../responses/StatusSummary';\nimport { StringTask } from '../types';\n\nconst ignoredOptions = ['--null', '-z'];\n\nexport function statusTask(customArgs: string[]): StringTask {\n const commands = [\n 'status',\n '--porcelain',\n '-b',\n '-u',\n '--null',\n ...customArgs.filter((arg) => !ignoredOptions.includes(arg)),\n ];\n\n return {\n format: 'utf-8',\n commands,\n parser(text: string) {\n return parseStatusSummary(text);\n },\n };\n}\n", "import type { SimpleGitApi } from '../simple-git-api';\nimport type { SimpleGit } from '../../../typings';\nimport { asNumber, ExitCodes, LineParser, parseStringResponse } from '../utils';\n\nexport interface VersionResult {\n major: number;\n minor: number;\n patch: number | string;\n agent: string;\n installed: boolean;\n}\n\nconst NOT_INSTALLED = 'installed=false';\n\nfunction versionResponse(\n major = 0,\n minor = 0,\n patch: string | number = 0,\n agent = '',\n installed = true\n): VersionResult {\n return Object.defineProperty(\n {\n major,\n minor,\n patch,\n agent,\n installed,\n },\n 'toString',\n {\n value() {\n return `${this.major}.${this.minor}.${this.patch}`;\n },\n configurable: false,\n enumerable: false,\n }\n );\n}\n\nfunction notInstalledResponse() {\n return versionResponse(0, 0, 0, '', false);\n}\n\nexport default function (): Pick {\n return {\n version(this: SimpleGitApi) {\n return this._runTask({\n commands: ['--version'],\n format: 'utf-8',\n parser: versionParser,\n onError(result, error, done, fail) {\n if (result.exitCode === ExitCodes.NOT_FOUND) {\n return done(Buffer.from(NOT_INSTALLED));\n }\n\n fail(error);\n },\n });\n },\n };\n}\n\nconst parsers: LineParser[] = [\n new LineParser(\n /version (\\d+)\\.(\\d+)\\.(\\d+)(?:\\s*\\((.+)\\))?/,\n (result, [major, minor, patch, agent = '']) => {\n Object.assign(\n result,\n versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)\n );\n }\n ),\n new LineParser(\n /version (\\d+)\\.(\\d+)\\.(\\D+)(.+)?$/,\n (result, [major, minor, patch, agent = '']) => {\n Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));\n }\n ),\n];\n\nfunction versionParser(stdOut: string) {\n if (stdOut === NOT_INSTALLED) {\n return notInstalledResponse();\n }\n\n return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers, stdOut);\n}\n", "import { SimpleGitBase } from '../../typings';\nimport { taskCallback } from './task-callback';\nimport { changeWorkingDirectoryTask } from './tasks/change-working-directory';\nimport checkout from './tasks/checkout';\nimport commit from './tasks/commit';\nimport config from './tasks/config';\nimport firstCommit from './tasks/first-commit';\nimport grep from './tasks/grep';\nimport { hashObjectTask } from './tasks/hash-object';\nimport { initTask } from './tasks/init';\nimport log from './tasks/log';\nimport { mergeTask } from './tasks/merge';\nimport { pushTask } from './tasks/push';\nimport show from './tasks/show';\nimport { statusTask } from './tasks/status';\nimport { configurationErrorTask, straightThroughStringTask } from './tasks/task';\nimport version from './tasks/version';\nimport { outputHandler, SimpleGitExecutor, SimpleGitTask, SimpleGitTaskCallback } from './types';\nimport {\n asArray,\n filterString,\n filterType,\n getTrailingOptions,\n trailingFunctionArgument,\n} from './utils';\n\nexport class SimpleGitApi implements SimpleGitBase {\n constructor(private _executor: SimpleGitExecutor) {}\n\n protected _runTask(task: SimpleGitTask, then?: SimpleGitTaskCallback) {\n const chain = this._executor.chain();\n const promise = chain.push(task);\n\n if (then) {\n taskCallback(task, promise, then);\n }\n\n return Object.create(this, {\n then: { value: promise.then.bind(promise) },\n catch: { value: promise.catch.bind(promise) },\n _executor: { value: chain },\n });\n }\n\n add(files: string | string[]) {\n return this._runTask(\n straightThroughStringTask(['add', ...asArray(files)]),\n trailingFunctionArgument(arguments)\n );\n }\n\n cwd(directory: string | { path: string; root?: boolean }) {\n const next = trailingFunctionArgument(arguments);\n\n if (typeof directory === 'string') {\n return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);\n }\n\n if (typeof directory?.path === 'string') {\n return this._runTask(\n changeWorkingDirectoryTask(\n directory.path,\n (directory.root && this._executor) || undefined\n ),\n next\n );\n }\n\n return this._runTask(\n configurationErrorTask('Git.cwd: workingDirectory must be supplied as a string'),\n next\n );\n }\n\n hashObject(path: string, write: boolean | unknown) {\n return this._runTask(\n hashObjectTask(path, write === true),\n trailingFunctionArgument(arguments)\n );\n }\n\n init(bare?: boolean | unknown) {\n return this._runTask(\n initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n\n merge() {\n return this._runTask(\n mergeTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n\n mergeFromTo(remote: string, branch: string) {\n if (!(filterString(remote) && filterString(branch))) {\n return this._runTask(\n configurationErrorTask(\n `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`\n )\n );\n }\n\n return this._runTask(\n mergeTask([remote, branch, ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments, false)\n );\n }\n\n outputHandler(handler: outputHandler) {\n this._executor.outputHandler = handler;\n return this;\n }\n\n push() {\n const task = pushTask(\n {\n remote: filterType(arguments[0], filterString),\n branch: filterType(arguments[1], filterString),\n },\n getTrailingOptions(arguments)\n );\n\n return this._runTask(task, trailingFunctionArgument(arguments));\n }\n\n stash() {\n return this._runTask(\n straightThroughStringTask(['stash', ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n }\n\n status() {\n return this._runTask(\n statusTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n }\n}\n\nObject.assign(\n SimpleGitApi.prototype,\n checkout(),\n commit(),\n config(),\n firstCommit(),\n grep(),\n log(),\n show(),\n version()\n);\n", "import { append, remove } from '../utils';\nimport { createDeferred, DeferredPromise } from '@kwsites/promise-deferred';\nimport { createLogger } from '../git-logger';\n\ntype ScheduleCompleteCallback = () => void;\ntype ScheduledTask = Pick, 'promise' | 'done'> & {\n id: number;\n};\n\nconst createScheduledTask: () => ScheduledTask = (() => {\n let id = 0;\n return () => {\n id++;\n const { promise, done } = createDeferred();\n\n return {\n promise,\n done,\n id,\n };\n };\n})();\n\nexport class Scheduler {\n private logger = createLogger('', 'scheduler');\n private pending: ScheduledTask[] = [];\n private running: ScheduledTask[] = [];\n\n constructor(private concurrency = 2) {\n this.logger(`Constructed, concurrency=%s`, concurrency);\n }\n\n private schedule() {\n if (!this.pending.length || this.running.length >= this.concurrency) {\n this.logger(\n `Schedule attempt ignored, pending=%s running=%s concurrency=%s`,\n this.pending.length,\n this.running.length,\n this.concurrency\n );\n return;\n }\n\n const task = append(this.running, this.pending.shift()!);\n this.logger(`Attempting id=%s`, task.id);\n task.done(() => {\n this.logger(`Completing id=`, task.id);\n remove(this.running, task);\n this.schedule();\n });\n }\n\n next(): Promise {\n const { promise, id } = append(this.pending, createScheduledTask());\n this.logger(`Scheduling id=%s`, id);\n\n this.schedule();\n\n return promise;\n }\n}\n", "import { straightThroughStringTask } from './task';\nimport { OptionFlags, Options, StringTask } from '../types';\n\nexport type ApplyOptions = Options &\n OptionFlags<\n | '--stat'\n | '--numstat'\n | '--summary'\n | '--check'\n | '--index'\n | '--intent-to-add'\n | '--3way'\n | '--apply'\n | '--no-add'\n | '-R'\n | '--reverse'\n | '--allow-binary-replacement'\n | '--binary'\n | '--reject'\n | '-z'\n | '--inaccurate-eof'\n | '--recount'\n | '--cached'\n | '--ignore-space-change'\n | '--ignore-whitespace'\n | '--verbose'\n | '--unsafe-paths'\n > &\n OptionFlags<'--whitespace', 'nowarn' | 'warn' | 'fix' | 'error' | 'error-all'> &\n OptionFlags<'--build-fake-ancestor' | '--exclude' | '--include' | '--directory', string> &\n OptionFlags<'-p' | '-C', number>;\n\nexport function applyPatchTask(patches: string[], customArgs: string[]): StringTask {\n return straightThroughStringTask(['apply', ...customArgs, ...patches]);\n}\n", "import {\n BranchMultiDeleteResult,\n BranchSingleDeleteFailure,\n BranchSingleDeleteResult,\n BranchSingleDeleteSuccess,\n} from '../../../typings';\n\nexport class BranchDeletionBatch implements BranchMultiDeleteResult {\n all: BranchSingleDeleteResult[] = [];\n branches: { [branchName: string]: BranchSingleDeleteResult } = {};\n errors: BranchSingleDeleteResult[] = [];\n\n get success(): boolean {\n return !this.errors.length;\n }\n}\n\nexport function branchDeletionSuccess(branch: string, hash: string): BranchSingleDeleteSuccess {\n return {\n branch,\n hash,\n success: true,\n };\n}\n\nexport function branchDeletionFailure(branch: string): BranchSingleDeleteFailure {\n return {\n branch,\n hash: null,\n success: false,\n };\n}\n\nexport function isSingleBranchDeleteFailure(\n test: BranchSingleDeleteResult\n): test is BranchSingleDeleteSuccess {\n return test.success;\n}\n", "import { BranchMultiDeleteResult } from '../../../typings';\nimport {\n BranchDeletionBatch,\n branchDeletionFailure,\n branchDeletionSuccess,\n} from '../responses/BranchDeleteSummary';\nimport { TaskParser } from '../types';\nimport { ExitCodes, LineParser, parseStringResponse } from '../utils';\n\nconst deleteSuccessRegex = /(\\S+)\\s+\\(\\S+\\s([^)]+)\\)/;\nconst deleteErrorRegex = /^error[^']+'([^']+)'/m;\n\nconst parsers: LineParser[] = [\n new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {\n const deletion = branchDeletionSuccess(branch, hash);\n\n result.all.push(deletion);\n result.branches[branch] = deletion;\n }),\n new LineParser(deleteErrorRegex, (result, [branch]) => {\n const deletion = branchDeletionFailure(branch);\n\n result.errors.push(deletion);\n result.all.push(deletion);\n result.branches[branch] = deletion;\n }),\n];\n\nexport const parseBranchDeletions: TaskParser = (\n stdOut,\n stdErr\n) => {\n return parseStringResponse(new BranchDeletionBatch(), parsers, [stdOut, stdErr]);\n};\n\nexport function hasBranchDeletionError(data: string, processExitCode: ExitCodes): boolean {\n return processExitCode === ExitCodes.ERROR && deleteErrorRegex.test(data);\n}\n", "import type { BranchSummary, BranchSummaryBranch } from '../../../typings';\n\nexport enum BranchStatusIdentifier {\n CURRENT = '*',\n LINKED = '+',\n}\n\nexport class BranchSummaryResult implements BranchSummary {\n public all: string[] = [];\n public branches: { [p: string]: BranchSummaryBranch } = {};\n public current: string = '';\n public detached: boolean = false;\n\n push(\n status: BranchStatusIdentifier | unknown,\n detached: boolean,\n name: string,\n commit: string,\n label: string\n ) {\n if (status === BranchStatusIdentifier.CURRENT) {\n this.detached = detached;\n this.current = name;\n }\n\n this.all.push(name);\n this.branches[name] = {\n current: status === BranchStatusIdentifier.CURRENT,\n linkedWorkTree: status === BranchStatusIdentifier.LINKED,\n name,\n commit,\n label,\n };\n }\n}\n", "import type { BranchSummary } from '../../../typings';\nimport { BranchSummaryResult } from '../responses/BranchSummary';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser[] = [\n new LineParser(\n /^([*+]\\s)?\\((?:HEAD )?detached (?:from|at) (\\S+)\\)\\s+([a-z0-9]+)\\s(.*)$/,\n (result, [current, name, commit, label]) => {\n result.push(branchStatus(current), true, name, commit, label);\n }\n ),\n new LineParser(\n /^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$/s,\n (result, [current, name, commit, label]) => {\n result.push(branchStatus(current), false, name, commit, label);\n }\n ),\n];\n\nfunction branchStatus(input?: string) {\n return input ? input.charAt(0) : '';\n}\n\nexport function parseBranchSummary(stdOut: string): BranchSummary {\n return parseStringResponse(new BranchSummaryResult(), parsers, stdOut);\n}\n", "import { BranchMultiDeleteResult, BranchSingleDeleteResult, BranchSummary } from '../../../typings';\nimport { StringTask } from '../types';\nimport { GitResponseError } from '../errors/git-response-error';\nimport { hasBranchDeletionError, parseBranchDeletions } from '../parsers/parse-branch-delete';\nimport { parseBranchSummary } from '../parsers/parse-branch';\nimport { bufferToString } from '../utils';\n\nexport function containsDeleteBranchCommand(commands: string[]) {\n const deleteCommands = ['-d', '-D', '--delete'];\n return commands.some((command) => deleteCommands.includes(command));\n}\n\nexport function branchTask(\n customArgs: string[]\n): StringTask {\n const isDelete = containsDeleteBranchCommand(customArgs);\n const commands = ['branch', ...customArgs];\n\n if (commands.length === 1) {\n commands.push('-a');\n }\n\n if (!commands.includes('-v')) {\n commands.splice(1, 0, '-v');\n }\n\n return {\n format: 'utf-8',\n commands,\n parser(stdOut, stdErr) {\n if (isDelete) {\n return parseBranchDeletions(stdOut, stdErr).all[0];\n }\n\n return parseBranchSummary(stdOut);\n },\n };\n}\n\nexport function branchLocalTask(): StringTask {\n const parser = parseBranchSummary;\n\n return {\n format: 'utf-8',\n commands: ['branch', '-v'],\n parser,\n };\n}\n\nexport function deleteBranchesTask(\n branches: string[],\n forceDelete = false\n): StringTask {\n return {\n format: 'utf-8',\n commands: ['branch', '-v', forceDelete ? '-D' : '-d', ...branches],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr);\n },\n onError({ exitCode, stdOut }, error, done, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n\n done(stdOut);\n },\n };\n}\n\nexport function deleteBranchTask(\n branch: string,\n forceDelete = false\n): StringTask {\n const task: StringTask = {\n format: 'utf-8',\n commands: ['branch', '-v', forceDelete ? '-D' : '-d', branch],\n parser(stdOut, stdErr) {\n return parseBranchDeletions(stdOut, stdErr).branches[branch]!;\n },\n onError({ exitCode, stdErr, stdOut }, error, _, fail) {\n if (!hasBranchDeletionError(String(error), exitCode)) {\n return fail(error);\n }\n\n throw new GitResponseError(\n task.parser(bufferToString(stdOut), bufferToString(stdErr)),\n String(error)\n );\n },\n };\n\n return task;\n}\n", "/**\n * Parser for the `check-ignore` command - returns each file as a string array\n */\nexport const parseCheckIgnore = (text: string): string[] => {\n return text\n .split(/\\n/g)\n .map((line) => line.trim())\n .filter((file) => !!file);\n};\n", "import { StringTask } from '../types';\nimport { parseCheckIgnore } from '../responses/CheckIgnore';\n\nexport function checkIgnoreTask(paths: string[]): StringTask {\n return {\n commands: ['check-ignore', ...paths],\n format: 'utf-8',\n parser: parseCheckIgnore,\n };\n}\n", "import { configurationErrorTask, EmptyTask, straightThroughStringTask } from './task';\nimport { OptionFlags, Options, StringTask } from '../types';\nimport { append, filterString } from '../utils';\n\nexport type CloneOptions = Options &\n OptionFlags<\n | '--bare'\n | '--dissociate'\n | '--mirror'\n | '--no-checkout'\n | '--no-remote-submodules'\n | '--no-shallow-submodules'\n | '--no-single-branch'\n | '--no-tags'\n | '--remote-submodules'\n | '--single-branch'\n | '--shallow-submodules'\n | '--verbose'\n > &\n OptionFlags<'--depth' | '-j' | '--jobs', number> &\n OptionFlags<\n | '--branch'\n | '--origin'\n | '--recurse-submodules'\n | '--separate-git-dir'\n | '--shallow-exclude'\n | '--shallow-since'\n | '--template',\n string\n >;\n\nfunction disallowedCommand(command: string) {\n return /^--upload-pack(=|$)/.test(command);\n}\n\nexport function cloneTask(\n repo: string | undefined,\n directory: string | undefined,\n customArgs: string[]\n): StringTask | EmptyTask {\n const commands = ['clone', ...customArgs];\n\n filterString(repo) && commands.push(repo);\n filterString(directory) && commands.push(directory);\n\n const banned = commands.find(disallowedCommand);\n if (banned) {\n return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function cloneMirrorTask(\n repo: string | undefined,\n directory: string | undefined,\n customArgs: string[]\n) {\n append(customArgs, '--mirror');\n\n return cloneTask(repo, directory, customArgs);\n}\n", "import { FetchResult } from '../../../typings';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser[] = [\n new LineParser(/From (.+)$/, (result, [remote]) => {\n result.remote = remote;\n }),\n new LineParser(/\\* \\[new branch]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) => {\n result.branches.push({\n name,\n tracking,\n });\n }),\n new LineParser(/\\* \\[new tag]\\s+(\\S+)\\s*-> (.+)$/, (result, [name, tracking]) => {\n result.tags.push({\n name,\n tracking,\n });\n }),\n new LineParser(/- \\[deleted]\\s+\\S+\\s*-> (.+)$/, (result, [tracking]) => {\n result.deleted.push({\n tracking,\n });\n }),\n new LineParser(\n /\\s*([^.]+)\\.\\.(\\S+)\\s+(\\S+)\\s*-> (.+)$/,\n (result, [from, to, name, tracking]) => {\n result.updated.push({\n name,\n tracking,\n to,\n from,\n });\n }\n ),\n];\n\nexport function parseFetchResult(stdOut: string, stdErr: string): FetchResult {\n const result: FetchResult = {\n raw: stdOut,\n remote: null,\n branches: [],\n tags: [],\n updated: [],\n deleted: [],\n };\n return parseStringResponse(result, parsers, [stdOut, stdErr]);\n}\n", "import { FetchResult } from '../../../typings';\nimport { parseFetchResult } from '../parsers/parse-fetch';\nimport { StringTask } from '../types';\n\nimport { configurationErrorTask, EmptyTask } from './task';\n\nfunction disallowedCommand(command: string) {\n return /^--upload-pack(=|$)/.test(command);\n}\n\nexport function fetchTask(\n remote: string,\n branch: string,\n customArgs: string[]\n): StringTask | EmptyTask {\n const commands = ['fetch', ...customArgs];\n if (remote && branch) {\n commands.push(remote, branch);\n }\n\n const banned = commands.find(disallowedCommand);\n if (banned) {\n return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser: parseFetchResult,\n };\n}\n", "import { MoveResult } from '../../../typings';\nimport { LineParser, parseStringResponse } from '../utils';\n\nconst parsers: LineParser[] = [\n new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {\n result.moves.push({ from, to });\n }),\n];\n\nexport function parseMoveResult(stdOut: string): MoveResult {\n return parseStringResponse({ moves: [] }, parsers, stdOut);\n}\n", "import { MoveResult } from '../../../typings';\nimport { parseMoveResult } from '../parsers/parse-move';\nimport { StringTask } from '../types';\nimport { asArray } from '../utils';\n\nexport function moveTask(from: string | string[], to: string): StringTask {\n return {\n commands: ['mv', '-v', ...asArray(from), to],\n format: 'utf-8',\n parser: parseMoveResult,\n };\n}\n", "import { PullResult } from '../../../typings';\nimport { GitResponseError } from '../errors/git-response-error';\nimport { parsePullErrorResult, parsePullResult } from '../parsers/parse-pull';\nimport { Maybe, StringTask } from '../types';\nimport { bufferToString } from '../utils';\n\nexport function pullTask(\n remote: Maybe,\n branch: Maybe,\n customArgs: string[]\n): StringTask {\n const commands: string[] = ['pull', ...customArgs];\n if (remote && branch) {\n commands.splice(1, 0, remote, branch);\n }\n\n return {\n commands,\n format: 'utf-8',\n parser(stdOut, stdErr): PullResult {\n return parsePullResult(stdOut, stdErr);\n },\n onError(result, _error, _done, fail) {\n const pullError = parsePullErrorResult(\n bufferToString(result.stdOut),\n bufferToString(result.stdErr)\n );\n if (pullError) {\n return fail(new GitResponseError(pullError));\n }\n\n fail(_error);\n },\n };\n}\n", "import { forEachLineWithContent } from '../utils';\n\nexport interface RemoteWithoutRefs {\n name: string;\n}\n\nexport interface RemoteWithRefs extends RemoteWithoutRefs {\n refs: {\n fetch: string;\n push: string;\n };\n}\n\nexport function parseGetRemotes(text: string): RemoteWithoutRefs[] {\n const remotes: { [name: string]: RemoteWithoutRefs } = {};\n\n forEach(text, ([name]) => (remotes[name] = { name }));\n\n return Object.values(remotes);\n}\n\nexport function parseGetRemotesVerbose(text: string): RemoteWithRefs[] {\n const remotes: { [name: string]: RemoteWithRefs } = {};\n\n forEach(text, ([name, url, purpose]) => {\n if (!remotes.hasOwnProperty(name)) {\n remotes[name] = {\n name: name,\n refs: { fetch: '', push: '' },\n };\n }\n\n if (purpose && url) {\n remotes[name].refs[purpose.replace(/[^a-z]/g, '') as keyof RemoteWithRefs['refs']] = url;\n }\n });\n\n return Object.values(remotes);\n}\n\nfunction forEach(text: string, handler: (line: string[]) => void) {\n forEachLineWithContent(text, (line) => handler(line.split(/\\s+/)));\n}\n", "import { parseGetRemotes, parseGetRemotesVerbose } from '../responses/GetRemoteSummary';\nimport { StringTask } from '../types';\nimport { straightThroughStringTask } from './task';\n\nexport function addRemoteTask(\n remoteName: string,\n remoteRepo: string,\n customArgs: string[]\n): StringTask {\n return straightThroughStringTask(['remote', 'add', ...customArgs, remoteName, remoteRepo]);\n}\n\nexport function getRemotesTask(verbose: boolean): StringTask {\n const commands = ['remote'];\n if (verbose) {\n commands.push('-v');\n }\n\n return {\n commands,\n format: 'utf-8',\n parser: verbose ? parseGetRemotesVerbose : parseGetRemotes,\n };\n}\n\nexport function listRemotesTask(customArgs: string[]): StringTask {\n const commands = [...customArgs];\n if (commands[0] !== 'ls-remote') {\n commands.unshift('ls-remote');\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function remoteTask(customArgs: string[]): StringTask {\n const commands = [...customArgs];\n if (commands[0] !== 'remote') {\n commands.unshift('remote');\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function removeRemoteTask(remoteName: string) {\n return straightThroughStringTask(['remote', 'remove', remoteName]);\n}\n", "import { LogOptions, LogResult } from '../../../typings';\nimport { logFormatFromCommand } from '../args/log-format';\nimport { createListLogSummaryParser } from '../parsers/parse-list-log-summary';\nimport type { StringTask } from '../types';\nimport { validateLogFormatConfig } from './diff';\nimport { parseLogOptions } from './log';\nimport type { EmptyTask } from './task';\n\nexport function stashListTask(\n opt: LogOptions = {},\n customArgs: string[]\n): EmptyTask | StringTask {\n const options = parseLogOptions(opt);\n const commands = ['stash', 'list', ...options.commands, ...customArgs];\n const parser = createListLogSummaryParser(\n options.splitter,\n options.fields,\n logFormatFromCommand(commands)\n );\n\n return (\n validateLogFormatConfig(commands) || {\n commands,\n format: 'utf-8',\n parser,\n }\n );\n}\n", "import { StringTask } from '../types';\nimport { straightThroughStringTask } from './task';\n\nexport function addSubModuleTask(repo: string, path: string): StringTask {\n return subModuleTask(['add', repo, path]);\n}\n\nexport function initSubModuleTask(customArgs: string[]): StringTask {\n return subModuleTask(['init', ...customArgs]);\n}\n\nexport function subModuleTask(customArgs: string[]): StringTask {\n const commands = [...customArgs];\n if (commands[0] !== 'submodule') {\n commands.unshift('submodule');\n }\n\n return straightThroughStringTask(commands);\n}\n\nexport function updateSubModuleTask(customArgs: string[]): StringTask {\n return subModuleTask(['update', ...customArgs]);\n}\n", "import { TagResult } from '../../../typings';\n\nexport class TagList implements TagResult {\n constructor(\n public readonly all: string[],\n public readonly latest: string | undefined\n ) {}\n}\n\nexport const parseTagList = function (data: string, customSort = false) {\n const tags = data.split('\\n').map(trimmed).filter(Boolean);\n\n if (!customSort) {\n tags.sort(function (tagA, tagB) {\n const partsA = tagA.split('.');\n const partsB = tagB.split('.');\n\n if (partsA.length === 1 || partsB.length === 1) {\n return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));\n }\n\n for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {\n const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));\n\n if (diff) {\n return diff;\n }\n }\n\n return 0;\n });\n }\n\n const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf('.') >= 0);\n\n return new TagList(tags, latest);\n};\n\nfunction singleSorted(a: number, b: number): number {\n const aIsNum = isNaN(a);\n const bIsNum = isNaN(b);\n\n if (aIsNum !== bIsNum) {\n return aIsNum ? 1 : -1;\n }\n\n return aIsNum ? sorted(a, b) : 0;\n}\n\nfunction sorted(a: number, b: number) {\n return a === b ? 0 : a > b ? 1 : -1;\n}\n\nfunction trimmed(input: string) {\n return input.trim();\n}\n\nfunction toNumber(input: string | undefined) {\n if (typeof input === 'string') {\n return parseInt(input.replace(/^\\D+/g, ''), 10) || 0;\n }\n\n return 0;\n}\n", "import { TagResult } from '../../../typings';\nimport { parseTagList } from '../responses/TagList';\nimport { StringTask } from '../types';\n\n/**\n * Task used by `git.tags`\n */\nexport function tagListTask(customArgs: string[] = []): StringTask {\n const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));\n\n return {\n format: 'utf-8',\n commands: ['tag', '-l', ...customArgs],\n parser(text: string) {\n return parseTagList(text, hasCustomSort);\n },\n };\n}\n\n/**\n * Task used by `git.addTag`\n */\nexport function addTagTask(name: string): StringTask<{ name: string }> {\n return {\n format: 'utf-8',\n commands: ['tag', name],\n parser() {\n return { name };\n },\n };\n}\n\n/**\n * Task used by `git.addTag`\n */\nexport function addAnnotatedTagTask(\n name: string,\n tagMessage: string\n): StringTask<{ name: string }> {\n return {\n format: 'utf-8',\n commands: ['tag', '-a', '-m', tagMessage, name],\n parser() {\n return { name };\n },\n };\n}\n", "const { GitExecutor } = require('./lib/runners/git-executor');\nconst { SimpleGitApi } = require('./lib/simple-git-api');\n\nconst { Scheduler } = require('./lib/runners/scheduler');\nconst { configurationErrorTask } = require('./lib/tasks/task');\nconst {\n asArray,\n filterArray,\n filterPrimitives,\n filterString,\n filterStringOrStringArray,\n filterType,\n getTrailingOptions,\n trailingFunctionArgument,\n trailingOptionsArgument,\n} = require('./lib/utils');\nconst { applyPatchTask } = require('./lib/tasks/apply-patch');\nconst {\n branchTask,\n branchLocalTask,\n deleteBranchesTask,\n deleteBranchTask,\n} = require('./lib/tasks/branch');\nconst { checkIgnoreTask } = require('./lib/tasks/check-ignore');\nconst { checkIsRepoTask } = require('./lib/tasks/check-is-repo');\nconst { cloneTask, cloneMirrorTask } = require('./lib/tasks/clone');\nconst { cleanWithOptionsTask, isCleanOptionsArray } = require('./lib/tasks/clean');\nconst { diffSummaryTask } = require('./lib/tasks/diff');\nconst { fetchTask } = require('./lib/tasks/fetch');\nconst { moveTask } = require('./lib/tasks/move');\nconst { pullTask } = require('./lib/tasks/pull');\nconst { pushTagsTask } = require('./lib/tasks/push');\nconst {\n addRemoteTask,\n getRemotesTask,\n listRemotesTask,\n remoteTask,\n removeRemoteTask,\n} = require('./lib/tasks/remote');\nconst { getResetMode, resetTask } = require('./lib/tasks/reset');\nconst { stashListTask } = require('./lib/tasks/stash-list');\nconst {\n addSubModuleTask,\n initSubModuleTask,\n subModuleTask,\n updateSubModuleTask,\n} = require('./lib/tasks/sub-module');\nconst { addAnnotatedTagTask, addTagTask, tagListTask } = require('./lib/tasks/tag');\nconst { straightThroughBufferTask, straightThroughStringTask } = require('./lib/tasks/task');\n\nfunction Git(options, plugins) {\n this._plugins = plugins;\n this._executor = new GitExecutor(\n options.baseDir,\n new Scheduler(options.maxConcurrentProcesses),\n plugins\n );\n\n this._trimmed = options.trimmed;\n}\n\n(Git.prototype = Object.create(SimpleGitApi.prototype)).constructor = Git;\n\n/**\n * Sets the path to a custom git binary, should either be `git` when there is an installation of git available on\n * the system path, or a fully qualified path to the executable.\n */\nGit.prototype.customBinary = function (command) {\n this._plugins.reconfigure('binary', command);\n return this;\n};\n\n/**\n * Sets an environment variable for the spawned child process, either supply both a name and value as strings or\n * a single object to entirely replace the current environment variables.\n *\n * @param {string|Object} name\n * @param {string} [value]\n * @returns {Git}\n */\nGit.prototype.env = function (name, value) {\n if (arguments.length === 1 && typeof name === 'object') {\n this._executor.env = name;\n } else {\n (this._executor.env = this._executor.env || {})[name] = value;\n }\n\n return this;\n};\n\n/**\n * List the stash(s) of the local repo\n */\nGit.prototype.stashList = function (options) {\n return this._runTask(\n stashListTask(\n trailingOptionsArgument(arguments) || {},\n (filterArray(options) && options) || []\n ),\n trailingFunctionArgument(arguments)\n );\n};\n\nfunction createCloneTask(api, task, repoPath, localPath) {\n if (typeof repoPath !== 'string') {\n return configurationErrorTask(`git.${api}() requires a string 'repoPath'`);\n }\n\n return task(repoPath, filterType(localPath, filterString), getTrailingOptions(arguments));\n}\n\n/**\n * Clone a git repo\n */\nGit.prototype.clone = function () {\n return this._runTask(\n createCloneTask('clone', cloneTask, ...arguments),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Mirror a git repo\n */\nGit.prototype.mirror = function () {\n return this._runTask(\n createCloneTask('mirror', cloneMirrorTask, ...arguments),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Moves one or more files to a new destination.\n *\n * @see https://git-scm.com/docs/git-mv\n *\n * @param {string|string[]} from\n * @param {string} to\n */\nGit.prototype.mv = function (from, to) {\n return this._runTask(moveTask(from, to), trailingFunctionArgument(arguments));\n};\n\n/**\n * Internally uses pull and tags to get the list of tags then checks out the latest tag.\n *\n * @param {Function} [then]\n */\nGit.prototype.checkoutLatestTag = function (then) {\n var git = this;\n return this.pull(function () {\n git.tags(function (err, tags) {\n git.checkout(tags.latest, then);\n });\n });\n};\n\n/**\n * Pull the updated contents of the current repo\n */\nGit.prototype.pull = function (remote, branch, options, then) {\n return this._runTask(\n pullTask(\n filterType(remote, filterString),\n filterType(branch, filterString),\n getTrailingOptions(arguments)\n ),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Fetch the updated contents of the current repo.\n *\n * @example\n * .fetch('upstream', 'master') // fetches from master on remote named upstream\n * .fetch(function () {}) // runs fetch against default remote and branch and calls function\n *\n * @param {string} [remote]\n * @param {string} [branch]\n */\nGit.prototype.fetch = function (remote, branch) {\n return this._runTask(\n fetchTask(\n filterType(remote, filterString),\n filterType(branch, filterString),\n getTrailingOptions(arguments)\n ),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Disables/enables the use of the console for printing warnings and errors, by default messages are not shown in\n * a production environment.\n *\n * @param {boolean} silence\n * @returns {Git}\n */\nGit.prototype.silent = function (silence) {\n console.warn(\n 'simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3'\n );\n return this;\n};\n\n/**\n * List all tags. When using git 2.7.0 or above, include an options object with `\"--sort\": \"property-name\"` to\n * sort the tags by that property instead of using the default semantic versioning sort.\n *\n * Note, supplying this option when it is not supported by your Git version will cause the operation to fail.\n *\n * @param {Object} [options]\n * @param {Function} [then]\n */\nGit.prototype.tags = function (options, then) {\n return this._runTask(\n tagListTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Rebases the current working copy. Options can be supplied either as an array of string parameters\n * to be sent to the `git rebase` command, or a standard options object.\n */\nGit.prototype.rebase = function () {\n return this._runTask(\n straightThroughStringTask(['rebase', ...getTrailingOptions(arguments)]),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Reset a repo\n */\nGit.prototype.reset = function (mode) {\n return this._runTask(\n resetTask(getResetMode(mode), getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Revert one or more commits in the local working copy\n */\nGit.prototype.revert = function (commit) {\n const next = trailingFunctionArgument(arguments);\n\n if (typeof commit !== 'string') {\n return this._runTask(configurationErrorTask('Commit must be a string'), next);\n }\n\n return this._runTask(\n straightThroughStringTask(['revert', ...getTrailingOptions(arguments, 0, true), commit]),\n next\n );\n};\n\n/**\n * Add a lightweight tag to the head of the current branch\n */\nGit.prototype.addTag = function (name) {\n const task =\n typeof name === 'string'\n ? addTagTask(name)\n : configurationErrorTask('Git.addTag requires a tag name');\n\n return this._runTask(task, trailingFunctionArgument(arguments));\n};\n\n/**\n * Add an annotated tag to the head of the current branch\n */\nGit.prototype.addAnnotatedTag = function (tagName, tagMessage) {\n return this._runTask(\n addAnnotatedTagTask(tagName, tagMessage),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Delete a local branch\n */\nGit.prototype.deleteLocalBranch = function (branchName, forceDelete, then) {\n return this._runTask(\n deleteBranchTask(branchName, typeof forceDelete === 'boolean' ? forceDelete : false),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Delete one or more local branches\n */\nGit.prototype.deleteLocalBranches = function (branchNames, forceDelete, then) {\n return this._runTask(\n deleteBranchesTask(branchNames, typeof forceDelete === 'boolean' ? forceDelete : false),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * List all branches\n *\n * @param {Object | string[]} [options]\n * @param {Function} [then]\n */\nGit.prototype.branch = function (options, then) {\n return this._runTask(\n branchTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Return list of local branches\n *\n * @param {Function} [then]\n */\nGit.prototype.branchLocal = function (then) {\n return this._runTask(branchLocalTask(), trailingFunctionArgument(arguments));\n};\n\n/**\n * Executes any command against the git binary.\n */\nGit.prototype.raw = function (commands) {\n const createRestCommands = !Array.isArray(commands);\n const command = [].slice.call(createRestCommands ? arguments : commands, 0);\n\n for (let i = 0; i < command.length && createRestCommands; i++) {\n if (!filterPrimitives(command[i])) {\n command.splice(i, command.length - i);\n break;\n }\n }\n\n command.push(...getTrailingOptions(arguments, 0, true));\n\n var next = trailingFunctionArgument(arguments);\n\n if (!command.length) {\n return this._runTask(\n configurationErrorTask('Raw: must supply one or more command to execute'),\n next\n );\n }\n\n return this._runTask(straightThroughStringTask(command, this._trimmed), next);\n};\n\nGit.prototype.submoduleAdd = function (repo, path, then) {\n return this._runTask(addSubModuleTask(repo, path), trailingFunctionArgument(arguments));\n};\n\nGit.prototype.submoduleUpdate = function (args, then) {\n return this._runTask(\n updateSubModuleTask(getTrailingOptions(arguments, true)),\n trailingFunctionArgument(arguments)\n );\n};\n\nGit.prototype.submoduleInit = function (args, then) {\n return this._runTask(\n initSubModuleTask(getTrailingOptions(arguments, true)),\n trailingFunctionArgument(arguments)\n );\n};\n\nGit.prototype.subModule = function (options, then) {\n return this._runTask(\n subModuleTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n};\n\nGit.prototype.listRemote = function () {\n return this._runTask(\n listRemotesTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Adds a remote to the list of remotes.\n */\nGit.prototype.addRemote = function (remoteName, remoteRepo, then) {\n return this._runTask(\n addRemoteTask(remoteName, remoteRepo, getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Removes an entry by name from the list of remotes.\n */\nGit.prototype.removeRemote = function (remoteName, then) {\n return this._runTask(removeRemoteTask(remoteName), trailingFunctionArgument(arguments));\n};\n\n/**\n * Gets the currently available remotes, setting the optional verbose argument to true includes additional\n * detail on the remotes themselves.\n */\nGit.prototype.getRemotes = function (verbose, then) {\n return this._runTask(getRemotesTask(verbose === true), trailingFunctionArgument(arguments));\n};\n\n/**\n * Call any `git remote` function with arguments passed as an array of strings.\n *\n * @param {string[]} options\n * @param {Function} [then]\n */\nGit.prototype.remote = function (options, then) {\n return this._runTask(\n remoteTask(getTrailingOptions(arguments)),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Call any `git tag` function with arguments passed as an array of strings.\n *\n * @param {string[]} options\n * @param {Function} [then]\n */\nGit.prototype.tag = function (options, then) {\n const command = getTrailingOptions(arguments);\n\n if (command[0] !== 'tag') {\n command.unshift('tag');\n }\n\n return this._runTask(straightThroughStringTask(command), trailingFunctionArgument(arguments));\n};\n\n/**\n * Updates repository server info\n *\n * @param {Function} [then]\n */\nGit.prototype.updateServerInfo = function (then) {\n return this._runTask(\n straightThroughStringTask(['update-server-info']),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Pushes the current tag changes to a remote which can be either a URL or named remote. When not specified uses the\n * default configured remote spec.\n *\n * @param {string} [remote]\n * @param {Function} [then]\n */\nGit.prototype.pushTags = function (remote, then) {\n const task = pushTagsTask(\n { remote: filterType(remote, filterString) },\n getTrailingOptions(arguments)\n );\n\n return this._runTask(task, trailingFunctionArgument(arguments));\n};\n\n/**\n * Removes the named files from source control.\n */\nGit.prototype.rm = function (files) {\n return this._runTask(\n straightThroughStringTask(['rm', '-f', ...asArray(files)]),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Removes the named files from source control but keeps them on disk rather than deleting them entirely. To\n * completely remove the files, use `rm`.\n *\n * @param {string|string[]} files\n */\nGit.prototype.rmKeepLocal = function (files) {\n return this._runTask(\n straightThroughStringTask(['rm', '--cached', ...asArray(files)]),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n * Returns a list of objects in a tree based on commit hash. Passing in an object hash returns the object's content,\n * size, and type.\n *\n * Passing \"-p\" will instruct cat-file to determine the object type, and display its formatted contents.\n *\n * @param {string[]} [options]\n * @param {Function} [then]\n */\nGit.prototype.catFile = function (options, then) {\n return this._catFile('utf-8', arguments);\n};\n\nGit.prototype.binaryCatFile = function () {\n return this._catFile('buffer', arguments);\n};\n\nGit.prototype._catFile = function (format, args) {\n var handler = trailingFunctionArgument(args);\n var command = ['cat-file'];\n var options = args[0];\n\n if (typeof options === 'string') {\n return this._runTask(\n configurationErrorTask('Git.catFile: options must be supplied as an array of strings'),\n handler\n );\n }\n\n if (Array.isArray(options)) {\n command.push.apply(command, options);\n }\n\n const task =\n format === 'buffer' ? straightThroughBufferTask(command) : straightThroughStringTask(command);\n\n return this._runTask(task, handler);\n};\n\nGit.prototype.diff = function (options, then) {\n const task = filterString(options)\n ? configurationErrorTask(\n 'git.diff: supplying options as a single string is no longer supported, switch to an array of strings'\n )\n : straightThroughStringTask(['diff', ...getTrailingOptions(arguments)]);\n\n return this._runTask(task, trailingFunctionArgument(arguments));\n};\n\nGit.prototype.diffSummary = function () {\n return this._runTask(\n diffSummaryTask(getTrailingOptions(arguments, 1)),\n trailingFunctionArgument(arguments)\n );\n};\n\nGit.prototype.applyPatch = function (patches) {\n const task = !filterStringOrStringArray(patches)\n ? configurationErrorTask(\n `git.applyPatch requires one or more string patches as the first argument`\n )\n : applyPatchTask(asArray(patches), getTrailingOptions([].slice.call(arguments, 1)));\n\n return this._runTask(task, trailingFunctionArgument(arguments));\n};\n\nGit.prototype.revparse = function () {\n const commands = ['rev-parse', ...getTrailingOptions(arguments, true)];\n return this._runTask(\n straightThroughStringTask(commands, true),\n trailingFunctionArgument(arguments)\n );\n};\n\n/**\n */\nGit.prototype.clean = function (mode, options, then) {\n const usingCleanOptionsArray = isCleanOptionsArray(mode);\n const cleanMode =\n (usingCleanOptionsArray && mode.join('')) || filterType(mode, filterString) || '';\n const customArgs = getTrailingOptions([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));\n\n return this._runTask(\n cleanWithOptionsTask(cleanMode, customArgs),\n trailingFunctionArgument(arguments)\n );\n};\n\nGit.prototype.exec = function (then) {\n const task = {\n commands: [],\n format: 'utf-8',\n parser() {\n if (typeof then === 'function') {\n then();\n }\n },\n };\n\n return this._runTask(task);\n};\n\n/**\n * Clears the queue of pending commands and returns the wrapper instance for chaining.\n *\n * @returns {Git}\n */\nGit.prototype.clearQueue = function () {\n // TODO:\n // this._executor.clear();\n return this;\n};\n\n/**\n * Check if a pathname or pathnames are excluded by .gitignore\n *\n * @param {string|string[]} pathnames\n * @param {Function} [then]\n */\nGit.prototype.checkIgnore = function (pathnames, then) {\n return this._runTask(\n checkIgnoreTask(asArray(filterType(pathnames, filterStringOrStringArray, []))),\n trailingFunctionArgument(arguments)\n );\n};\n\nGit.prototype.checkIsRepo = function (checkType, then) {\n return this._runTask(\n checkIsRepoTask(filterType(checkType, filterString)),\n trailingFunctionArgument(arguments)\n );\n};\n\nmodule.exports = Git;\n", "import { SimpleGitFactory } from '../../typings';\n\nimport * as api from './api';\nimport {\n abortPlugin,\n blockUnsafeOperationsPlugin,\n commandConfigPrefixingPlugin,\n completionDetectionPlugin,\n customBinaryPlugin,\n errorDetectionHandler,\n errorDetectionPlugin,\n PluginStore,\n progressMonitorPlugin,\n spawnOptionsPlugin,\n timeoutPlugin,\n} from './plugins';\nimport { suffixPathsPlugin } from './plugins/suffix-paths.plugin';\nimport { createInstanceConfig, folderExists } from './utils';\nimport { SimpleGitOptions } from './types';\n\nconst Git = require('../git');\n\n/**\n * Adds the necessary properties to the supplied object to enable it for use as\n * the default export of a module.\n *\n * Eg: `module.exports = esModuleFactory({ something () {} })`\n */\nexport function esModuleFactory(defaultExport: T) {\n return Object.defineProperties(defaultExport, {\n __esModule: { value: true },\n default: { value: defaultExport },\n }) as T & { __esModule: true; default: T };\n}\n\nexport function gitExportFactory(factory: SimpleGitFactory) {\n return Object.assign(factory.bind(null), api);\n}\n\nexport function gitInstanceFactory(\n baseDir?: string | Partial,\n options?: Partial\n) {\n const plugins = new PluginStore();\n const config = createInstanceConfig(\n (baseDir && (typeof baseDir === 'string' ? { baseDir } : baseDir)) || {},\n options\n );\n\n if (!folderExists(config.baseDir)) {\n throw new api.GitConstructError(\n config,\n `Cannot use simple-git on a directory that does not exist`\n );\n }\n\n if (Array.isArray(config.config)) {\n plugins.add(commandConfigPrefixingPlugin(config.config));\n }\n\n plugins.add(blockUnsafeOperationsPlugin(config.unsafe));\n plugins.add(suffixPathsPlugin());\n plugins.add(completionDetectionPlugin(config.completion));\n config.abort && plugins.add(abortPlugin(config.abort));\n config.progress && plugins.add(progressMonitorPlugin(config.progress));\n config.timeout && plugins.add(timeoutPlugin(config.timeout));\n config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));\n\n plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));\n config.errors && plugins.add(errorDetectionPlugin(config.errors));\n\n customBinaryPlugin(plugins, config.binary, config.unsafe?.allowUnsafeCustomBinary);\n\n return new Git(config, plugins);\n}\n", "import { SimpleGit, SimpleGitOptions } from '../../../typings';\n\nimport { GitResponseError } from '../errors/git-response-error';\nimport { gitInstanceFactory } from '../git-factory';\nimport { SimpleGitTaskCallback } from '../types';\n\nconst functionNamesBuilderApi = ['customBinary', 'env', 'outputHandler', 'silent'];\n\nconst functionNamesPromiseApi = [\n 'add',\n 'addAnnotatedTag',\n 'addConfig',\n 'addRemote',\n 'addTag',\n 'applyPatch',\n 'binaryCatFile',\n 'branch',\n 'branchLocal',\n 'catFile',\n 'checkIgnore',\n 'checkIsRepo',\n 'checkout',\n 'checkoutBranch',\n 'checkoutLatestTag',\n 'checkoutLocalBranch',\n 'clean',\n 'clone',\n 'commit',\n 'cwd',\n 'deleteLocalBranch',\n 'deleteLocalBranches',\n 'diff',\n 'diffSummary',\n 'exec',\n 'fetch',\n 'getRemotes',\n 'init',\n 'listConfig',\n 'listRemote',\n 'log',\n 'merge',\n 'mergeFromTo',\n 'mirror',\n 'mv',\n 'pull',\n 'push',\n 'pushTags',\n 'raw',\n 'rebase',\n 'remote',\n 'removeRemote',\n 'reset',\n 'revert',\n 'revparse',\n 'rm',\n 'rmKeepLocal',\n 'show',\n 'stash',\n 'stashList',\n 'status',\n 'subModule',\n 'submoduleAdd',\n 'submoduleInit',\n 'submoduleUpdate',\n 'tag',\n 'tags',\n 'updateServerInfo',\n];\n\nexport function gitP(\n ...args: [] | [string] | [Partial] | [string, Partial]\n): SimpleGit {\n let git: any;\n\n let chain = Promise.resolve();\n\n try {\n git = gitInstanceFactory(...args);\n } catch (e) {\n chain = Promise.reject(e);\n }\n\n function builderReturn() {\n return promiseApi;\n }\n\n function chainReturn() {\n return chain;\n }\n\n const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce(\n (api: any, name: string) => {\n const isAsync = functionNamesPromiseApi.includes(name);\n\n const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api);\n const alternative = isAsync ? chainReturn : builderReturn;\n\n Object.defineProperty(api, name, {\n enumerable: false,\n configurable: false,\n value: git ? valid : alternative,\n });\n\n return api;\n },\n {}\n );\n\n return promiseApi as SimpleGit;\n\n function asyncWrapper(fn: string, git: any): (...args: any[]) => Promise {\n return function (...args: any[]) {\n if (typeof args[args.length] === 'function') {\n throw new TypeError(\n 'Promise interface requires that handlers are not supplied inline, ' +\n 'trailing function not allowed in call to ' +\n fn\n );\n }\n\n return chain.then(function () {\n return new Promise(function (resolve, reject) {\n const callback: SimpleGitTaskCallback = (err: Error | null, result?: any) => {\n if (err) {\n return reject(toError(err));\n }\n\n resolve(result);\n };\n args.push(callback);\n\n git[fn].apply(git, args);\n });\n });\n };\n }\n\n function syncWrapper(fn: string, git: any, api: SimpleGit) {\n return (...args: any[]) => {\n git[fn](...args);\n\n return api;\n };\n }\n}\n\nfunction toError(error: Error | string | any): Error {\n if (error instanceof Error) {\n return error;\n }\n\n if (typeof error === 'string') {\n return new Error(error);\n }\n\n return new GitResponseError(error);\n}\n", "const { gitP } = require('./lib/runners/promise-wrapped');\nconst { esModuleFactory, gitInstanceFactory, gitExportFactory } = require('./lib/git-factory');\n\nconst simpleGit = esModuleFactory(gitExportFactory(gitInstanceFactory));\n\nmodule.exports = Object.assign(simpleGit, { gitP, simpleGit });\n"],
+ "mappings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ACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACH;AAAA;AAAA;;;ACnEA,IAAM,EAAE,MAAAC,MAAK,IAAI;AACjB,IAAM,EAAE,iBAAAC,kBAAiB,oBAAAC,qBAAoB,kBAAAC,kBAAiB,IAAI;AAElE,IAAM,YAAYF,iBAAgBE,kBAAiBD,mBAAkB,CAAC;AAEtE,OAAO,UAAU,OAAO,OAAO,WAAW,EAAE,MAAAF,OAAM,UAAU,CAAC;",
+ "names": ["trimmed", "ExitCodes", "commands", "parser", "parsers", "CheckRepoActions", "parser", "trimmed", "CleanOptions", "append", "GitConfigScope", "DiffNameStatus", "ResetMode", "_a", "input", "plugin", "_a", "_a", "_b", "append", "debug", "onError", "parser", "parser", "excludeOptions", "parsers", "parsers", "parsers", "parsers", "parser", "trimmed", "parsers", "parsers", "import_promise_deferred", "parsers", "parsers", "parser", "parsers", "disallowedCommand", "parsers", "parser", "exports", "module", "GitExecutor", "SimpleGitApi", "Scheduler", "configurationErrorTask", "asArray", "filterArray", "filterPrimitives", "filterString", "filterStringOrStringArray", "filterType", "getTrailingOptions", "trailingFunctionArgument", "trailingOptionsArgument", "applyPatchTask", "branchTask", "branchLocalTask", "deleteBranchesTask", "deleteBranchTask", "checkIgnoreTask", "checkIsRepoTask", "cloneTask", "cloneMirrorTask", "cleanWithOptionsTask", "isCleanOptionsArray", "diffSummaryTask", "fetchTask", "moveTask", "pullTask", "pushTagsTask", "addRemoteTask", "getRemotesTask", "listRemotesTask", "remoteTask", "removeRemoteTask", "getResetMode", "resetTask", "stashListTask", "addSubModuleTask", "initSubModuleTask", "subModuleTask", "updateSubModuleTask", "addAnnotatedTagTask", "addTagTask", "tagListTask", "straightThroughBufferTask", "straightThroughStringTask", "Git", "_a", "git", "args", "gitP", "esModuleFactory", "gitInstanceFactory", "gitExportFactory"]
+}
diff --git a/node_modules/simple-git/dist/esm/index.js b/node_modules/simple-git/dist/esm/index.js
new file mode 100644
index 0000000..ae7a564
--- /dev/null
+++ b/node_modules/simple-git/dist/esm/index.js
@@ -0,0 +1,4762 @@
+var __defProp = Object.defineProperty;
+var __defProps = Object.defineProperties;
+var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
+var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __getOwnPropSymbols = Object.getOwnPropertySymbols;
+var __hasOwnProp = Object.prototype.hasOwnProperty;
+var __propIsEnum = Object.prototype.propertyIsEnumerable;
+var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
+var __spreadValues = (a, b) => {
+ for (var prop in b || (b = {}))
+ if (__hasOwnProp.call(b, prop))
+ __defNormalProp(a, prop, b[prop]);
+ if (__getOwnPropSymbols)
+ for (var prop of __getOwnPropSymbols(b)) {
+ if (__propIsEnum.call(b, prop))
+ __defNormalProp(a, prop, b[prop]);
+ }
+ return a;
+};
+var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
+var __esm = (fn, res) => function __init() {
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
+};
+var __commonJS = (cb, mod) => function __require() {
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+};
+var __export = (target, all) => {
+ for (var name in all)
+ __defProp(target, name, { get: all[name], enumerable: true });
+};
+var __copyProps = (to, from, except, desc) => {
+ if (from && typeof from === "object" || typeof from === "function") {
+ for (let key of __getOwnPropNames(from))
+ if (!__hasOwnProp.call(to, key) && key !== except)
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
+ }
+ return to;
+};
+var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
+var __async = (__this, __arguments, generator) => {
+ return new Promise((resolve, reject) => {
+ var fulfilled = (value) => {
+ try {
+ step(generator.next(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var rejected = (value) => {
+ try {
+ step(generator.throw(value));
+ } catch (e) {
+ reject(e);
+ }
+ };
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
+ step((generator = generator.apply(__this, __arguments)).next());
+ });
+};
+
+// src/lib/args/pathspec.ts
+function pathspec(...paths) {
+ const key = new String(paths);
+ cache.set(key, paths);
+ return key;
+}
+function isPathSpec(path) {
+ return path instanceof String && cache.has(path);
+}
+function toPaths(pathSpec) {
+ return cache.get(pathSpec) || [];
+}
+var cache;
+var init_pathspec = __esm({
+ "src/lib/args/pathspec.ts"() {
+ "use strict";
+ cache = /* @__PURE__ */ new WeakMap();
+ }
+});
+
+// src/lib/errors/git-error.ts
+var GitError;
+var init_git_error = __esm({
+ "src/lib/errors/git-error.ts"() {
+ "use strict";
+ GitError = class extends Error {
+ constructor(task, message) {
+ super(message);
+ this.task = task;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+ };
+ }
+});
+
+// src/lib/errors/git-response-error.ts
+var GitResponseError;
+var init_git_response_error = __esm({
+ "src/lib/errors/git-response-error.ts"() {
+ "use strict";
+ init_git_error();
+ GitResponseError = class extends GitError {
+ constructor(git, message) {
+ super(void 0, message || String(git));
+ this.git = git;
+ }
+ };
+ }
+});
+
+// src/lib/errors/task-configuration-error.ts
+var TaskConfigurationError;
+var init_task_configuration_error = __esm({
+ "src/lib/errors/task-configuration-error.ts"() {
+ "use strict";
+ init_git_error();
+ TaskConfigurationError = class extends GitError {
+ constructor(message) {
+ super(void 0, message);
+ }
+ };
+ }
+});
+
+// src/lib/utils/util.ts
+import { exists, FOLDER } from "@kwsites/file-exists";
+function asFunction(source) {
+ return typeof source === "function" ? source : NOOP;
+}
+function isUserFunction(source) {
+ return typeof source === "function" && source !== NOOP;
+}
+function splitOn(input, char) {
+ const index = input.indexOf(char);
+ if (index <= 0) {
+ return [input, ""];
+ }
+ return [input.substr(0, index), input.substr(index + 1)];
+}
+function first(input, offset = 0) {
+ return isArrayLike(input) && input.length > offset ? input[offset] : void 0;
+}
+function last(input, offset = 0) {
+ if (isArrayLike(input) && input.length > offset) {
+ return input[input.length - 1 - offset];
+ }
+}
+function isArrayLike(input) {
+ return !!(input && typeof input.length === "number");
+}
+function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
+ return input.split(separator).reduce((output, line) => {
+ const lineContent = trimmed2 ? line.trim() : line;
+ if (lineContent) {
+ output.push(lineContent);
+ }
+ return output;
+ }, []);
+}
+function forEachLineWithContent(input, callback) {
+ return toLinesWithContent(input, true).map((line) => callback(line));
+}
+function folderExists(path) {
+ return exists(path, FOLDER);
+}
+function append(target, item) {
+ if (Array.isArray(target)) {
+ if (!target.includes(item)) {
+ target.push(item);
+ }
+ } else {
+ target.add(item);
+ }
+ return item;
+}
+function including(target, item) {
+ if (Array.isArray(target) && !target.includes(item)) {
+ target.push(item);
+ }
+ return target;
+}
+function remove(target, item) {
+ if (Array.isArray(target)) {
+ const index = target.indexOf(item);
+ if (index >= 0) {
+ target.splice(index, 1);
+ }
+ } else {
+ target.delete(item);
+ }
+ return item;
+}
+function asArray(source) {
+ return Array.isArray(source) ? source : [source];
+}
+function asStringArray(source) {
+ return asArray(source).map(String);
+}
+function asNumber(source, onNaN = 0) {
+ if (source == null) {
+ return onNaN;
+ }
+ const num = parseInt(source, 10);
+ return isNaN(num) ? onNaN : num;
+}
+function prefixedArray(input, prefix) {
+ const output = [];
+ for (let i = 0, max = input.length; i < max; i++) {
+ output.push(prefix, input[i]);
+ }
+ return output;
+}
+function bufferToString(input) {
+ return (Array.isArray(input) ? Buffer.concat(input) : input).toString("utf-8");
+}
+function pick(source, properties) {
+ return Object.assign(
+ {},
+ ...properties.map((property) => property in source ? { [property]: source[property] } : {})
+ );
+}
+function delay(duration = 0) {
+ return new Promise((done) => setTimeout(done, duration));
+}
+function orVoid(input) {
+ if (input === false) {
+ return void 0;
+ }
+ return input;
+}
+var NULL, NOOP, objectToString;
+var init_util = __esm({
+ "src/lib/utils/util.ts"() {
+ "use strict";
+ NULL = "\0";
+ NOOP = () => {
+ };
+ objectToString = Object.prototype.toString.call.bind(Object.prototype.toString);
+ }
+});
+
+// src/lib/utils/argument-filters.ts
+function filterType(input, filter, def) {
+ if (filter(input)) {
+ return input;
+ }
+ return arguments.length > 2 ? def : void 0;
+}
+function filterPrimitives(input, omit) {
+ const type = isPathSpec(input) ? "string" : typeof input;
+ return /number|string|boolean/.test(type) && (!omit || !omit.includes(type));
+}
+function filterPlainObject(input) {
+ return !!input && objectToString(input) === "[object Object]";
+}
+function filterFunction(input) {
+ return typeof input === "function";
+}
+var filterArray, filterString, filterStringArray, filterStringOrStringArray, filterHasLength;
+var init_argument_filters = __esm({
+ "src/lib/utils/argument-filters.ts"() {
+ "use strict";
+ init_util();
+ init_pathspec();
+ filterArray = (input) => {
+ return Array.isArray(input);
+ };
+ filterString = (input) => {
+ return typeof input === "string";
+ };
+ filterStringArray = (input) => {
+ return Array.isArray(input) && input.every(filterString);
+ };
+ filterStringOrStringArray = (input) => {
+ return filterString(input) || Array.isArray(input) && input.every(filterString);
+ };
+ filterHasLength = (input) => {
+ if (input == null || "number|boolean|function".includes(typeof input)) {
+ return false;
+ }
+ return Array.isArray(input) || typeof input === "string" || typeof input.length === "number";
+ };
+ }
+});
+
+// src/lib/utils/exit-codes.ts
+var ExitCodes;
+var init_exit_codes = __esm({
+ "src/lib/utils/exit-codes.ts"() {
+ "use strict";
+ ExitCodes = /* @__PURE__ */ ((ExitCodes2) => {
+ ExitCodes2[ExitCodes2["SUCCESS"] = 0] = "SUCCESS";
+ ExitCodes2[ExitCodes2["ERROR"] = 1] = "ERROR";
+ ExitCodes2[ExitCodes2["NOT_FOUND"] = -2] = "NOT_FOUND";
+ ExitCodes2[ExitCodes2["UNCLEAN"] = 128] = "UNCLEAN";
+ return ExitCodes2;
+ })(ExitCodes || {});
+ }
+});
+
+// src/lib/utils/git-output-streams.ts
+var GitOutputStreams;
+var init_git_output_streams = __esm({
+ "src/lib/utils/git-output-streams.ts"() {
+ "use strict";
+ GitOutputStreams = class {
+ constructor(stdOut, stdErr) {
+ this.stdOut = stdOut;
+ this.stdErr = stdErr;
+ }
+ asStrings() {
+ return new GitOutputStreams(this.stdOut.toString("utf8"), this.stdErr.toString("utf8"));
+ }
+ };
+ }
+});
+
+// src/lib/utils/line-parser.ts
+var LineParser, RemoteLineParser;
+var init_line_parser = __esm({
+ "src/lib/utils/line-parser.ts"() {
+ "use strict";
+ LineParser = class {
+ constructor(regExp, useMatches) {
+ this.matches = [];
+ this.parse = (line, target) => {
+ this.resetMatches();
+ if (!this._regExp.every((reg, index) => this.addMatch(reg, index, line(index)))) {
+ return false;
+ }
+ return this.useMatches(target, this.prepareMatches()) !== false;
+ };
+ this._regExp = Array.isArray(regExp) ? regExp : [regExp];
+ if (useMatches) {
+ this.useMatches = useMatches;
+ }
+ }
+ useMatches(target, match) {
+ throw new Error(`LineParser:useMatches not implemented`);
+ }
+ resetMatches() {
+ this.matches.length = 0;
+ }
+ prepareMatches() {
+ return this.matches;
+ }
+ addMatch(reg, index, line) {
+ const matched = line && reg.exec(line);
+ if (matched) {
+ this.pushMatch(index, matched);
+ }
+ return !!matched;
+ }
+ pushMatch(_index, matched) {
+ this.matches.push(...matched.slice(1));
+ }
+ };
+ RemoteLineParser = class extends LineParser {
+ addMatch(reg, index, line) {
+ return /^remote:\s/.test(String(line)) && super.addMatch(reg, index, line);
+ }
+ pushMatch(index, matched) {
+ if (index > 0 || matched.length > 1) {
+ super.pushMatch(index, matched);
+ }
+ }
+ };
+ }
+});
+
+// src/lib/utils/simple-git-options.ts
+function createInstanceConfig(...options) {
+ const baseDir = process.cwd();
+ const config = Object.assign(
+ __spreadValues({ baseDir }, defaultOptions),
+ ...options.filter((o) => typeof o === "object" && o)
+ );
+ config.baseDir = config.baseDir || baseDir;
+ config.trimmed = config.trimmed === true;
+ return config;
+}
+var defaultOptions;
+var init_simple_git_options = __esm({
+ "src/lib/utils/simple-git-options.ts"() {
+ "use strict";
+ defaultOptions = {
+ binary: "git",
+ maxConcurrentProcesses: 5,
+ config: [],
+ trimmed: false
+ };
+ }
+});
+
+// src/lib/utils/task-options.ts
+function appendTaskOptions(options, commands = []) {
+ if (!filterPlainObject(options)) {
+ return commands;
+ }
+ return Object.keys(options).reduce((commands2, key) => {
+ const value = options[key];
+ if (isPathSpec(value)) {
+ commands2.push(value);
+ } else if (filterPrimitives(value, ["boolean"])) {
+ commands2.push(key + "=" + value);
+ } else {
+ commands2.push(key);
+ }
+ return commands2;
+ }, commands);
+}
+function getTrailingOptions(args, initialPrimitive = 0, objectOnly = false) {
+ const command = [];
+ for (let i = 0, max = initialPrimitive < 0 ? args.length : initialPrimitive; i < max; i++) {
+ if ("string|number".includes(typeof args[i])) {
+ command.push(String(args[i]));
+ }
+ }
+ appendTaskOptions(trailingOptionsArgument(args), command);
+ if (!objectOnly) {
+ command.push(...trailingArrayArgument(args));
+ }
+ return command;
+}
+function trailingArrayArgument(args) {
+ const hasTrailingCallback = typeof last(args) === "function";
+ return filterType(last(args, hasTrailingCallback ? 1 : 0), filterArray, []);
+}
+function trailingOptionsArgument(args) {
+ const hasTrailingCallback = filterFunction(last(args));
+ return filterType(last(args, hasTrailingCallback ? 1 : 0), filterPlainObject);
+}
+function trailingFunctionArgument(args, includeNoop = true) {
+ const callback = asFunction(last(args));
+ return includeNoop || isUserFunction(callback) ? callback : void 0;
+}
+var init_task_options = __esm({
+ "src/lib/utils/task-options.ts"() {
+ "use strict";
+ init_argument_filters();
+ init_util();
+ init_pathspec();
+ }
+});
+
+// src/lib/utils/task-parser.ts
+function callTaskParser(parser3, streams) {
+ return parser3(streams.stdOut, streams.stdErr);
+}
+function parseStringResponse(result, parsers12, texts, trim = true) {
+ asArray(texts).forEach((text) => {
+ for (let lines = toLinesWithContent(text, trim), i = 0, max = lines.length; i < max; i++) {
+ const line = (offset = 0) => {
+ if (i + offset >= max) {
+ return;
+ }
+ return lines[i + offset];
+ };
+ parsers12.some(({ parse }) => parse(line, result));
+ }
+ });
+ return result;
+}
+var init_task_parser = __esm({
+ "src/lib/utils/task-parser.ts"() {
+ "use strict";
+ init_util();
+ }
+});
+
+// src/lib/utils/index.ts
+var utils_exports = {};
+__export(utils_exports, {
+ ExitCodes: () => ExitCodes,
+ GitOutputStreams: () => GitOutputStreams,
+ LineParser: () => LineParser,
+ NOOP: () => NOOP,
+ NULL: () => NULL,
+ RemoteLineParser: () => RemoteLineParser,
+ append: () => append,
+ appendTaskOptions: () => appendTaskOptions,
+ asArray: () => asArray,
+ asFunction: () => asFunction,
+ asNumber: () => asNumber,
+ asStringArray: () => asStringArray,
+ bufferToString: () => bufferToString,
+ callTaskParser: () => callTaskParser,
+ createInstanceConfig: () => createInstanceConfig,
+ delay: () => delay,
+ filterArray: () => filterArray,
+ filterFunction: () => filterFunction,
+ filterHasLength: () => filterHasLength,
+ filterPlainObject: () => filterPlainObject,
+ filterPrimitives: () => filterPrimitives,
+ filterString: () => filterString,
+ filterStringArray: () => filterStringArray,
+ filterStringOrStringArray: () => filterStringOrStringArray,
+ filterType: () => filterType,
+ first: () => first,
+ folderExists: () => folderExists,
+ forEachLineWithContent: () => forEachLineWithContent,
+ getTrailingOptions: () => getTrailingOptions,
+ including: () => including,
+ isUserFunction: () => isUserFunction,
+ last: () => last,
+ objectToString: () => objectToString,
+ orVoid: () => orVoid,
+ parseStringResponse: () => parseStringResponse,
+ pick: () => pick,
+ prefixedArray: () => prefixedArray,
+ remove: () => remove,
+ splitOn: () => splitOn,
+ toLinesWithContent: () => toLinesWithContent,
+ trailingFunctionArgument: () => trailingFunctionArgument,
+ trailingOptionsArgument: () => trailingOptionsArgument
+});
+var init_utils = __esm({
+ "src/lib/utils/index.ts"() {
+ "use strict";
+ init_argument_filters();
+ init_exit_codes();
+ init_git_output_streams();
+ init_line_parser();
+ init_simple_git_options();
+ init_task_options();
+ init_task_parser();
+ init_util();
+ }
+});
+
+// src/lib/tasks/check-is-repo.ts
+var check_is_repo_exports = {};
+__export(check_is_repo_exports, {
+ CheckRepoActions: () => CheckRepoActions,
+ checkIsBareRepoTask: () => checkIsBareRepoTask,
+ checkIsRepoRootTask: () => checkIsRepoRootTask,
+ checkIsRepoTask: () => checkIsRepoTask
+});
+function checkIsRepoTask(action) {
+ switch (action) {
+ case "bare" /* BARE */:
+ return checkIsBareRepoTask();
+ case "root" /* IS_REPO_ROOT */:
+ return checkIsRepoRootTask();
+ }
+ const commands = ["rev-parse", "--is-inside-work-tree"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser
+ };
+}
+function checkIsRepoRootTask() {
+ const commands = ["rev-parse", "--git-dir"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser(path) {
+ return /^\.(git)?$/.test(path.trim());
+ }
+ };
+}
+function checkIsBareRepoTask() {
+ const commands = ["rev-parse", "--is-bare-repository"];
+ return {
+ commands,
+ format: "utf-8",
+ onError,
+ parser
+ };
+}
+function isNotRepoMessage(error) {
+ return /(Not a git repository|Kein Git-Repository)/i.test(String(error));
+}
+var CheckRepoActions, onError, parser;
+var init_check_is_repo = __esm({
+ "src/lib/tasks/check-is-repo.ts"() {
+ "use strict";
+ init_utils();
+ CheckRepoActions = /* @__PURE__ */ ((CheckRepoActions2) => {
+ CheckRepoActions2["BARE"] = "bare";
+ CheckRepoActions2["IN_TREE"] = "tree";
+ CheckRepoActions2["IS_REPO_ROOT"] = "root";
+ return CheckRepoActions2;
+ })(CheckRepoActions || {});
+ onError = ({ exitCode }, error, done, fail) => {
+ if (exitCode === 128 /* UNCLEAN */ && isNotRepoMessage(error)) {
+ return done(Buffer.from("false"));
+ }
+ fail(error);
+ };
+ parser = (text) => {
+ return text.trim() === "true";
+ };
+ }
+});
+
+// src/lib/responses/CleanSummary.ts
+function cleanSummaryParser(dryRun, text) {
+ const summary = new CleanResponse(dryRun);
+ const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
+ toLinesWithContent(text).forEach((line) => {
+ const removed = line.replace(regexp, "");
+ summary.paths.push(removed);
+ (isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
+ });
+ return summary;
+}
+var CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp;
+var init_CleanSummary = __esm({
+ "src/lib/responses/CleanSummary.ts"() {
+ "use strict";
+ init_utils();
+ CleanResponse = class {
+ constructor(dryRun) {
+ this.dryRun = dryRun;
+ this.paths = [];
+ this.files = [];
+ this.folders = [];
+ }
+ };
+ removalRegexp = /^[a-z]+\s*/i;
+ dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
+ isFolderRegexp = /\/$/;
+ }
+});
+
+// src/lib/tasks/task.ts
+var task_exports = {};
+__export(task_exports, {
+ EMPTY_COMMANDS: () => EMPTY_COMMANDS,
+ adhocExecTask: () => adhocExecTask,
+ configurationErrorTask: () => configurationErrorTask,
+ isBufferTask: () => isBufferTask,
+ isEmptyTask: () => isEmptyTask,
+ straightThroughBufferTask: () => straightThroughBufferTask,
+ straightThroughStringTask: () => straightThroughStringTask
+});
+function adhocExecTask(parser3) {
+ return {
+ commands: EMPTY_COMMANDS,
+ format: "empty",
+ parser: parser3
+ };
+}
+function configurationErrorTask(error) {
+ return {
+ commands: EMPTY_COMMANDS,
+ format: "empty",
+ parser() {
+ throw typeof error === "string" ? new TaskConfigurationError(error) : error;
+ }
+ };
+}
+function straightThroughStringTask(commands, trimmed2 = false) {
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return trimmed2 ? String(text).trim() : text;
+ }
+ };
+}
+function straightThroughBufferTask(commands) {
+ return {
+ commands,
+ format: "buffer",
+ parser(buffer) {
+ return buffer;
+ }
+ };
+}
+function isBufferTask(task) {
+ return task.format === "buffer";
+}
+function isEmptyTask(task) {
+ return task.format === "empty" || !task.commands.length;
+}
+var EMPTY_COMMANDS;
+var init_task = __esm({
+ "src/lib/tasks/task.ts"() {
+ "use strict";
+ init_task_configuration_error();
+ EMPTY_COMMANDS = [];
+ }
+});
+
+// src/lib/tasks/clean.ts
+var clean_exports = {};
+__export(clean_exports, {
+ CONFIG_ERROR_INTERACTIVE_MODE: () => CONFIG_ERROR_INTERACTIVE_MODE,
+ CONFIG_ERROR_MODE_REQUIRED: () => CONFIG_ERROR_MODE_REQUIRED,
+ CONFIG_ERROR_UNKNOWN_OPTION: () => CONFIG_ERROR_UNKNOWN_OPTION,
+ CleanOptions: () => CleanOptions,
+ cleanTask: () => cleanTask,
+ cleanWithOptionsTask: () => cleanWithOptionsTask,
+ isCleanOptionsArray: () => isCleanOptionsArray
+});
+function cleanWithOptionsTask(mode, customArgs) {
+ const { cleanMode, options, valid } = getCleanOptions(mode);
+ if (!cleanMode) {
+ return configurationErrorTask(CONFIG_ERROR_MODE_REQUIRED);
+ }
+ if (!valid.options) {
+ return configurationErrorTask(CONFIG_ERROR_UNKNOWN_OPTION + JSON.stringify(mode));
+ }
+ options.push(...customArgs);
+ if (options.some(isInteractiveMode)) {
+ return configurationErrorTask(CONFIG_ERROR_INTERACTIVE_MODE);
+ }
+ return cleanTask(cleanMode, options);
+}
+function cleanTask(mode, customArgs) {
+ const commands = ["clean", `-${mode}`, ...customArgs];
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return cleanSummaryParser(mode === "n" /* DRY_RUN */, text);
+ }
+ };
+}
+function isCleanOptionsArray(input) {
+ return Array.isArray(input) && input.every((test) => CleanOptionValues.has(test));
+}
+function getCleanOptions(input) {
+ let cleanMode;
+ let options = [];
+ let valid = { cleanMode: false, options: true };
+ input.replace(/[^a-z]i/g, "").split("").forEach((char) => {
+ if (isCleanMode(char)) {
+ cleanMode = char;
+ valid.cleanMode = true;
+ } else {
+ valid.options = valid.options && isKnownOption(options[options.length] = `-${char}`);
+ }
+ });
+ return {
+ cleanMode,
+ options,
+ valid
+ };
+}
+function isCleanMode(cleanMode) {
+ return cleanMode === "f" /* FORCE */ || cleanMode === "n" /* DRY_RUN */;
+}
+function isKnownOption(option) {
+ return /^-[a-z]$/i.test(option) && CleanOptionValues.has(option.charAt(1));
+}
+function isInteractiveMode(option) {
+ if (/^-[^\-]/.test(option)) {
+ return option.indexOf("i") > 0;
+ }
+ return option === "--interactive";
+}
+var CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues;
+var init_clean = __esm({
+ "src/lib/tasks/clean.ts"() {
+ "use strict";
+ init_CleanSummary();
+ init_utils();
+ init_task();
+ CONFIG_ERROR_INTERACTIVE_MODE = "Git clean interactive mode is not supported";
+ CONFIG_ERROR_MODE_REQUIRED = 'Git clean mode parameter ("n" or "f") is required';
+ CONFIG_ERROR_UNKNOWN_OPTION = "Git clean unknown option found in: ";
+ CleanOptions = /* @__PURE__ */ ((CleanOptions2) => {
+ CleanOptions2["DRY_RUN"] = "n";
+ CleanOptions2["FORCE"] = "f";
+ CleanOptions2["IGNORED_INCLUDED"] = "x";
+ CleanOptions2["IGNORED_ONLY"] = "X";
+ CleanOptions2["EXCLUDING"] = "e";
+ CleanOptions2["QUIET"] = "q";
+ CleanOptions2["RECURSIVE"] = "d";
+ return CleanOptions2;
+ })(CleanOptions || {});
+ CleanOptionValues = /* @__PURE__ */ new Set([
+ "i",
+ ...asStringArray(Object.values(CleanOptions))
+ ]);
+ }
+});
+
+// src/lib/responses/ConfigList.ts
+function configListParser(text) {
+ const config = new ConfigList();
+ for (const item of configParser(text)) {
+ config.addValue(item.file, String(item.key), item.value);
+ }
+ return config;
+}
+function configGetParser(text, key) {
+ let value = null;
+ const values = [];
+ const scopes = /* @__PURE__ */ new Map();
+ for (const item of configParser(text, key)) {
+ if (item.key !== key) {
+ continue;
+ }
+ values.push(value = item.value);
+ if (!scopes.has(item.file)) {
+ scopes.set(item.file, []);
+ }
+ scopes.get(item.file).push(value);
+ }
+ return {
+ key,
+ paths: Array.from(scopes.keys()),
+ scopes,
+ value,
+ values
+ };
+}
+function configFilePath(filePath) {
+ return filePath.replace(/^(file):/, "");
+}
+function* configParser(text, requestedKey = null) {
+ const lines = text.split("\0");
+ for (let i = 0, max = lines.length - 1; i < max; ) {
+ const file = configFilePath(lines[i++]);
+ let value = lines[i++];
+ let key = requestedKey;
+ if (value.includes("\n")) {
+ const line = splitOn(value, "\n");
+ key = line[0];
+ value = line[1];
+ }
+ yield { file, key, value };
+ }
+}
+var ConfigList;
+var init_ConfigList = __esm({
+ "src/lib/responses/ConfigList.ts"() {
+ "use strict";
+ init_utils();
+ ConfigList = class {
+ constructor() {
+ this.files = [];
+ this.values = /* @__PURE__ */ Object.create(null);
+ }
+ get all() {
+ if (!this._all) {
+ this._all = this.files.reduce((all, file) => {
+ return Object.assign(all, this.values[file]);
+ }, {});
+ }
+ return this._all;
+ }
+ addFile(file) {
+ if (!(file in this.values)) {
+ const latest = last(this.files);
+ this.values[file] = latest ? Object.create(this.values[latest]) : {};
+ this.files.push(file);
+ }
+ return this.values[file];
+ }
+ addValue(file, key, value) {
+ const values = this.addFile(file);
+ if (!values.hasOwnProperty(key)) {
+ values[key] = value;
+ } else if (Array.isArray(values[key])) {
+ values[key].push(value);
+ } else {
+ values[key] = [values[key], value];
+ }
+ this._all = void 0;
+ }
+ };
+ }
+});
+
+// src/lib/tasks/config.ts
+function asConfigScope(scope, fallback) {
+ if (typeof scope === "string" && GitConfigScope.hasOwnProperty(scope)) {
+ return scope;
+ }
+ return fallback;
+}
+function addConfigTask(key, value, append2, scope) {
+ const commands = ["config", `--${scope}`];
+ if (append2) {
+ commands.push("--add");
+ }
+ commands.push(key, value);
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return text;
+ }
+ };
+}
+function getConfigTask(key, scope) {
+ const commands = ["config", "--null", "--show-origin", "--get-all", key];
+ if (scope) {
+ commands.splice(1, 0, `--${scope}`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return configGetParser(text, key);
+ }
+ };
+}
+function listConfigTask(scope) {
+ const commands = ["config", "--list", "--show-origin", "--null"];
+ if (scope) {
+ commands.push(`--${scope}`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return configListParser(text);
+ }
+ };
+}
+function config_default() {
+ return {
+ addConfig(key, value, ...rest) {
+ return this._runTask(
+ addConfigTask(
+ key,
+ value,
+ rest[0] === true,
+ asConfigScope(rest[1], "local" /* local */)
+ ),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ getConfig(key, scope) {
+ return this._runTask(
+ getConfigTask(key, asConfigScope(scope, void 0)),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ listConfig(...rest) {
+ return this._runTask(
+ listConfigTask(asConfigScope(rest[0], void 0)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var GitConfigScope;
+var init_config = __esm({
+ "src/lib/tasks/config.ts"() {
+ "use strict";
+ init_ConfigList();
+ init_utils();
+ GitConfigScope = /* @__PURE__ */ ((GitConfigScope2) => {
+ GitConfigScope2["system"] = "system";
+ GitConfigScope2["global"] = "global";
+ GitConfigScope2["local"] = "local";
+ GitConfigScope2["worktree"] = "worktree";
+ return GitConfigScope2;
+ })(GitConfigScope || {});
+ }
+});
+
+// src/lib/tasks/diff-name-status.ts
+function isDiffNameStatus(input) {
+ return diffNameStatus.has(input);
+}
+var DiffNameStatus, diffNameStatus;
+var init_diff_name_status = __esm({
+ "src/lib/tasks/diff-name-status.ts"() {
+ "use strict";
+ DiffNameStatus = /* @__PURE__ */ ((DiffNameStatus2) => {
+ DiffNameStatus2["ADDED"] = "A";
+ DiffNameStatus2["COPIED"] = "C";
+ DiffNameStatus2["DELETED"] = "D";
+ DiffNameStatus2["MODIFIED"] = "M";
+ DiffNameStatus2["RENAMED"] = "R";
+ DiffNameStatus2["CHANGED"] = "T";
+ DiffNameStatus2["UNMERGED"] = "U";
+ DiffNameStatus2["UNKNOWN"] = "X";
+ DiffNameStatus2["BROKEN"] = "B";
+ return DiffNameStatus2;
+ })(DiffNameStatus || {});
+ diffNameStatus = new Set(Object.values(DiffNameStatus));
+ }
+});
+
+// src/lib/tasks/grep.ts
+function grepQueryBuilder(...params) {
+ return new GrepQuery().param(...params);
+}
+function parseGrep(grep) {
+ const paths = /* @__PURE__ */ new Set();
+ const results = {};
+ forEachLineWithContent(grep, (input) => {
+ const [path, line, preview] = input.split(NULL);
+ paths.add(path);
+ (results[path] = results[path] || []).push({
+ line: asNumber(line),
+ path,
+ preview
+ });
+ });
+ return {
+ paths,
+ results
+ };
+}
+function grep_default() {
+ return {
+ grep(searchTerm) {
+ const then = trailingFunctionArgument(arguments);
+ const options = getTrailingOptions(arguments);
+ for (const option of disallowedOptions) {
+ if (options.includes(option)) {
+ return this._runTask(
+ configurationErrorTask(`git.grep: use of "${option}" is not supported.`),
+ then
+ );
+ }
+ }
+ if (typeof searchTerm === "string") {
+ searchTerm = grepQueryBuilder().param(searchTerm);
+ }
+ const commands = ["grep", "--null", "-n", "--full-name", ...options, ...searchTerm];
+ return this._runTask(
+ {
+ commands,
+ format: "utf-8",
+ parser(stdOut) {
+ return parseGrep(stdOut);
+ }
+ },
+ then
+ );
+ }
+ };
+}
+var disallowedOptions, Query, _a, GrepQuery;
+var init_grep = __esm({
+ "src/lib/tasks/grep.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ disallowedOptions = ["-h"];
+ Query = Symbol("grepQuery");
+ GrepQuery = class {
+ constructor() {
+ this[_a] = [];
+ }
+ *[(_a = Query, Symbol.iterator)]() {
+ for (const query of this[Query]) {
+ yield query;
+ }
+ }
+ and(...and) {
+ and.length && this[Query].push("--and", "(", ...prefixedArray(and, "-e"), ")");
+ return this;
+ }
+ param(...param) {
+ this[Query].push(...prefixedArray(param, "-e"));
+ return this;
+ }
+ };
+ }
+});
+
+// src/lib/tasks/reset.ts
+var reset_exports = {};
+__export(reset_exports, {
+ ResetMode: () => ResetMode,
+ getResetMode: () => getResetMode,
+ resetTask: () => resetTask
+});
+function resetTask(mode, customArgs) {
+ const commands = ["reset"];
+ if (isValidResetMode(mode)) {
+ commands.push(`--${mode}`);
+ }
+ commands.push(...customArgs);
+ return straightThroughStringTask(commands);
+}
+function getResetMode(mode) {
+ if (isValidResetMode(mode)) {
+ return mode;
+ }
+ switch (typeof mode) {
+ case "string":
+ case "undefined":
+ return "soft" /* SOFT */;
+ }
+ return;
+}
+function isValidResetMode(mode) {
+ return ResetModes.includes(mode);
+}
+var ResetMode, ResetModes;
+var init_reset = __esm({
+ "src/lib/tasks/reset.ts"() {
+ "use strict";
+ init_task();
+ ResetMode = /* @__PURE__ */ ((ResetMode2) => {
+ ResetMode2["MIXED"] = "mixed";
+ ResetMode2["SOFT"] = "soft";
+ ResetMode2["HARD"] = "hard";
+ ResetMode2["MERGE"] = "merge";
+ ResetMode2["KEEP"] = "keep";
+ return ResetMode2;
+ })(ResetMode || {});
+ ResetModes = Array.from(Object.values(ResetMode));
+ }
+});
+
+// src/lib/git-logger.ts
+import debug from "debug";
+function createLog() {
+ return debug("simple-git");
+}
+function prefixedLogger(to, prefix, forward) {
+ if (!prefix || !String(prefix).replace(/\s*/, "")) {
+ return !forward ? to : (message, ...args) => {
+ to(message, ...args);
+ forward(message, ...args);
+ };
+ }
+ return (message, ...args) => {
+ to(`%s ${message}`, prefix, ...args);
+ if (forward) {
+ forward(message, ...args);
+ }
+ };
+}
+function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
+ if (typeof name === "string") {
+ return name;
+ }
+ const childNamespace = childDebugger && childDebugger.namespace || "";
+ if (childNamespace.startsWith(parentNamespace)) {
+ return childNamespace.substr(parentNamespace.length + 1);
+ }
+ return childNamespace || parentNamespace;
+}
+function createLogger(label, verbose, initialStep, infoDebugger = createLog()) {
+ const labelPrefix = label && `[${label}]` || "";
+ const spawned = [];
+ const debugDebugger = typeof verbose === "string" ? infoDebugger.extend(verbose) : verbose;
+ const key = childLoggerName(filterType(verbose, filterString), debugDebugger, infoDebugger);
+ return step(initialStep);
+ function sibling(name, initial) {
+ return append(
+ spawned,
+ createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger)
+ );
+ }
+ function step(phase) {
+ const stepPrefix = phase && `[${phase}]` || "";
+ const debug2 = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || NOOP;
+ const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug2);
+ return Object.assign(debugDebugger ? debug2 : info, {
+ label,
+ sibling,
+ info,
+ step
+ });
+ }
+}
+var init_git_logger = __esm({
+ "src/lib/git-logger.ts"() {
+ "use strict";
+ init_utils();
+ debug.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
+ debug.formatters.B = (value) => {
+ if (Buffer.isBuffer(value)) {
+ return value.toString("utf8");
+ }
+ return objectToString(value);
+ };
+ }
+});
+
+// src/lib/runners/tasks-pending-queue.ts
+var _TasksPendingQueue, TasksPendingQueue;
+var init_tasks_pending_queue = __esm({
+ "src/lib/runners/tasks-pending-queue.ts"() {
+ "use strict";
+ init_git_error();
+ init_git_logger();
+ _TasksPendingQueue = class {
+ constructor(logLabel = "GitExecutor") {
+ this.logLabel = logLabel;
+ this._queue = /* @__PURE__ */ new Map();
+ }
+ withProgress(task) {
+ return this._queue.get(task);
+ }
+ createProgress(task) {
+ const name = _TasksPendingQueue.getName(task.commands[0]);
+ const logger = createLogger(this.logLabel, name);
+ return {
+ task,
+ logger,
+ name
+ };
+ }
+ push(task) {
+ const progress = this.createProgress(task);
+ progress.logger("Adding task to the queue, commands = %o", task.commands);
+ this._queue.set(task, progress);
+ return progress;
+ }
+ fatal(err) {
+ for (const [task, { logger }] of Array.from(this._queue.entries())) {
+ if (task === err.task) {
+ logger.info(`Failed %o`, err);
+ logger(
+ `Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`
+ );
+ } else {
+ logger.info(
+ `A fatal exception occurred in a previous task, the queue has been purged: %o`,
+ err.message
+ );
+ }
+ this.complete(task);
+ }
+ if (this._queue.size !== 0) {
+ throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`);
+ }
+ }
+ complete(task) {
+ const progress = this.withProgress(task);
+ if (progress) {
+ this._queue.delete(task);
+ }
+ }
+ attempt(task) {
+ const progress = this.withProgress(task);
+ if (!progress) {
+ throw new GitError(void 0, "TasksPendingQueue: attempt called for an unknown task");
+ }
+ progress.logger("Starting task");
+ return progress;
+ }
+ static getName(name = "empty") {
+ return `task:${name}:${++_TasksPendingQueue.counter}`;
+ }
+ };
+ TasksPendingQueue = _TasksPendingQueue;
+ TasksPendingQueue.counter = 0;
+ }
+});
+
+// src/lib/runners/git-executor-chain.ts
+import { spawn } from "child_process";
+function pluginContext(task, commands) {
+ return {
+ method: first(task.commands) || "",
+ commands
+ };
+}
+function onErrorReceived(target, logger) {
+ return (err) => {
+ logger(`[ERROR] child process exception %o`, err);
+ target.push(Buffer.from(String(err.stack), "ascii"));
+ };
+}
+function onDataReceived(target, name, logger, output) {
+ return (buffer) => {
+ logger(`%s received %L bytes`, name, buffer);
+ output(`%B`, buffer);
+ target.push(buffer);
+ };
+}
+var GitExecutorChain;
+var init_git_executor_chain = __esm({
+ "src/lib/runners/git-executor-chain.ts"() {
+ "use strict";
+ init_git_error();
+ init_task();
+ init_utils();
+ init_tasks_pending_queue();
+ GitExecutorChain = class {
+ constructor(_executor, _scheduler, _plugins) {
+ this._executor = _executor;
+ this._scheduler = _scheduler;
+ this._plugins = _plugins;
+ this._chain = Promise.resolve();
+ this._queue = new TasksPendingQueue();
+ }
+ get cwd() {
+ return this._cwd || this._executor.cwd;
+ }
+ set cwd(cwd) {
+ this._cwd = cwd;
+ }
+ get env() {
+ return this._executor.env;
+ }
+ get outputHandler() {
+ return this._executor.outputHandler;
+ }
+ chain() {
+ return this;
+ }
+ push(task) {
+ this._queue.push(task);
+ return this._chain = this._chain.then(() => this.attemptTask(task));
+ }
+ attemptTask(task) {
+ return __async(this, null, function* () {
+ const onScheduleComplete = yield this._scheduler.next();
+ const onQueueComplete = () => this._queue.complete(task);
+ try {
+ const { logger } = this._queue.attempt(task);
+ return yield isEmptyTask(task) ? this.attemptEmptyTask(task, logger) : this.attemptRemoteTask(task, logger);
+ } catch (e) {
+ throw this.onFatalException(task, e);
+ } finally {
+ onQueueComplete();
+ onScheduleComplete();
+ }
+ });
+ }
+ onFatalException(task, e) {
+ const gitError = e instanceof GitError ? Object.assign(e, { task }) : new GitError(task, e && String(e));
+ this._chain = Promise.resolve();
+ this._queue.fatal(gitError);
+ return gitError;
+ }
+ attemptRemoteTask(task, logger) {
+ return __async(this, null, function* () {
+ const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
+ const args = this._plugins.exec(
+ "spawn.args",
+ [...task.commands],
+ pluginContext(task, task.commands)
+ );
+ const raw = yield this.gitResponse(
+ task,
+ binary,
+ args,
+ this.outputHandler,
+ logger.step("SPAWN")
+ );
+ const outputStreams = yield this.handleTaskData(task, args, raw, logger.step("HANDLE"));
+ logger(`passing response to task's parser as a %s`, task.format);
+ if (isBufferTask(task)) {
+ return callTaskParser(task.parser, outputStreams);
+ }
+ return callTaskParser(task.parser, outputStreams.asStrings());
+ });
+ }
+ attemptEmptyTask(task, logger) {
+ return __async(this, null, function* () {
+ logger(`empty task bypassing child process to call to task's parser`);
+ return task.parser(this);
+ });
+ }
+ handleTaskData(task, args, result, logger) {
+ const { exitCode, rejection, stdOut, stdErr } = result;
+ return new Promise((done, fail) => {
+ logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
+ const { error } = this._plugins.exec(
+ "task.error",
+ { error: rejection },
+ __spreadValues(__spreadValues({}, pluginContext(task, args)), result)
+ );
+ if (error && task.onError) {
+ logger.info(`exitCode=%s handling with custom error handler`);
+ return task.onError(
+ result,
+ error,
+ (newStdOut) => {
+ logger.info(`custom error handler treated as success`);
+ logger(`custom error returned a %s`, objectToString(newStdOut));
+ done(
+ new GitOutputStreams(
+ Array.isArray(newStdOut) ? Buffer.concat(newStdOut) : newStdOut,
+ Buffer.concat(stdErr)
+ )
+ );
+ },
+ fail
+ );
+ }
+ if (error) {
+ logger.info(
+ `handling as error: exitCode=%s stdErr=%s rejection=%o`,
+ exitCode,
+ stdErr.length,
+ rejection
+ );
+ return fail(error);
+ }
+ logger.info(`retrieving task output complete`);
+ done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
+ });
+ }
+ gitResponse(task, command, args, outputHandler, logger) {
+ return __async(this, null, function* () {
+ const outputLogger = logger.sibling("output");
+ const spawnOptions = this._plugins.exec(
+ "spawn.options",
+ {
+ cwd: this.cwd,
+ env: this.env,
+ windowsHide: true
+ },
+ pluginContext(task, task.commands)
+ );
+ return new Promise((done) => {
+ const stdOut = [];
+ const stdErr = [];
+ logger.info(`%s %o`, command, args);
+ logger("%O", spawnOptions);
+ let rejection = this._beforeSpawn(task, args);
+ if (rejection) {
+ return done({
+ stdOut,
+ stdErr,
+ exitCode: 9901,
+ rejection
+ });
+ }
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
+ kill(reason) {
+ rejection = reason || rejection;
+ }
+ }));
+ const spawned = spawn(command, args, spawnOptions);
+ spawned.stdout.on(
+ "data",
+ onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
+ );
+ spawned.stderr.on(
+ "data",
+ onDataReceived(stdErr, "stdErr", logger, outputLogger.step("stdErr"))
+ );
+ spawned.on("error", onErrorReceived(stdErr, logger));
+ if (outputHandler) {
+ logger(`Passing child process stdOut/stdErr to custom outputHandler`);
+ outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
+ }
+ this._plugins.exec("spawn.after", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
+ spawned,
+ close(exitCode, reason) {
+ done({
+ stdOut,
+ stdErr,
+ exitCode,
+ rejection: rejection || reason
+ });
+ },
+ kill(reason) {
+ if (spawned.killed) {
+ return;
+ }
+ rejection = reason;
+ spawned.kill("SIGINT");
+ }
+ }));
+ });
+ });
+ }
+ _beforeSpawn(task, args) {
+ let rejection;
+ this._plugins.exec("spawn.before", void 0, __spreadProps(__spreadValues({}, pluginContext(task, args)), {
+ kill(reason) {
+ rejection = reason || rejection;
+ }
+ }));
+ return rejection;
+ }
+ };
+ }
+});
+
+// src/lib/runners/git-executor.ts
+var git_executor_exports = {};
+__export(git_executor_exports, {
+ GitExecutor: () => GitExecutor
+});
+var GitExecutor;
+var init_git_executor = __esm({
+ "src/lib/runners/git-executor.ts"() {
+ "use strict";
+ init_git_executor_chain();
+ GitExecutor = class {
+ constructor(cwd, _scheduler, _plugins) {
+ this.cwd = cwd;
+ this._scheduler = _scheduler;
+ this._plugins = _plugins;
+ this._chain = new GitExecutorChain(this, this._scheduler, this._plugins);
+ }
+ chain() {
+ return new GitExecutorChain(this, this._scheduler, this._plugins);
+ }
+ push(task) {
+ return this._chain.push(task);
+ }
+ };
+ }
+});
+
+// src/lib/task-callback.ts
+function taskCallback(task, response, callback = NOOP) {
+ const onSuccess = (data) => {
+ callback(null, data);
+ };
+ const onError2 = (err) => {
+ if ((err == null ? void 0 : err.task) === task) {
+ callback(
+ err instanceof GitResponseError ? addDeprecationNoticeToError(err) : err,
+ void 0
+ );
+ }
+ };
+ response.then(onSuccess, onError2);
+}
+function addDeprecationNoticeToError(err) {
+ let log = (name) => {
+ console.warn(
+ `simple-git deprecation notice: accessing GitResponseError.${name} should be GitResponseError.git.${name}, this will no longer be available in version 3`
+ );
+ log = NOOP;
+ };
+ return Object.create(err, Object.getOwnPropertyNames(err.git).reduce(descriptorReducer, {}));
+ function descriptorReducer(all, name) {
+ if (name in err) {
+ return all;
+ }
+ all[name] = {
+ enumerable: false,
+ configurable: false,
+ get() {
+ log(name);
+ return err.git[name];
+ }
+ };
+ return all;
+ }
+}
+var init_task_callback = __esm({
+ "src/lib/task-callback.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_utils();
+ }
+});
+
+// src/lib/tasks/change-working-directory.ts
+function changeWorkingDirectoryTask(directory, root) {
+ return adhocExecTask((instance) => {
+ if (!folderExists(directory)) {
+ throw new Error(`Git.cwd: cannot change to non-directory "${directory}"`);
+ }
+ return (root || instance).cwd = directory;
+ });
+}
+var init_change_working_directory = __esm({
+ "src/lib/tasks/change-working-directory.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/tasks/checkout.ts
+function checkoutTask(args) {
+ const commands = ["checkout", ...args];
+ if (commands[1] === "-b" && commands.includes("-B")) {
+ commands[1] = remove(commands, "-B");
+ }
+ return straightThroughStringTask(commands);
+}
+function checkout_default() {
+ return {
+ checkout() {
+ return this._runTask(
+ checkoutTask(getTrailingOptions(arguments, 1)),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ checkoutBranch(branchName, startPoint) {
+ return this._runTask(
+ checkoutTask(["-b", branchName, startPoint, ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ checkoutLocalBranch(branchName) {
+ return this._runTask(
+ checkoutTask(["-b", branchName, ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var init_checkout = __esm({
+ "src/lib/tasks/checkout.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/parsers/parse-commit.ts
+function parseCommitResult(stdOut) {
+ const result = {
+ author: null,
+ branch: "",
+ commit: "",
+ root: false,
+ summary: {
+ changes: 0,
+ insertions: 0,
+ deletions: 0
+ }
+ };
+ return parseStringResponse(result, parsers, stdOut);
+}
+var parsers;
+var init_parse_commit = __esm({
+ "src/lib/parsers/parse-commit.ts"() {
+ "use strict";
+ init_utils();
+ parsers = [
+ new LineParser(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
+ result.branch = branch;
+ result.commit = commit;
+ result.root = !!root;
+ }),
+ new LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
+ const parts = author.split("<");
+ const email = parts.pop();
+ if (!email || !email.includes("@")) {
+ return;
+ }
+ result.author = {
+ email: email.substr(0, email.length - 1),
+ name: parts.join("<").trim()
+ };
+ }),
+ new LineParser(
+ /(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,
+ (result, [changes, insertions, deletions]) => {
+ result.summary.changes = parseInt(changes, 10) || 0;
+ result.summary.insertions = parseInt(insertions, 10) || 0;
+ result.summary.deletions = parseInt(deletions, 10) || 0;
+ }
+ ),
+ new LineParser(
+ /^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,
+ (result, [changes, lines, direction]) => {
+ result.summary.changes = parseInt(changes, 10) || 0;
+ const count = parseInt(lines, 10) || 0;
+ if (direction === "-") {
+ result.summary.deletions = count;
+ } else if (direction === "+") {
+ result.summary.insertions = count;
+ }
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/tasks/commit.ts
+function commitTask(message, files, customArgs) {
+ const commands = [
+ "-c",
+ "core.abbrev=40",
+ "commit",
+ ...prefixedArray(message, "-m"),
+ ...files,
+ ...customArgs
+ ];
+ return {
+ commands,
+ format: "utf-8",
+ parser: parseCommitResult
+ };
+}
+function commit_default() {
+ return {
+ commit(message, ...rest) {
+ const next = trailingFunctionArgument(arguments);
+ const task = rejectDeprecatedSignatures(message) || commitTask(
+ asArray(message),
+ asArray(filterType(rest[0], filterStringOrStringArray, [])),
+ [...filterType(rest[1], filterArray, []), ...getTrailingOptions(arguments, 0, true)]
+ );
+ return this._runTask(task, next);
+ }
+ };
+ function rejectDeprecatedSignatures(message) {
+ return !filterStringOrStringArray(message) && configurationErrorTask(
+ `git.commit: requires the commit message to be supplied as a string/string[]`
+ );
+ }
+}
+var init_commit = __esm({
+ "src/lib/tasks/commit.ts"() {
+ "use strict";
+ init_parse_commit();
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/tasks/first-commit.ts
+function first_commit_default() {
+ return {
+ firstCommit() {
+ return this._runTask(
+ straightThroughStringTask(["rev-list", "--max-parents=0", "HEAD"], true),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var init_first_commit = __esm({
+ "src/lib/tasks/first-commit.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/tasks/hash-object.ts
+function hashObjectTask(filePath, write) {
+ const commands = ["hash-object", filePath];
+ if (write) {
+ commands.push("-w");
+ }
+ return straightThroughStringTask(commands, true);
+}
+var init_hash_object = __esm({
+ "src/lib/tasks/hash-object.ts"() {
+ "use strict";
+ init_task();
+ }
+});
+
+// src/lib/responses/InitSummary.ts
+function parseInit(bare, path, text) {
+ const response = String(text).trim();
+ let result;
+ if (result = initResponseRegex.exec(response)) {
+ return new InitSummary(bare, path, false, result[1]);
+ }
+ if (result = reInitResponseRegex.exec(response)) {
+ return new InitSummary(bare, path, true, result[1]);
+ }
+ let gitDir = "";
+ const tokens = response.split(" ");
+ while (tokens.length) {
+ const token = tokens.shift();
+ if (token === "in") {
+ gitDir = tokens.join(" ");
+ break;
+ }
+ }
+ return new InitSummary(bare, path, /^re/i.test(response), gitDir);
+}
+var InitSummary, initResponseRegex, reInitResponseRegex;
+var init_InitSummary = __esm({
+ "src/lib/responses/InitSummary.ts"() {
+ "use strict";
+ InitSummary = class {
+ constructor(bare, path, existing, gitDir) {
+ this.bare = bare;
+ this.path = path;
+ this.existing = existing;
+ this.gitDir = gitDir;
+ }
+ };
+ initResponseRegex = /^Init.+ repository in (.+)$/;
+ reInitResponseRegex = /^Rein.+ in (.+)$/;
+ }
+});
+
+// src/lib/tasks/init.ts
+function hasBareCommand(command) {
+ return command.includes(bareCommand);
+}
+function initTask(bare = false, path, customArgs) {
+ const commands = ["init", ...customArgs];
+ if (bare && !hasBareCommand(commands)) {
+ commands.splice(1, 0, bareCommand);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(text) {
+ return parseInit(commands.includes("--bare"), path, text);
+ }
+ };
+}
+var bareCommand;
+var init_init = __esm({
+ "src/lib/tasks/init.ts"() {
+ "use strict";
+ init_InitSummary();
+ bareCommand = "--bare";
+ }
+});
+
+// src/lib/args/log-format.ts
+function logFormatFromCommand(customArgs) {
+ for (let i = 0; i < customArgs.length; i++) {
+ const format = logFormatRegex.exec(customArgs[i]);
+ if (format) {
+ return `--${format[1]}`;
+ }
+ }
+ return "" /* NONE */;
+}
+function isLogFormat(customArg) {
+ return logFormatRegex.test(customArg);
+}
+var logFormatRegex;
+var init_log_format = __esm({
+ "src/lib/args/log-format.ts"() {
+ "use strict";
+ logFormatRegex = /^--(stat|numstat|name-only|name-status)(=|$)/;
+ }
+});
+
+// src/lib/responses/DiffSummary.ts
+var DiffSummary;
+var init_DiffSummary = __esm({
+ "src/lib/responses/DiffSummary.ts"() {
+ "use strict";
+ DiffSummary = class {
+ constructor() {
+ this.changed = 0;
+ this.deletions = 0;
+ this.insertions = 0;
+ this.files = [];
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-diff-summary.ts
+function getDiffParser(format = "" /* NONE */) {
+ const parser3 = diffSummaryParsers[format];
+ return (stdOut) => parseStringResponse(new DiffSummary(), parser3, stdOut, false);
+}
+var statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers;
+var init_parse_diff_summary = __esm({
+ "src/lib/parsers/parse-diff-summary.ts"() {
+ "use strict";
+ init_log_format();
+ init_DiffSummary();
+ init_diff_name_status();
+ init_utils();
+ statParser = [
+ new LineParser(
+ /^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,
+ (result, [file, changes, alterations = ""]) => {
+ result.files.push({
+ file: file.trim(),
+ changes: asNumber(changes),
+ insertions: alterations.replace(/[^+]/g, "").length,
+ deletions: alterations.replace(/[^-]/g, "").length,
+ binary: false
+ });
+ }
+ ),
+ new LineParser(
+ /^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,
+ (result, [file, before, after]) => {
+ result.files.push({
+ file: file.trim(),
+ before: asNumber(before),
+ after: asNumber(after),
+ binary: true
+ });
+ }
+ ),
+ new LineParser(
+ /(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,
+ (result, [changed, summary]) => {
+ const inserted = /(\d+) i/.exec(summary);
+ const deleted = /(\d+) d/.exec(summary);
+ result.changed = asNumber(changed);
+ result.insertions = asNumber(inserted == null ? void 0 : inserted[1]);
+ result.deletions = asNumber(deleted == null ? void 0 : deleted[1]);
+ }
+ )
+ ];
+ numStatParser = [
+ new LineParser(
+ /(\d+)\t(\d+)\t(.+)$/,
+ (result, [changesInsert, changesDelete, file]) => {
+ const insertions = asNumber(changesInsert);
+ const deletions = asNumber(changesDelete);
+ result.changed++;
+ result.insertions += insertions;
+ result.deletions += deletions;
+ result.files.push({
+ file,
+ changes: insertions + deletions,
+ insertions,
+ deletions,
+ binary: false
+ });
+ }
+ ),
+ new LineParser(/-\t-\t(.+)$/, (result, [file]) => {
+ result.changed++;
+ result.files.push({
+ file,
+ after: 0,
+ before: 0,
+ binary: true
+ });
+ })
+ ];
+ nameOnlyParser = [
+ new LineParser(/(.+)$/, (result, [file]) => {
+ result.changed++;
+ result.files.push({
+ file,
+ changes: 0,
+ insertions: 0,
+ deletions: 0,
+ binary: false
+ });
+ })
+ ];
+ nameStatusParser = [
+ new LineParser(
+ /([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,
+ (result, [status, _similarity, from, _to, to]) => {
+ result.changed++;
+ result.files.push({
+ file: to != null ? to : from,
+ changes: 0,
+ status: orVoid(isDiffNameStatus(status) && status),
+ insertions: 0,
+ deletions: 0,
+ binary: false
+ });
+ }
+ )
+ ];
+ diffSummaryParsers = {
+ ["" /* NONE */]: statParser,
+ ["--stat" /* STAT */]: statParser,
+ ["--numstat" /* NUM_STAT */]: numStatParser,
+ ["--name-status" /* NAME_STATUS */]: nameStatusParser,
+ ["--name-only" /* NAME_ONLY */]: nameOnlyParser
+ };
+ }
+});
+
+// src/lib/parsers/parse-list-log-summary.ts
+function lineBuilder(tokens, fields) {
+ return fields.reduce(
+ (line, field, index) => {
+ line[field] = tokens[index] || "";
+ return line;
+ },
+ /* @__PURE__ */ Object.create({ diff: null })
+ );
+}
+function createListLogSummaryParser(splitter = SPLITTER, fields = defaultFieldNames, logFormat = "" /* NONE */) {
+ const parseDiffResult = getDiffParser(logFormat);
+ return function(stdOut) {
+ const all = toLinesWithContent(
+ stdOut,
+ true,
+ START_BOUNDARY
+ ).map(function(item) {
+ const lineDetail = item.trim().split(COMMIT_BOUNDARY);
+ const listLogLine = lineBuilder(
+ lineDetail[0].trim().split(splitter),
+ fields
+ );
+ if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
+ listLogLine.diff = parseDiffResult(lineDetail[1]);
+ }
+ return listLogLine;
+ });
+ return {
+ all,
+ latest: all.length && all[0] || null,
+ total: all.length
+ };
+ };
+}
+var START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames;
+var init_parse_list_log_summary = __esm({
+ "src/lib/parsers/parse-list-log-summary.ts"() {
+ "use strict";
+ init_utils();
+ init_parse_diff_summary();
+ init_log_format();
+ START_BOUNDARY = "\xF2\xF2\xF2\xF2\xF2\xF2 ";
+ COMMIT_BOUNDARY = " \xF2\xF2";
+ SPLITTER = " \xF2 ";
+ defaultFieldNames = ["hash", "date", "message", "refs", "author_name", "author_email"];
+ }
+});
+
+// src/lib/tasks/diff.ts
+var diff_exports = {};
+__export(diff_exports, {
+ diffSummaryTask: () => diffSummaryTask,
+ validateLogFormatConfig: () => validateLogFormatConfig
+});
+function diffSummaryTask(customArgs) {
+ let logFormat = logFormatFromCommand(customArgs);
+ const commands = ["diff"];
+ if (logFormat === "" /* NONE */) {
+ logFormat = "--stat" /* STAT */;
+ commands.push("--stat=4096");
+ }
+ commands.push(...customArgs);
+ return validateLogFormatConfig(commands) || {
+ commands,
+ format: "utf-8",
+ parser: getDiffParser(logFormat)
+ };
+}
+function validateLogFormatConfig(customArgs) {
+ const flags = customArgs.filter(isLogFormat);
+ if (flags.length > 1) {
+ return configurationErrorTask(
+ `Summary flags are mutually exclusive - pick one of ${flags.join(",")}`
+ );
+ }
+ if (flags.length && customArgs.includes("-z")) {
+ return configurationErrorTask(
+ `Summary flag ${flags} parsing is not compatible with null termination option '-z'`
+ );
+ }
+}
+var init_diff = __esm({
+ "src/lib/tasks/diff.ts"() {
+ "use strict";
+ init_log_format();
+ init_parse_diff_summary();
+ init_task();
+ }
+});
+
+// src/lib/tasks/log.ts
+function prettyFormat(format, splitter) {
+ const fields = [];
+ const formatStr = [];
+ Object.keys(format).forEach((field) => {
+ fields.push(field);
+ formatStr.push(String(format[field]));
+ });
+ return [fields, formatStr.join(splitter)];
+}
+function userOptions(input) {
+ return Object.keys(input).reduce((out, key) => {
+ if (!(key in excludeOptions)) {
+ out[key] = input[key];
+ }
+ return out;
+ }, {});
+}
+function parseLogOptions(opt = {}, customArgs = []) {
+ const splitter = filterType(opt.splitter, filterString, SPLITTER);
+ const format = !filterPrimitives(opt.format) && opt.format ? opt.format : {
+ hash: "%H",
+ date: opt.strictDate === false ? "%ai" : "%aI",
+ message: "%s",
+ refs: "%D",
+ body: opt.multiLine ? "%B" : "%b",
+ author_name: opt.mailMap !== false ? "%aN" : "%an",
+ author_email: opt.mailMap !== false ? "%aE" : "%ae"
+ };
+ const [fields, formatStr] = prettyFormat(format, splitter);
+ const suffix = [];
+ const command = [
+ `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,
+ ...customArgs
+ ];
+ const maxCount = opt.n || opt["max-count"] || opt.maxCount;
+ if (maxCount) {
+ command.push(`--max-count=${maxCount}`);
+ }
+ if (opt.from || opt.to) {
+ const rangeOperator = opt.symmetric !== false ? "..." : "..";
+ suffix.push(`${opt.from || ""}${rangeOperator}${opt.to || ""}`);
+ }
+ if (filterString(opt.file)) {
+ command.push("--follow", pathspec(opt.file));
+ }
+ appendTaskOptions(userOptions(opt), command);
+ return {
+ fields,
+ splitter,
+ commands: [...command, ...suffix]
+ };
+}
+function logTask(splitter, fields, customArgs) {
+ const parser3 = createListLogSummaryParser(splitter, fields, logFormatFromCommand(customArgs));
+ return {
+ commands: ["log", ...customArgs],
+ format: "utf-8",
+ parser: parser3
+ };
+}
+function log_default() {
+ return {
+ log(...rest) {
+ const next = trailingFunctionArgument(arguments);
+ const options = parseLogOptions(
+ trailingOptionsArgument(arguments),
+ filterType(arguments[0], filterArray)
+ );
+ const task = rejectDeprecatedSignatures(...rest) || validateLogFormatConfig(options.commands) || createLogTask(options);
+ return this._runTask(task, next);
+ }
+ };
+ function createLogTask(options) {
+ return logTask(options.splitter, options.fields, options.commands);
+ }
+ function rejectDeprecatedSignatures(from, to) {
+ return filterString(from) && filterString(to) && configurationErrorTask(
+ `git.log(string, string) should be replaced with git.log({ from: string, to: string })`
+ );
+ }
+}
+var excludeOptions;
+var init_log = __esm({
+ "src/lib/tasks/log.ts"() {
+ "use strict";
+ init_log_format();
+ init_pathspec();
+ init_parse_list_log_summary();
+ init_utils();
+ init_task();
+ init_diff();
+ excludeOptions = /* @__PURE__ */ ((excludeOptions2) => {
+ excludeOptions2[excludeOptions2["--pretty"] = 0] = "--pretty";
+ excludeOptions2[excludeOptions2["max-count"] = 1] = "max-count";
+ excludeOptions2[excludeOptions2["maxCount"] = 2] = "maxCount";
+ excludeOptions2[excludeOptions2["n"] = 3] = "n";
+ excludeOptions2[excludeOptions2["file"] = 4] = "file";
+ excludeOptions2[excludeOptions2["format"] = 5] = "format";
+ excludeOptions2[excludeOptions2["from"] = 6] = "from";
+ excludeOptions2[excludeOptions2["to"] = 7] = "to";
+ excludeOptions2[excludeOptions2["splitter"] = 8] = "splitter";
+ excludeOptions2[excludeOptions2["symmetric"] = 9] = "symmetric";
+ excludeOptions2[excludeOptions2["mailMap"] = 10] = "mailMap";
+ excludeOptions2[excludeOptions2["multiLine"] = 11] = "multiLine";
+ excludeOptions2[excludeOptions2["strictDate"] = 12] = "strictDate";
+ return excludeOptions2;
+ })(excludeOptions || {});
+ }
+});
+
+// src/lib/responses/MergeSummary.ts
+var MergeSummaryConflict, MergeSummaryDetail;
+var init_MergeSummary = __esm({
+ "src/lib/responses/MergeSummary.ts"() {
+ "use strict";
+ MergeSummaryConflict = class {
+ constructor(reason, file = null, meta) {
+ this.reason = reason;
+ this.file = file;
+ this.meta = meta;
+ }
+ toString() {
+ return `${this.file}:${this.reason}`;
+ }
+ };
+ MergeSummaryDetail = class {
+ constructor() {
+ this.conflicts = [];
+ this.merges = [];
+ this.result = "success";
+ }
+ get failed() {
+ return this.conflicts.length > 0;
+ }
+ get reason() {
+ return this.result;
+ }
+ toString() {
+ if (this.conflicts.length) {
+ return `CONFLICTS: ${this.conflicts.join(", ")}`;
+ }
+ return "OK";
+ }
+ };
+ }
+});
+
+// src/lib/responses/PullSummary.ts
+var PullSummary, PullFailedSummary;
+var init_PullSummary = __esm({
+ "src/lib/responses/PullSummary.ts"() {
+ "use strict";
+ PullSummary = class {
+ constructor() {
+ this.remoteMessages = {
+ all: []
+ };
+ this.created = [];
+ this.deleted = [];
+ this.files = [];
+ this.deletions = {};
+ this.insertions = {};
+ this.summary = {
+ changes: 0,
+ deletions: 0,
+ insertions: 0
+ };
+ }
+ };
+ PullFailedSummary = class {
+ constructor() {
+ this.remote = "";
+ this.hash = {
+ local: "",
+ remote: ""
+ };
+ this.branch = {
+ local: "",
+ remote: ""
+ };
+ this.message = "";
+ }
+ toString() {
+ return this.message;
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-remote-objects.ts
+function objectEnumerationResult(remoteMessages) {
+ return remoteMessages.objects = remoteMessages.objects || {
+ compressing: 0,
+ counting: 0,
+ enumerating: 0,
+ packReused: 0,
+ reused: { count: 0, delta: 0 },
+ total: { count: 0, delta: 0 }
+ };
+}
+function asObjectCount(source) {
+ const count = /^\s*(\d+)/.exec(source);
+ const delta = /delta (\d+)/i.exec(source);
+ return {
+ count: asNumber(count && count[1] || "0"),
+ delta: asNumber(delta && delta[1] || "0")
+ };
+}
+var remoteMessagesObjectParsers;
+var init_parse_remote_objects = __esm({
+ "src/lib/parsers/parse-remote-objects.ts"() {
+ "use strict";
+ init_utils();
+ remoteMessagesObjectParsers = [
+ new RemoteLineParser(
+ /^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,
+ (result, [action, count]) => {
+ const key = action.toLowerCase();
+ const enumeration = objectEnumerationResult(result.remoteMessages);
+ Object.assign(enumeration, { [key]: asNumber(count) });
+ }
+ ),
+ new RemoteLineParser(
+ /^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,
+ (result, [action, count]) => {
+ const key = action.toLowerCase();
+ const enumeration = objectEnumerationResult(result.remoteMessages);
+ Object.assign(enumeration, { [key]: asNumber(count) });
+ }
+ ),
+ new RemoteLineParser(
+ /total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,
+ (result, [total, reused, packReused]) => {
+ const objects = objectEnumerationResult(result.remoteMessages);
+ objects.total = asObjectCount(total);
+ objects.reused = asObjectCount(reused);
+ objects.packReused = asNumber(packReused);
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/parsers/parse-remote-messages.ts
+function parseRemoteMessages(_stdOut, stdErr) {
+ return parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers2, stdErr);
+}
+var parsers2, RemoteMessageSummary;
+var init_parse_remote_messages = __esm({
+ "src/lib/parsers/parse-remote-messages.ts"() {
+ "use strict";
+ init_utils();
+ init_parse_remote_objects();
+ parsers2 = [
+ new RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
+ result.remoteMessages.all.push(text.trim());
+ return false;
+ }),
+ ...remoteMessagesObjectParsers,
+ new RemoteLineParser(
+ [/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/],
+ (result, [pullRequestUrl]) => {
+ result.remoteMessages.pullRequestUrl = pullRequestUrl;
+ }
+ ),
+ new RemoteLineParser(
+ [/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/],
+ (result, [count, summary, url]) => {
+ result.remoteMessages.vulnerabilities = {
+ count: asNumber(count),
+ summary,
+ url
+ };
+ }
+ )
+ ];
+ RemoteMessageSummary = class {
+ constructor() {
+ this.all = [];
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-pull.ts
+function parsePullErrorResult(stdOut, stdErr) {
+ const pullError = parseStringResponse(new PullFailedSummary(), errorParsers, [stdOut, stdErr]);
+ return pullError.message && pullError;
+}
+var FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult;
+var init_parse_pull = __esm({
+ "src/lib/parsers/parse-pull.ts"() {
+ "use strict";
+ init_PullSummary();
+ init_utils();
+ init_parse_remote_messages();
+ FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
+ SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
+ ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
+ parsers3 = [
+ new LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
+ result.files.push(file);
+ if (insertions) {
+ result.insertions[file] = insertions.length;
+ }
+ if (deletions) {
+ result.deletions[file] = deletions.length;
+ }
+ }),
+ new LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
+ if (insertions !== void 0 || deletions !== void 0) {
+ result.summary.changes = +changes || 0;
+ result.summary.insertions = +insertions || 0;
+ result.summary.deletions = +deletions || 0;
+ return true;
+ }
+ return false;
+ }),
+ new LineParser(ACTION_REGEX, (result, [action, file]) => {
+ append(result.files, file);
+ append(action === "create" ? result.created : result.deleted, file);
+ })
+ ];
+ errorParsers = [
+ new LineParser(/^from\s(.+)$/i, (result, [remote]) => void (result.remote = remote)),
+ new LineParser(/^fatal:\s(.+)$/, (result, [message]) => void (result.message = message)),
+ new LineParser(
+ /([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,
+ (result, [hashLocal, hashRemote, branchLocal, branchRemote]) => {
+ result.branch.local = branchLocal;
+ result.hash.local = hashLocal;
+ result.branch.remote = branchRemote;
+ result.hash.remote = hashRemote;
+ }
+ )
+ ];
+ parsePullDetail = (stdOut, stdErr) => {
+ return parseStringResponse(new PullSummary(), parsers3, [stdOut, stdErr]);
+ };
+ parsePullResult = (stdOut, stdErr) => {
+ return Object.assign(
+ new PullSummary(),
+ parsePullDetail(stdOut, stdErr),
+ parseRemoteMessages(stdOut, stdErr)
+ );
+ };
+ }
+});
+
+// src/lib/parsers/parse-merge.ts
+var parsers4, parseMergeResult, parseMergeDetail;
+var init_parse_merge = __esm({
+ "src/lib/parsers/parse-merge.ts"() {
+ "use strict";
+ init_MergeSummary();
+ init_utils();
+ init_parse_pull();
+ parsers4 = [
+ new LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
+ summary.merges.push(autoMerge);
+ }),
+ new LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, file));
+ }),
+ new LineParser(
+ /^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,
+ (summary, [reason, file, deleteRef]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, file, { deleteRef }));
+ }
+ ),
+ new LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
+ summary.conflicts.push(new MergeSummaryConflict(reason, null));
+ }),
+ new LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
+ summary.result = result;
+ })
+ ];
+ parseMergeResult = (stdOut, stdErr) => {
+ return Object.assign(parseMergeDetail(stdOut, stdErr), parsePullResult(stdOut, stdErr));
+ };
+ parseMergeDetail = (stdOut) => {
+ return parseStringResponse(new MergeSummaryDetail(), parsers4, stdOut);
+ };
+ }
+});
+
+// src/lib/tasks/merge.ts
+function mergeTask(customArgs) {
+ if (!customArgs.length) {
+ return configurationErrorTask("Git.merge requires at least one option");
+ }
+ return {
+ commands: ["merge", ...customArgs],
+ format: "utf-8",
+ parser(stdOut, stdErr) {
+ const merge = parseMergeResult(stdOut, stdErr);
+ if (merge.failed) {
+ throw new GitResponseError(merge);
+ }
+ return merge;
+ }
+ };
+}
+var init_merge = __esm({
+ "src/lib/tasks/merge.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_parse_merge();
+ init_task();
+ }
+});
+
+// src/lib/parsers/parse-push.ts
+function pushResultPushedItem(local, remote, status) {
+ const deleted = status.includes("deleted");
+ const tag = status.includes("tag") || /^refs\/tags/.test(local);
+ const alreadyUpdated = !status.includes("new");
+ return {
+ deleted,
+ tag,
+ branch: !tag,
+ new: !alreadyUpdated,
+ alreadyUpdated,
+ local,
+ remote
+ };
+}
+var parsers5, parsePushResult, parsePushDetail;
+var init_parse_push = __esm({
+ "src/lib/parsers/parse-push.ts"() {
+ "use strict";
+ init_utils();
+ init_parse_remote_messages();
+ parsers5 = [
+ new LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
+ result.repo = repo;
+ }),
+ new LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
+ result.ref = __spreadProps(__spreadValues({}, result.ref || {}), {
+ local
+ });
+ }),
+ new LineParser(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
+ result.pushed.push(pushResultPushedItem(local, remote, type));
+ }),
+ new LineParser(
+ /^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,
+ (result, [local, remote, remoteName]) => {
+ result.branch = __spreadProps(__spreadValues({}, result.branch || {}), {
+ local,
+ remote,
+ remoteName
+ });
+ }
+ ),
+ new LineParser(
+ /^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,
+ (result, [local, remote, from, to]) => {
+ result.update = {
+ head: {
+ local,
+ remote
+ },
+ hash: {
+ from,
+ to
+ }
+ };
+ }
+ )
+ ];
+ parsePushResult = (stdOut, stdErr) => {
+ const pushDetail = parsePushDetail(stdOut, stdErr);
+ const responseDetail = parseRemoteMessages(stdOut, stdErr);
+ return __spreadValues(__spreadValues({}, pushDetail), responseDetail);
+ };
+ parsePushDetail = (stdOut, stdErr) => {
+ return parseStringResponse({ pushed: [] }, parsers5, [stdOut, stdErr]);
+ };
+ }
+});
+
+// src/lib/tasks/push.ts
+var push_exports = {};
+__export(push_exports, {
+ pushTagsTask: () => pushTagsTask,
+ pushTask: () => pushTask
+});
+function pushTagsTask(ref = {}, customArgs) {
+ append(customArgs, "--tags");
+ return pushTask(ref, customArgs);
+}
+function pushTask(ref = {}, customArgs) {
+ const commands = ["push", ...customArgs];
+ if (ref.branch) {
+ commands.splice(1, 0, ref.branch);
+ }
+ if (ref.remote) {
+ commands.splice(1, 0, ref.remote);
+ }
+ remove(commands, "-v");
+ append(commands, "--verbose");
+ append(commands, "--porcelain");
+ return {
+ commands,
+ format: "utf-8",
+ parser: parsePushResult
+ };
+}
+var init_push = __esm({
+ "src/lib/tasks/push.ts"() {
+ "use strict";
+ init_parse_push();
+ init_utils();
+ }
+});
+
+// src/lib/tasks/show.ts
+function show_default() {
+ return {
+ showBuffer() {
+ const commands = ["show", ...getTrailingOptions(arguments, 1)];
+ if (!commands.includes("--binary")) {
+ commands.splice(1, 0, "--binary");
+ }
+ return this._runTask(
+ straightThroughBufferTask(commands),
+ trailingFunctionArgument(arguments)
+ );
+ },
+ show() {
+ const commands = ["show", ...getTrailingOptions(arguments, 1)];
+ return this._runTask(
+ straightThroughStringTask(commands),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+}
+var init_show = __esm({
+ "src/lib/tasks/show.ts"() {
+ "use strict";
+ init_utils();
+ init_task();
+ }
+});
+
+// src/lib/responses/FileStatusSummary.ts
+var fromPathRegex, FileStatusSummary;
+var init_FileStatusSummary = __esm({
+ "src/lib/responses/FileStatusSummary.ts"() {
+ "use strict";
+ fromPathRegex = /^(.+) -> (.+)$/;
+ FileStatusSummary = class {
+ constructor(path, index, working_dir) {
+ this.path = path;
+ this.index = index;
+ this.working_dir = working_dir;
+ if ("R" === index + working_dir) {
+ const detail = fromPathRegex.exec(path) || [null, path, path];
+ this.from = detail[1] || "";
+ this.path = detail[2] || "";
+ }
+ }
+ };
+ }
+});
+
+// src/lib/responses/StatusSummary.ts
+function renamedFile(line) {
+ const [to, from] = line.split(NULL);
+ return {
+ from: from || to,
+ to
+ };
+}
+function parser2(indexX, indexY, handler) {
+ return [`${indexX}${indexY}`, handler];
+}
+function conflicts(indexX, ...indexY) {
+ return indexY.map((y) => parser2(indexX, y, (result, file) => append(result.conflicted, file)));
+}
+function splitLine(result, lineStr) {
+ const trimmed2 = lineStr.trim();
+ switch (" ") {
+ case trimmed2.charAt(2):
+ return data(trimmed2.charAt(0), trimmed2.charAt(1), trimmed2.substr(3));
+ case trimmed2.charAt(1):
+ return data(" " /* NONE */, trimmed2.charAt(0), trimmed2.substr(2));
+ default:
+ return;
+ }
+ function data(index, workingDir, path) {
+ const raw = `${index}${workingDir}`;
+ const handler = parsers6.get(raw);
+ if (handler) {
+ handler(result, path);
+ }
+ if (raw !== "##" && raw !== "!!") {
+ result.files.push(new FileStatusSummary(path.replace(/\0.+$/, ""), index, workingDir));
+ }
+ }
+}
+var StatusSummary, parsers6, parseStatusSummary;
+var init_StatusSummary = __esm({
+ "src/lib/responses/StatusSummary.ts"() {
+ "use strict";
+ init_utils();
+ init_FileStatusSummary();
+ StatusSummary = class {
+ constructor() {
+ this.not_added = [];
+ this.conflicted = [];
+ this.created = [];
+ this.deleted = [];
+ this.ignored = void 0;
+ this.modified = [];
+ this.renamed = [];
+ this.files = [];
+ this.staged = [];
+ this.ahead = 0;
+ this.behind = 0;
+ this.current = null;
+ this.tracking = null;
+ this.detached = false;
+ this.isClean = () => {
+ return !this.files.length;
+ };
+ }
+ };
+ parsers6 = new Map([
+ parser2(
+ " " /* NONE */,
+ "A" /* ADDED */,
+ (result, file) => append(result.created, file)
+ ),
+ parser2(
+ " " /* NONE */,
+ "D" /* DELETED */,
+ (result, file) => append(result.deleted, file)
+ ),
+ parser2(
+ " " /* NONE */,
+ "M" /* MODIFIED */,
+ (result, file) => append(result.modified, file)
+ ),
+ parser2(
+ "A" /* ADDED */,
+ " " /* NONE */,
+ (result, file) => append(result.created, file) && append(result.staged, file)
+ ),
+ parser2(
+ "A" /* ADDED */,
+ "M" /* MODIFIED */,
+ (result, file) => append(result.created, file) && append(result.staged, file) && append(result.modified, file)
+ ),
+ parser2(
+ "D" /* DELETED */,
+ " " /* NONE */,
+ (result, file) => append(result.deleted, file) && append(result.staged, file)
+ ),
+ parser2(
+ "M" /* MODIFIED */,
+ " " /* NONE */,
+ (result, file) => append(result.modified, file) && append(result.staged, file)
+ ),
+ parser2(
+ "M" /* MODIFIED */,
+ "M" /* MODIFIED */,
+ (result, file) => append(result.modified, file) && append(result.staged, file)
+ ),
+ parser2("R" /* RENAMED */, " " /* NONE */, (result, file) => {
+ append(result.renamed, renamedFile(file));
+ }),
+ parser2("R" /* RENAMED */, "M" /* MODIFIED */, (result, file) => {
+ const renamed = renamedFile(file);
+ append(result.renamed, renamed);
+ append(result.modified, renamed.to);
+ }),
+ parser2("!" /* IGNORED */, "!" /* IGNORED */, (_result, _file) => {
+ append(_result.ignored = _result.ignored || [], _file);
+ }),
+ parser2(
+ "?" /* UNTRACKED */,
+ "?" /* UNTRACKED */,
+ (result, file) => append(result.not_added, file)
+ ),
+ ...conflicts("A" /* ADDED */, "A" /* ADDED */, "U" /* UNMERGED */),
+ ...conflicts(
+ "D" /* DELETED */,
+ "D" /* DELETED */,
+ "U" /* UNMERGED */
+ ),
+ ...conflicts(
+ "U" /* UNMERGED */,
+ "A" /* ADDED */,
+ "D" /* DELETED */,
+ "U" /* UNMERGED */
+ ),
+ [
+ "##",
+ (result, line) => {
+ const aheadReg = /ahead (\d+)/;
+ const behindReg = /behind (\d+)/;
+ const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
+ const trackingReg = /\.{3}(\S*)/;
+ const onEmptyBranchReg = /\son\s([\S]+)$/;
+ let regexResult;
+ regexResult = aheadReg.exec(line);
+ result.ahead = regexResult && +regexResult[1] || 0;
+ regexResult = behindReg.exec(line);
+ result.behind = regexResult && +regexResult[1] || 0;
+ regexResult = currentReg.exec(line);
+ result.current = regexResult && regexResult[1];
+ regexResult = trackingReg.exec(line);
+ result.tracking = regexResult && regexResult[1];
+ regexResult = onEmptyBranchReg.exec(line);
+ result.current = regexResult && regexResult[1] || result.current;
+ result.detached = /\(no branch\)/.test(line);
+ }
+ ]
+ ]);
+ parseStatusSummary = function(text) {
+ const lines = text.split(NULL);
+ const status = new StatusSummary();
+ for (let i = 0, l = lines.length; i < l; ) {
+ let line = lines[i++].trim();
+ if (!line) {
+ continue;
+ }
+ if (line.charAt(0) === "R" /* RENAMED */) {
+ line += NULL + (lines[i++] || "");
+ }
+ splitLine(status, line);
+ }
+ return status;
+ };
+ }
+});
+
+// src/lib/tasks/status.ts
+function statusTask(customArgs) {
+ const commands = [
+ "status",
+ "--porcelain",
+ "-b",
+ "-u",
+ "--null",
+ ...customArgs.filter((arg) => !ignoredOptions.includes(arg))
+ ];
+ return {
+ format: "utf-8",
+ commands,
+ parser(text) {
+ return parseStatusSummary(text);
+ }
+ };
+}
+var ignoredOptions;
+var init_status = __esm({
+ "src/lib/tasks/status.ts"() {
+ "use strict";
+ init_StatusSummary();
+ ignoredOptions = ["--null", "-z"];
+ }
+});
+
+// src/lib/tasks/version.ts
+function versionResponse(major = 0, minor = 0, patch = 0, agent = "", installed = true) {
+ return Object.defineProperty(
+ {
+ major,
+ minor,
+ patch,
+ agent,
+ installed
+ },
+ "toString",
+ {
+ value() {
+ return `${this.major}.${this.minor}.${this.patch}`;
+ },
+ configurable: false,
+ enumerable: false
+ }
+ );
+}
+function notInstalledResponse() {
+ return versionResponse(0, 0, 0, "", false);
+}
+function version_default() {
+ return {
+ version() {
+ return this._runTask({
+ commands: ["--version"],
+ format: "utf-8",
+ parser: versionParser,
+ onError(result, error, done, fail) {
+ if (result.exitCode === -2 /* NOT_FOUND */) {
+ return done(Buffer.from(NOT_INSTALLED));
+ }
+ fail(error);
+ }
+ });
+ }
+ };
+}
+function versionParser(stdOut) {
+ if (stdOut === NOT_INSTALLED) {
+ return notInstalledResponse();
+ }
+ return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);
+}
+var NOT_INSTALLED, parsers7;
+var init_version = __esm({
+ "src/lib/tasks/version.ts"() {
+ "use strict";
+ init_utils();
+ NOT_INSTALLED = "installed=false";
+ parsers7 = [
+ new LineParser(
+ /version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,
+ (result, [major, minor, patch, agent = ""]) => {
+ Object.assign(
+ result,
+ versionResponse(asNumber(major), asNumber(minor), asNumber(patch), agent)
+ );
+ }
+ ),
+ new LineParser(
+ /version (\d+)\.(\d+)\.(\D+)(.+)?$/,
+ (result, [major, minor, patch, agent = ""]) => {
+ Object.assign(result, versionResponse(asNumber(major), asNumber(minor), patch, agent));
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/simple-git-api.ts
+var simple_git_api_exports = {};
+__export(simple_git_api_exports, {
+ SimpleGitApi: () => SimpleGitApi
+});
+var SimpleGitApi;
+var init_simple_git_api = __esm({
+ "src/lib/simple-git-api.ts"() {
+ "use strict";
+ init_task_callback();
+ init_change_working_directory();
+ init_checkout();
+ init_commit();
+ init_config();
+ init_first_commit();
+ init_grep();
+ init_hash_object();
+ init_init();
+ init_log();
+ init_merge();
+ init_push();
+ init_show();
+ init_status();
+ init_task();
+ init_version();
+ init_utils();
+ SimpleGitApi = class {
+ constructor(_executor) {
+ this._executor = _executor;
+ }
+ _runTask(task, then) {
+ const chain = this._executor.chain();
+ const promise = chain.push(task);
+ if (then) {
+ taskCallback(task, promise, then);
+ }
+ return Object.create(this, {
+ then: { value: promise.then.bind(promise) },
+ catch: { value: promise.catch.bind(promise) },
+ _executor: { value: chain }
+ });
+ }
+ add(files) {
+ return this._runTask(
+ straightThroughStringTask(["add", ...asArray(files)]),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ cwd(directory) {
+ const next = trailingFunctionArgument(arguments);
+ if (typeof directory === "string") {
+ return this._runTask(changeWorkingDirectoryTask(directory, this._executor), next);
+ }
+ if (typeof (directory == null ? void 0 : directory.path) === "string") {
+ return this._runTask(
+ changeWorkingDirectoryTask(
+ directory.path,
+ directory.root && this._executor || void 0
+ ),
+ next
+ );
+ }
+ return this._runTask(
+ configurationErrorTask("Git.cwd: workingDirectory must be supplied as a string"),
+ next
+ );
+ }
+ hashObject(path, write) {
+ return this._runTask(
+ hashObjectTask(path, write === true),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ init(bare) {
+ return this._runTask(
+ initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ merge() {
+ return this._runTask(
+ mergeTask(getTrailingOptions(arguments)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ mergeFromTo(remote, branch) {
+ if (!(filterString(remote) && filterString(branch))) {
+ return this._runTask(
+ configurationErrorTask(
+ `Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`
+ )
+ );
+ }
+ return this._runTask(
+ mergeTask([remote, branch, ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments, false)
+ );
+ }
+ outputHandler(handler) {
+ this._executor.outputHandler = handler;
+ return this;
+ }
+ push() {
+ const task = pushTask(
+ {
+ remote: filterType(arguments[0], filterString),
+ branch: filterType(arguments[1], filterString)
+ },
+ getTrailingOptions(arguments)
+ );
+ return this._runTask(task, trailingFunctionArgument(arguments));
+ }
+ stash() {
+ return this._runTask(
+ straightThroughStringTask(["stash", ...getTrailingOptions(arguments)]),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ status() {
+ return this._runTask(
+ statusTask(getTrailingOptions(arguments)),
+ trailingFunctionArgument(arguments)
+ );
+ }
+ };
+ Object.assign(
+ SimpleGitApi.prototype,
+ checkout_default(),
+ commit_default(),
+ config_default(),
+ first_commit_default(),
+ grep_default(),
+ log_default(),
+ show_default(),
+ version_default()
+ );
+ }
+});
+
+// src/lib/runners/scheduler.ts
+var scheduler_exports = {};
+__export(scheduler_exports, {
+ Scheduler: () => Scheduler
+});
+import { createDeferred } from "@kwsites/promise-deferred";
+var createScheduledTask, Scheduler;
+var init_scheduler = __esm({
+ "src/lib/runners/scheduler.ts"() {
+ "use strict";
+ init_utils();
+ init_git_logger();
+ createScheduledTask = (() => {
+ let id = 0;
+ return () => {
+ id++;
+ const { promise, done } = createDeferred();
+ return {
+ promise,
+ done,
+ id
+ };
+ };
+ })();
+ Scheduler = class {
+ constructor(concurrency = 2) {
+ this.concurrency = concurrency;
+ this.logger = createLogger("", "scheduler");
+ this.pending = [];
+ this.running = [];
+ this.logger(`Constructed, concurrency=%s`, concurrency);
+ }
+ schedule() {
+ if (!this.pending.length || this.running.length >= this.concurrency) {
+ this.logger(
+ `Schedule attempt ignored, pending=%s running=%s concurrency=%s`,
+ this.pending.length,
+ this.running.length,
+ this.concurrency
+ );
+ return;
+ }
+ const task = append(this.running, this.pending.shift());
+ this.logger(`Attempting id=%s`, task.id);
+ task.done(() => {
+ this.logger(`Completing id=`, task.id);
+ remove(this.running, task);
+ this.schedule();
+ });
+ }
+ next() {
+ const { promise, id } = append(this.pending, createScheduledTask());
+ this.logger(`Scheduling id=%s`, id);
+ this.schedule();
+ return promise;
+ }
+ };
+ }
+});
+
+// src/lib/tasks/apply-patch.ts
+var apply_patch_exports = {};
+__export(apply_patch_exports, {
+ applyPatchTask: () => applyPatchTask
+});
+function applyPatchTask(patches, customArgs) {
+ return straightThroughStringTask(["apply", ...customArgs, ...patches]);
+}
+var init_apply_patch = __esm({
+ "src/lib/tasks/apply-patch.ts"() {
+ "use strict";
+ init_task();
+ }
+});
+
+// src/lib/responses/BranchDeleteSummary.ts
+function branchDeletionSuccess(branch, hash) {
+ return {
+ branch,
+ hash,
+ success: true
+ };
+}
+function branchDeletionFailure(branch) {
+ return {
+ branch,
+ hash: null,
+ success: false
+ };
+}
+var BranchDeletionBatch;
+var init_BranchDeleteSummary = __esm({
+ "src/lib/responses/BranchDeleteSummary.ts"() {
+ "use strict";
+ BranchDeletionBatch = class {
+ constructor() {
+ this.all = [];
+ this.branches = {};
+ this.errors = [];
+ }
+ get success() {
+ return !this.errors.length;
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-branch-delete.ts
+function hasBranchDeletionError(data, processExitCode) {
+ return processExitCode === 1 /* ERROR */ && deleteErrorRegex.test(data);
+}
+var deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions;
+var init_parse_branch_delete = __esm({
+ "src/lib/parsers/parse-branch-delete.ts"() {
+ "use strict";
+ init_BranchDeleteSummary();
+ init_utils();
+ deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
+ deleteErrorRegex = /^error[^']+'([^']+)'/m;
+ parsers8 = [
+ new LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
+ const deletion = branchDeletionSuccess(branch, hash);
+ result.all.push(deletion);
+ result.branches[branch] = deletion;
+ }),
+ new LineParser(deleteErrorRegex, (result, [branch]) => {
+ const deletion = branchDeletionFailure(branch);
+ result.errors.push(deletion);
+ result.all.push(deletion);
+ result.branches[branch] = deletion;
+ })
+ ];
+ parseBranchDeletions = (stdOut, stdErr) => {
+ return parseStringResponse(new BranchDeletionBatch(), parsers8, [stdOut, stdErr]);
+ };
+ }
+});
+
+// src/lib/responses/BranchSummary.ts
+var BranchSummaryResult;
+var init_BranchSummary = __esm({
+ "src/lib/responses/BranchSummary.ts"() {
+ "use strict";
+ BranchSummaryResult = class {
+ constructor() {
+ this.all = [];
+ this.branches = {};
+ this.current = "";
+ this.detached = false;
+ }
+ push(status, detached, name, commit, label) {
+ if (status === "*" /* CURRENT */) {
+ this.detached = detached;
+ this.current = name;
+ }
+ this.all.push(name);
+ this.branches[name] = {
+ current: status === "*" /* CURRENT */,
+ linkedWorkTree: status === "+" /* LINKED */,
+ name,
+ commit,
+ label
+ };
+ }
+ };
+ }
+});
+
+// src/lib/parsers/parse-branch.ts
+function branchStatus(input) {
+ return input ? input.charAt(0) : "";
+}
+function parseBranchSummary(stdOut) {
+ return parseStringResponse(new BranchSummaryResult(), parsers9, stdOut);
+}
+var parsers9;
+var init_parse_branch = __esm({
+ "src/lib/parsers/parse-branch.ts"() {
+ "use strict";
+ init_BranchSummary();
+ init_utils();
+ parsers9 = [
+ new LineParser(
+ /^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,
+ (result, [current, name, commit, label]) => {
+ result.push(branchStatus(current), true, name, commit, label);
+ }
+ ),
+ new LineParser(
+ new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$", "s"),
+ (result, [current, name, commit, label]) => {
+ result.push(branchStatus(current), false, name, commit, label);
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/tasks/branch.ts
+var branch_exports = {};
+__export(branch_exports, {
+ branchLocalTask: () => branchLocalTask,
+ branchTask: () => branchTask,
+ containsDeleteBranchCommand: () => containsDeleteBranchCommand,
+ deleteBranchTask: () => deleteBranchTask,
+ deleteBranchesTask: () => deleteBranchesTask
+});
+function containsDeleteBranchCommand(commands) {
+ const deleteCommands = ["-d", "-D", "--delete"];
+ return commands.some((command) => deleteCommands.includes(command));
+}
+function branchTask(customArgs) {
+ const isDelete = containsDeleteBranchCommand(customArgs);
+ const commands = ["branch", ...customArgs];
+ if (commands.length === 1) {
+ commands.push("-a");
+ }
+ if (!commands.includes("-v")) {
+ commands.splice(1, 0, "-v");
+ }
+ return {
+ format: "utf-8",
+ commands,
+ parser(stdOut, stdErr) {
+ if (isDelete) {
+ return parseBranchDeletions(stdOut, stdErr).all[0];
+ }
+ return parseBranchSummary(stdOut);
+ }
+ };
+}
+function branchLocalTask() {
+ const parser3 = parseBranchSummary;
+ return {
+ format: "utf-8",
+ commands: ["branch", "-v"],
+ parser: parser3
+ };
+}
+function deleteBranchesTask(branches, forceDelete = false) {
+ return {
+ format: "utf-8",
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", ...branches],
+ parser(stdOut, stdErr) {
+ return parseBranchDeletions(stdOut, stdErr);
+ },
+ onError({ exitCode, stdOut }, error, done, fail) {
+ if (!hasBranchDeletionError(String(error), exitCode)) {
+ return fail(error);
+ }
+ done(stdOut);
+ }
+ };
+}
+function deleteBranchTask(branch, forceDelete = false) {
+ const task = {
+ format: "utf-8",
+ commands: ["branch", "-v", forceDelete ? "-D" : "-d", branch],
+ parser(stdOut, stdErr) {
+ return parseBranchDeletions(stdOut, stdErr).branches[branch];
+ },
+ onError({ exitCode, stdErr, stdOut }, error, _, fail) {
+ if (!hasBranchDeletionError(String(error), exitCode)) {
+ return fail(error);
+ }
+ throw new GitResponseError(
+ task.parser(bufferToString(stdOut), bufferToString(stdErr)),
+ String(error)
+ );
+ }
+ };
+ return task;
+}
+var init_branch = __esm({
+ "src/lib/tasks/branch.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_parse_branch_delete();
+ init_parse_branch();
+ init_utils();
+ }
+});
+
+// src/lib/responses/CheckIgnore.ts
+var parseCheckIgnore;
+var init_CheckIgnore = __esm({
+ "src/lib/responses/CheckIgnore.ts"() {
+ "use strict";
+ parseCheckIgnore = (text) => {
+ return text.split(/\n/g).map((line) => line.trim()).filter((file) => !!file);
+ };
+ }
+});
+
+// src/lib/tasks/check-ignore.ts
+var check_ignore_exports = {};
+__export(check_ignore_exports, {
+ checkIgnoreTask: () => checkIgnoreTask
+});
+function checkIgnoreTask(paths) {
+ return {
+ commands: ["check-ignore", ...paths],
+ format: "utf-8",
+ parser: parseCheckIgnore
+ };
+}
+var init_check_ignore = __esm({
+ "src/lib/tasks/check-ignore.ts"() {
+ "use strict";
+ init_CheckIgnore();
+ }
+});
+
+// src/lib/tasks/clone.ts
+var clone_exports = {};
+__export(clone_exports, {
+ cloneMirrorTask: () => cloneMirrorTask,
+ cloneTask: () => cloneTask
+});
+function disallowedCommand(command) {
+ return /^--upload-pack(=|$)/.test(command);
+}
+function cloneTask(repo, directory, customArgs) {
+ const commands = ["clone", ...customArgs];
+ filterString(repo) && commands.push(repo);
+ filterString(directory) && commands.push(directory);
+ const banned = commands.find(disallowedCommand);
+ if (banned) {
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
+ }
+ return straightThroughStringTask(commands);
+}
+function cloneMirrorTask(repo, directory, customArgs) {
+ append(customArgs, "--mirror");
+ return cloneTask(repo, directory, customArgs);
+}
+var init_clone = __esm({
+ "src/lib/tasks/clone.ts"() {
+ "use strict";
+ init_task();
+ init_utils();
+ }
+});
+
+// src/lib/parsers/parse-fetch.ts
+function parseFetchResult(stdOut, stdErr) {
+ const result = {
+ raw: stdOut,
+ remote: null,
+ branches: [],
+ tags: [],
+ updated: [],
+ deleted: []
+ };
+ return parseStringResponse(result, parsers10, [stdOut, stdErr]);
+}
+var parsers10;
+var init_parse_fetch = __esm({
+ "src/lib/parsers/parse-fetch.ts"() {
+ "use strict";
+ init_utils();
+ parsers10 = [
+ new LineParser(/From (.+)$/, (result, [remote]) => {
+ result.remote = remote;
+ }),
+ new LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
+ result.branches.push({
+ name,
+ tracking
+ });
+ }),
+ new LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
+ result.tags.push({
+ name,
+ tracking
+ });
+ }),
+ new LineParser(/- \[deleted]\s+\S+\s*-> (.+)$/, (result, [tracking]) => {
+ result.deleted.push({
+ tracking
+ });
+ }),
+ new LineParser(
+ /\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,
+ (result, [from, to, name, tracking]) => {
+ result.updated.push({
+ name,
+ tracking,
+ to,
+ from
+ });
+ }
+ )
+ ];
+ }
+});
+
+// src/lib/tasks/fetch.ts
+var fetch_exports = {};
+__export(fetch_exports, {
+ fetchTask: () => fetchTask
+});
+function disallowedCommand2(command) {
+ return /^--upload-pack(=|$)/.test(command);
+}
+function fetchTask(remote, branch, customArgs) {
+ const commands = ["fetch", ...customArgs];
+ if (remote && branch) {
+ commands.push(remote, branch);
+ }
+ const banned = commands.find(disallowedCommand2);
+ if (banned) {
+ return configurationErrorTask(`git.fetch: potential exploit argument blocked.`);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser: parseFetchResult
+ };
+}
+var init_fetch = __esm({
+ "src/lib/tasks/fetch.ts"() {
+ "use strict";
+ init_parse_fetch();
+ init_task();
+ }
+});
+
+// src/lib/parsers/parse-move.ts
+function parseMoveResult(stdOut) {
+ return parseStringResponse({ moves: [] }, parsers11, stdOut);
+}
+var parsers11;
+var init_parse_move = __esm({
+ "src/lib/parsers/parse-move.ts"() {
+ "use strict";
+ init_utils();
+ parsers11 = [
+ new LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
+ result.moves.push({ from, to });
+ })
+ ];
+ }
+});
+
+// src/lib/tasks/move.ts
+var move_exports = {};
+__export(move_exports, {
+ moveTask: () => moveTask
+});
+function moveTask(from, to) {
+ return {
+ commands: ["mv", "-v", ...asArray(from), to],
+ format: "utf-8",
+ parser: parseMoveResult
+ };
+}
+var init_move = __esm({
+ "src/lib/tasks/move.ts"() {
+ "use strict";
+ init_parse_move();
+ init_utils();
+ }
+});
+
+// src/lib/tasks/pull.ts
+var pull_exports = {};
+__export(pull_exports, {
+ pullTask: () => pullTask
+});
+function pullTask(remote, branch, customArgs) {
+ const commands = ["pull", ...customArgs];
+ if (remote && branch) {
+ commands.splice(1, 0, remote, branch);
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser(stdOut, stdErr) {
+ return parsePullResult(stdOut, stdErr);
+ },
+ onError(result, _error, _done, fail) {
+ const pullError = parsePullErrorResult(
+ bufferToString(result.stdOut),
+ bufferToString(result.stdErr)
+ );
+ if (pullError) {
+ return fail(new GitResponseError(pullError));
+ }
+ fail(_error);
+ }
+ };
+}
+var init_pull = __esm({
+ "src/lib/tasks/pull.ts"() {
+ "use strict";
+ init_git_response_error();
+ init_parse_pull();
+ init_utils();
+ }
+});
+
+// src/lib/responses/GetRemoteSummary.ts
+function parseGetRemotes(text) {
+ const remotes = {};
+ forEach(text, ([name]) => remotes[name] = { name });
+ return Object.values(remotes);
+}
+function parseGetRemotesVerbose(text) {
+ const remotes = {};
+ forEach(text, ([name, url, purpose]) => {
+ if (!remotes.hasOwnProperty(name)) {
+ remotes[name] = {
+ name,
+ refs: { fetch: "", push: "" }
+ };
+ }
+ if (purpose && url) {
+ remotes[name].refs[purpose.replace(/[^a-z]/g, "")] = url;
+ }
+ });
+ return Object.values(remotes);
+}
+function forEach(text, handler) {
+ forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
+}
+var init_GetRemoteSummary = __esm({
+ "src/lib/responses/GetRemoteSummary.ts"() {
+ "use strict";
+ init_utils();
+ }
+});
+
+// src/lib/tasks/remote.ts
+var remote_exports = {};
+__export(remote_exports, {
+ addRemoteTask: () => addRemoteTask,
+ getRemotesTask: () => getRemotesTask,
+ listRemotesTask: () => listRemotesTask,
+ remoteTask: () => remoteTask,
+ removeRemoteTask: () => removeRemoteTask
+});
+function addRemoteTask(remoteName, remoteRepo, customArgs) {
+ return straightThroughStringTask(["remote", "add", ...customArgs, remoteName, remoteRepo]);
+}
+function getRemotesTask(verbose) {
+ const commands = ["remote"];
+ if (verbose) {
+ commands.push("-v");
+ }
+ return {
+ commands,
+ format: "utf-8",
+ parser: verbose ? parseGetRemotesVerbose : parseGetRemotes
+ };
+}
+function listRemotesTask(customArgs) {
+ const commands = [...customArgs];
+ if (commands[0] !== "ls-remote") {
+ commands.unshift("ls-remote");
+ }
+ return straightThroughStringTask(commands);
+}
+function remoteTask(customArgs) {
+ const commands = [...customArgs];
+ if (commands[0] !== "remote") {
+ commands.unshift("remote");
+ }
+ return straightThroughStringTask(commands);
+}
+function removeRemoteTask(remoteName) {
+ return straightThroughStringTask(["remote", "remove", remoteName]);
+}
+var init_remote = __esm({
+ "src/lib/tasks/remote.ts"() {
+ "use strict";
+ init_GetRemoteSummary();
+ init_task();
+ }
+});
+
+// src/lib/tasks/stash-list.ts
+var stash_list_exports = {};
+__export(stash_list_exports, {
+ stashListTask: () => stashListTask
+});
+function stashListTask(opt = {}, customArgs) {
+ const options = parseLogOptions(opt);
+ const commands = ["stash", "list", ...options.commands, ...customArgs];
+ const parser3 = createListLogSummaryParser(
+ options.splitter,
+ options.fields,
+ logFormatFromCommand(commands)
+ );
+ return validateLogFormatConfig(commands) || {
+ commands,
+ format: "utf-8",
+ parser: parser3
+ };
+}
+var init_stash_list = __esm({
+ "src/lib/tasks/stash-list.ts"() {
+ "use strict";
+ init_log_format();
+ init_parse_list_log_summary();
+ init_diff();
+ init_log();
+ }
+});
+
+// src/lib/tasks/sub-module.ts
+var sub_module_exports = {};
+__export(sub_module_exports, {
+ addSubModuleTask: () => addSubModuleTask,
+ initSubModuleTask: () => initSubModuleTask,
+ subModuleTask: () => subModuleTask,
+ updateSubModuleTask: () => updateSubModuleTask
+});
+function addSubModuleTask(repo, path) {
+ return subModuleTask(["add", repo, path]);
+}
+function initSubModuleTask(customArgs) {
+ return subModuleTask(["init", ...customArgs]);
+}
+function subModuleTask(customArgs) {
+ const commands = [...customArgs];
+ if (commands[0] !== "submodule") {
+ commands.unshift("submodule");
+ }
+ return straightThroughStringTask(commands);
+}
+function updateSubModuleTask(customArgs) {
+ return subModuleTask(["update", ...customArgs]);
+}
+var init_sub_module = __esm({
+ "src/lib/tasks/sub-module.ts"() {
+ "use strict";
+ init_task();
+ }
+});
+
+// src/lib/responses/TagList.ts
+function singleSorted(a, b) {
+ const aIsNum = isNaN(a);
+ const bIsNum = isNaN(b);
+ if (aIsNum !== bIsNum) {
+ return aIsNum ? 1 : -1;
+ }
+ return aIsNum ? sorted(a, b) : 0;
+}
+function sorted(a, b) {
+ return a === b ? 0 : a > b ? 1 : -1;
+}
+function trimmed(input) {
+ return input.trim();
+}
+function toNumber(input) {
+ if (typeof input === "string") {
+ return parseInt(input.replace(/^\D+/g, ""), 10) || 0;
+ }
+ return 0;
+}
+var TagList, parseTagList;
+var init_TagList = __esm({
+ "src/lib/responses/TagList.ts"() {
+ "use strict";
+ TagList = class {
+ constructor(all, latest) {
+ this.all = all;
+ this.latest = latest;
+ }
+ };
+ parseTagList = function(data, customSort = false) {
+ const tags = data.split("\n").map(trimmed).filter(Boolean);
+ if (!customSort) {
+ tags.sort(function(tagA, tagB) {
+ const partsA = tagA.split(".");
+ const partsB = tagB.split(".");
+ if (partsA.length === 1 || partsB.length === 1) {
+ return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
+ }
+ for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
+ const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
+ if (diff) {
+ return diff;
+ }
+ }
+ return 0;
+ });
+ }
+ const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf(".") >= 0);
+ return new TagList(tags, latest);
+ };
+ }
+});
+
+// src/lib/tasks/tag.ts
+var tag_exports = {};
+__export(tag_exports, {
+ addAnnotatedTagTask: () => addAnnotatedTagTask,
+ addTagTask: () => addTagTask,
+ tagListTask: () => tagListTask
+});
+function tagListTask(customArgs = []) {
+ const hasCustomSort = customArgs.some((option) => /^--sort=/.test(option));
+ return {
+ format: "utf-8",
+ commands: ["tag", "-l", ...customArgs],
+ parser(text) {
+ return parseTagList(text, hasCustomSort);
+ }
+ };
+}
+function addTagTask(name) {
+ return {
+ format: "utf-8",
+ commands: ["tag", name],
+ parser() {
+ return { name };
+ }
+ };
+}
+function addAnnotatedTagTask(name, tagMessage) {
+ return {
+ format: "utf-8",
+ commands: ["tag", "-a", "-m", tagMessage, name],
+ parser() {
+ return { name };
+ }
+ };
+}
+var init_tag = __esm({
+ "src/lib/tasks/tag.ts"() {
+ "use strict";
+ init_TagList();
+ }
+});
+
+// src/git.js
+var require_git = __commonJS({
+ "src/git.js"(exports, module) {
+ "use strict";
+ var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
+ var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
+ var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
+ var { configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
+ var {
+ asArray: asArray2,
+ filterArray: filterArray2,
+ filterPrimitives: filterPrimitives2,
+ filterString: filterString2,
+ filterStringOrStringArray: filterStringOrStringArray2,
+ filterType: filterType2,
+ getTrailingOptions: getTrailingOptions2,
+ trailingFunctionArgument: trailingFunctionArgument2,
+ trailingOptionsArgument: trailingOptionsArgument2
+ } = (init_utils(), __toCommonJS(utils_exports));
+ var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
+ var {
+ branchTask: branchTask2,
+ branchLocalTask: branchLocalTask2,
+ deleteBranchesTask: deleteBranchesTask2,
+ deleteBranchTask: deleteBranchTask2
+ } = (init_branch(), __toCommonJS(branch_exports));
+ var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
+ var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
+ var { cloneTask: cloneTask2, cloneMirrorTask: cloneMirrorTask2 } = (init_clone(), __toCommonJS(clone_exports));
+ var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
+ var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
+ var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
+ var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
+ var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
+ var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
+ var {
+ addRemoteTask: addRemoteTask2,
+ getRemotesTask: getRemotesTask2,
+ listRemotesTask: listRemotesTask2,
+ remoteTask: remoteTask2,
+ removeRemoteTask: removeRemoteTask2
+ } = (init_remote(), __toCommonJS(remote_exports));
+ var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
+ var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
+ var {
+ addSubModuleTask: addSubModuleTask2,
+ initSubModuleTask: initSubModuleTask2,
+ subModuleTask: subModuleTask2,
+ updateSubModuleTask: updateSubModuleTask2
+ } = (init_sub_module(), __toCommonJS(sub_module_exports));
+ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
+ var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
+ function Git2(options, plugins) {
+ this._plugins = plugins;
+ this._executor = new GitExecutor2(
+ options.baseDir,
+ new Scheduler2(options.maxConcurrentProcesses),
+ plugins
+ );
+ this._trimmed = options.trimmed;
+ }
+ (Git2.prototype = Object.create(SimpleGitApi2.prototype)).constructor = Git2;
+ Git2.prototype.customBinary = function(command) {
+ this._plugins.reconfigure("binary", command);
+ return this;
+ };
+ Git2.prototype.env = function(name, value) {
+ if (arguments.length === 1 && typeof name === "object") {
+ this._executor.env = name;
+ } else {
+ (this._executor.env = this._executor.env || {})[name] = value;
+ }
+ return this;
+ };
+ Git2.prototype.stashList = function(options) {
+ return this._runTask(
+ stashListTask2(
+ trailingOptionsArgument2(arguments) || {},
+ filterArray2(options) && options || []
+ ),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ function createCloneTask(api, task, repoPath, localPath) {
+ if (typeof repoPath !== "string") {
+ return configurationErrorTask2(`git.${api}() requires a string 'repoPath'`);
+ }
+ return task(repoPath, filterType2(localPath, filterString2), getTrailingOptions2(arguments));
+ }
+ Git2.prototype.clone = function() {
+ return this._runTask(
+ createCloneTask("clone", cloneTask2, ...arguments),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.mirror = function() {
+ return this._runTask(
+ createCloneTask("mirror", cloneMirrorTask2, ...arguments),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.mv = function(from, to) {
+ return this._runTask(moveTask2(from, to), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.checkoutLatestTag = function(then) {
+ var git = this;
+ return this.pull(function() {
+ git.tags(function(err, tags) {
+ git.checkout(tags.latest, then);
+ });
+ });
+ };
+ Git2.prototype.pull = function(remote, branch, options, then) {
+ return this._runTask(
+ pullTask2(
+ filterType2(remote, filterString2),
+ filterType2(branch, filterString2),
+ getTrailingOptions2(arguments)
+ ),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.fetch = function(remote, branch) {
+ return this._runTask(
+ fetchTask2(
+ filterType2(remote, filterString2),
+ filterType2(branch, filterString2),
+ getTrailingOptions2(arguments)
+ ),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.silent = function(silence) {
+ console.warn(
+ "simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"
+ );
+ return this;
+ };
+ Git2.prototype.tags = function(options, then) {
+ return this._runTask(
+ tagListTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.rebase = function() {
+ return this._runTask(
+ straightThroughStringTask2(["rebase", ...getTrailingOptions2(arguments)]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.reset = function(mode) {
+ return this._runTask(
+ resetTask2(getResetMode2(mode), getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.revert = function(commit) {
+ const next = trailingFunctionArgument2(arguments);
+ if (typeof commit !== "string") {
+ return this._runTask(configurationErrorTask2("Commit must be a string"), next);
+ }
+ return this._runTask(
+ straightThroughStringTask2(["revert", ...getTrailingOptions2(arguments, 0, true), commit]),
+ next
+ );
+ };
+ Git2.prototype.addTag = function(name) {
+ const task = typeof name === "string" ? addTagTask2(name) : configurationErrorTask2("Git.addTag requires a tag name");
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.addAnnotatedTag = function(tagName, tagMessage) {
+ return this._runTask(
+ addAnnotatedTagTask2(tagName, tagMessage),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.deleteLocalBranch = function(branchName, forceDelete, then) {
+ return this._runTask(
+ deleteBranchTask2(branchName, typeof forceDelete === "boolean" ? forceDelete : false),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.deleteLocalBranches = function(branchNames, forceDelete, then) {
+ return this._runTask(
+ deleteBranchesTask2(branchNames, typeof forceDelete === "boolean" ? forceDelete : false),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.branch = function(options, then) {
+ return this._runTask(
+ branchTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.branchLocal = function(then) {
+ return this._runTask(branchLocalTask2(), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.raw = function(commands) {
+ const createRestCommands = !Array.isArray(commands);
+ const command = [].slice.call(createRestCommands ? arguments : commands, 0);
+ for (let i = 0; i < command.length && createRestCommands; i++) {
+ if (!filterPrimitives2(command[i])) {
+ command.splice(i, command.length - i);
+ break;
+ }
+ }
+ command.push(...getTrailingOptions2(arguments, 0, true));
+ var next = trailingFunctionArgument2(arguments);
+ if (!command.length) {
+ return this._runTask(
+ configurationErrorTask2("Raw: must supply one or more command to execute"),
+ next
+ );
+ }
+ return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
+ };
+ Git2.prototype.submoduleAdd = function(repo, path, then) {
+ return this._runTask(addSubModuleTask2(repo, path), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.submoduleUpdate = function(args, then) {
+ return this._runTask(
+ updateSubModuleTask2(getTrailingOptions2(arguments, true)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.submoduleInit = function(args, then) {
+ return this._runTask(
+ initSubModuleTask2(getTrailingOptions2(arguments, true)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.subModule = function(options, then) {
+ return this._runTask(
+ subModuleTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.listRemote = function() {
+ return this._runTask(
+ listRemotesTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.addRemote = function(remoteName, remoteRepo, then) {
+ return this._runTask(
+ addRemoteTask2(remoteName, remoteRepo, getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.removeRemote = function(remoteName, then) {
+ return this._runTask(removeRemoteTask2(remoteName), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.getRemotes = function(verbose, then) {
+ return this._runTask(getRemotesTask2(verbose === true), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.remote = function(options, then) {
+ return this._runTask(
+ remoteTask2(getTrailingOptions2(arguments)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.tag = function(options, then) {
+ const command = getTrailingOptions2(arguments);
+ if (command[0] !== "tag") {
+ command.unshift("tag");
+ }
+ return this._runTask(straightThroughStringTask2(command), trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.updateServerInfo = function(then) {
+ return this._runTask(
+ straightThroughStringTask2(["update-server-info"]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.pushTags = function(remote, then) {
+ const task = pushTagsTask2(
+ { remote: filterType2(remote, filterString2) },
+ getTrailingOptions2(arguments)
+ );
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.rm = function(files) {
+ return this._runTask(
+ straightThroughStringTask2(["rm", "-f", ...asArray2(files)]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.rmKeepLocal = function(files) {
+ return this._runTask(
+ straightThroughStringTask2(["rm", "--cached", ...asArray2(files)]),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.catFile = function(options, then) {
+ return this._catFile("utf-8", arguments);
+ };
+ Git2.prototype.binaryCatFile = function() {
+ return this._catFile("buffer", arguments);
+ };
+ Git2.prototype._catFile = function(format, args) {
+ var handler = trailingFunctionArgument2(args);
+ var command = ["cat-file"];
+ var options = args[0];
+ if (typeof options === "string") {
+ return this._runTask(
+ configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"),
+ handler
+ );
+ }
+ if (Array.isArray(options)) {
+ command.push.apply(command, options);
+ }
+ const task = format === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
+ return this._runTask(task, handler);
+ };
+ Git2.prototype.diff = function(options, then) {
+ const task = filterString2(options) ? configurationErrorTask2(
+ "git.diff: supplying options as a single string is no longer supported, switch to an array of strings"
+ ) : straightThroughStringTask2(["diff", ...getTrailingOptions2(arguments)]);
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.diffSummary = function() {
+ return this._runTask(
+ diffSummaryTask2(getTrailingOptions2(arguments, 1)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.applyPatch = function(patches) {
+ const task = !filterStringOrStringArray2(patches) ? configurationErrorTask2(
+ `git.applyPatch requires one or more string patches as the first argument`
+ ) : applyPatchTask2(asArray2(patches), getTrailingOptions2([].slice.call(arguments, 1)));
+ return this._runTask(task, trailingFunctionArgument2(arguments));
+ };
+ Git2.prototype.revparse = function() {
+ const commands = ["rev-parse", ...getTrailingOptions2(arguments, true)];
+ return this._runTask(
+ straightThroughStringTask2(commands, true),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.clean = function(mode, options, then) {
+ const usingCleanOptionsArray = isCleanOptionsArray2(mode);
+ const cleanMode = usingCleanOptionsArray && mode.join("") || filterType2(mode, filterString2) || "";
+ const customArgs = getTrailingOptions2([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
+ return this._runTask(
+ cleanWithOptionsTask2(cleanMode, customArgs),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.exec = function(then) {
+ const task = {
+ commands: [],
+ format: "utf-8",
+ parser() {
+ if (typeof then === "function") {
+ then();
+ }
+ }
+ };
+ return this._runTask(task);
+ };
+ Git2.prototype.clearQueue = function() {
+ return this;
+ };
+ Git2.prototype.checkIgnore = function(pathnames, then) {
+ return this._runTask(
+ checkIgnoreTask2(asArray2(filterType2(pathnames, filterStringOrStringArray2, []))),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ Git2.prototype.checkIsRepo = function(checkType, then) {
+ return this._runTask(
+ checkIsRepoTask2(filterType2(checkType, filterString2)),
+ trailingFunctionArgument2(arguments)
+ );
+ };
+ module.exports = Git2;
+ }
+});
+
+// src/lib/api.ts
+init_pathspec();
+
+// src/lib/errors/git-construct-error.ts
+init_git_error();
+var GitConstructError = class extends GitError {
+ constructor(config, message) {
+ super(void 0, message);
+ this.config = config;
+ }
+};
+
+// src/lib/api.ts
+init_git_error();
+
+// src/lib/errors/git-plugin-error.ts
+init_git_error();
+var GitPluginError = class extends GitError {
+ constructor(task, plugin, message) {
+ super(task, message);
+ this.task = task;
+ this.plugin = plugin;
+ Object.setPrototypeOf(this, new.target.prototype);
+ }
+};
+
+// src/lib/api.ts
+init_git_response_error();
+init_task_configuration_error();
+init_check_is_repo();
+init_clean();
+init_config();
+init_diff_name_status();
+init_grep();
+init_reset();
+
+// src/lib/plugins/abort-plugin.ts
+function abortPlugin(signal) {
+ if (!signal) {
+ return;
+ }
+ const onSpawnAfter = {
+ type: "spawn.after",
+ action(_data, context) {
+ function kill() {
+ context.kill(new GitPluginError(void 0, "abort", "Abort signal received"));
+ }
+ signal.addEventListener("abort", kill);
+ context.spawned.on("close", () => signal.removeEventListener("abort", kill));
+ }
+ };
+ const onSpawnBefore = {
+ type: "spawn.before",
+ action(_data, context) {
+ if (signal.aborted) {
+ context.kill(new GitPluginError(void 0, "abort", "Abort already signaled"));
+ }
+ }
+ };
+ return [onSpawnBefore, onSpawnAfter];
+}
+
+// src/lib/plugins/block-unsafe-operations-plugin.ts
+function isConfigSwitch(arg) {
+ return typeof arg === "string" && arg.trim().toLowerCase() === "-c";
+}
+function preventProtocolOverride(arg, next) {
+ if (!isConfigSwitch(arg)) {
+ return;
+ }
+ if (!/^\s*protocol(.[a-z]+)?.allow/.test(next)) {
+ return;
+ }
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ "Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol"
+ );
+}
+function preventUploadPack(arg, method) {
+ if (/^\s*--(upload|receive)-pack/.test(arg)) {
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ `Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack`
+ );
+ }
+ if (method === "clone" && /^\s*-u\b/.test(arg)) {
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ `Use of clone with option -u is not permitted without enabling allowUnsafePack`
+ );
+ }
+ if (method === "push" && /^\s*--exec\b/.test(arg)) {
+ throw new GitPluginError(
+ void 0,
+ "unsafe",
+ `Use of push with option --exec is not permitted without enabling allowUnsafePack`
+ );
+ }
+}
+function blockUnsafeOperationsPlugin({
+ allowUnsafeProtocolOverride = false,
+ allowUnsafePack = false
+} = {}) {
+ return {
+ type: "spawn.args",
+ action(args, context) {
+ args.forEach((current, index) => {
+ const next = index < args.length ? args[index + 1] : "";
+ allowUnsafeProtocolOverride || preventProtocolOverride(current, next);
+ allowUnsafePack || preventUploadPack(current, context.method);
+ });
+ return args;
+ }
+ };
+}
+
+// src/lib/plugins/command-config-prefixing-plugin.ts
+init_utils();
+function commandConfigPrefixingPlugin(configuration) {
+ const prefix = prefixedArray(configuration, "-c");
+ return {
+ type: "spawn.args",
+ action(data) {
+ return [...prefix, ...data];
+ }
+ };
+}
+
+// src/lib/plugins/completion-detection.plugin.ts
+init_utils();
+import { deferred } from "@kwsites/promise-deferred";
+var never = deferred().promise;
+function completionDetectionPlugin({
+ onClose = true,
+ onExit = 50
+} = {}) {
+ function createEvents() {
+ let exitCode = -1;
+ const events = {
+ close: deferred(),
+ closeTimeout: deferred(),
+ exit: deferred(),
+ exitTimeout: deferred()
+ };
+ const result = Promise.race([
+ onClose === false ? never : events.closeTimeout.promise,
+ onExit === false ? never : events.exitTimeout.promise
+ ]);
+ configureTimeout(onClose, events.close, events.closeTimeout);
+ configureTimeout(onExit, events.exit, events.exitTimeout);
+ return {
+ close(code) {
+ exitCode = code;
+ events.close.done();
+ },
+ exit(code) {
+ exitCode = code;
+ events.exit.done();
+ },
+ get exitCode() {
+ return exitCode;
+ },
+ result
+ };
+ }
+ function configureTimeout(flag, event, timeout) {
+ if (flag === false) {
+ return;
+ }
+ (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);
+ }
+ return {
+ type: "spawn.after",
+ action(_0, _1) {
+ return __async(this, arguments, function* (_data, { spawned, close }) {
+ var _a3, _b;
+ const events = createEvents();
+ let deferClose = true;
+ let quickClose = () => void (deferClose = false);
+ (_a3 = spawned.stdout) == null ? void 0 : _a3.on("data", quickClose);
+ (_b = spawned.stderr) == null ? void 0 : _b.on("data", quickClose);
+ spawned.on("error", quickClose);
+ spawned.on("close", (code) => events.close(code));
+ spawned.on("exit", (code) => events.exit(code));
+ try {
+ yield events.result;
+ if (deferClose) {
+ yield delay(50);
+ }
+ close(events.exitCode);
+ } catch (err) {
+ close(events.exitCode, err);
+ }
+ });
+ }
+ };
+}
+
+// src/lib/plugins/custom-binary.plugin.ts
+init_utils();
+var WRONG_NUMBER_ERR = `Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings`;
+var WRONG_CHARS_ERR = `Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option`;
+function isBadArgument(arg) {
+ return !arg || !/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(arg);
+}
+function toBinaryConfig(input, allowUnsafe) {
+ if (input.length < 1 || input.length > 2) {
+ throw new GitPluginError(void 0, "binary", WRONG_NUMBER_ERR);
+ }
+ const isBad = input.some(isBadArgument);
+ if (isBad) {
+ if (allowUnsafe) {
+ console.warn(WRONG_CHARS_ERR);
+ } else {
+ throw new GitPluginError(void 0, "binary", WRONG_CHARS_ERR);
+ }
+ }
+ const [binary, prefix] = input;
+ return {
+ binary,
+ prefix
+ };
+}
+function customBinaryPlugin(plugins, input = ["git"], allowUnsafe = false) {
+ let config = toBinaryConfig(asArray(input), allowUnsafe);
+ plugins.on("binary", (input2) => {
+ config = toBinaryConfig(asArray(input2), allowUnsafe);
+ });
+ plugins.append("spawn.binary", () => {
+ return config.binary;
+ });
+ plugins.append("spawn.args", (data) => {
+ return config.prefix ? [config.prefix, ...data] : data;
+ });
+}
+
+// src/lib/plugins/error-detection.plugin.ts
+init_git_error();
+function isTaskError(result) {
+ return !!(result.exitCode && result.stdErr.length);
+}
+function getErrorMessage(result) {
+ return Buffer.concat([...result.stdOut, ...result.stdErr]);
+}
+function errorDetectionHandler(overwrite = false, isError = isTaskError, errorMessage = getErrorMessage) {
+ return (error, result) => {
+ if (!overwrite && error || !isError(result)) {
+ return error;
+ }
+ return errorMessage(result);
+ };
+}
+function errorDetectionPlugin(config) {
+ return {
+ type: "task.error",
+ action(data, context) {
+ const error = config(data.error, {
+ stdErr: context.stdErr,
+ stdOut: context.stdOut,
+ exitCode: context.exitCode
+ });
+ if (Buffer.isBuffer(error)) {
+ return { error: new GitError(void 0, error.toString("utf-8")) };
+ }
+ return {
+ error
+ };
+ }
+ };
+}
+
+// src/lib/plugins/plugin-store.ts
+init_utils();
+import { EventEmitter } from "node:events";
+var PluginStore = class {
+ constructor() {
+ this.plugins = /* @__PURE__ */ new Set();
+ this.events = new EventEmitter();
+ }
+ on(type, listener) {
+ this.events.on(type, listener);
+ }
+ reconfigure(type, data) {
+ this.events.emit(type, data);
+ }
+ append(type, action) {
+ const plugin = append(this.plugins, { type, action });
+ return () => this.plugins.delete(plugin);
+ }
+ add(plugin) {
+ const plugins = [];
+ asArray(plugin).forEach((plugin2) => plugin2 && this.plugins.add(append(plugins, plugin2)));
+ return () => {
+ plugins.forEach((plugin2) => this.plugins.delete(plugin2));
+ };
+ }
+ exec(type, data, context) {
+ let output = data;
+ const contextual = Object.freeze(Object.create(context));
+ for (const plugin of this.plugins) {
+ if (plugin.type === type) {
+ output = plugin.action(output, contextual);
+ }
+ }
+ return output;
+ }
+};
+
+// src/lib/plugins/progress-monitor-plugin.ts
+init_utils();
+function progressMonitorPlugin(progress) {
+ const progressCommand = "--progress";
+ const progressMethods = ["checkout", "clone", "fetch", "pull", "push"];
+ const onProgress = {
+ type: "spawn.after",
+ action(_data, context) {
+ var _a2;
+ if (!context.commands.includes(progressCommand)) {
+ return;
+ }
+ (_a2 = context.spawned.stderr) == null ? void 0 : _a2.on("data", (chunk) => {
+ const message = /^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(chunk.toString("utf8"));
+ if (!message) {
+ return;
+ }
+ progress({
+ method: context.method,
+ stage: progressEventStage(message[1]),
+ progress: asNumber(message[2]),
+ processed: asNumber(message[3]),
+ total: asNumber(message[4])
+ });
+ });
+ }
+ };
+ const onArgs = {
+ type: "spawn.args",
+ action(args, context) {
+ if (!progressMethods.includes(context.method)) {
+ return args;
+ }
+ return including(args, progressCommand);
+ }
+ };
+ return [onArgs, onProgress];
+}
+function progressEventStage(input) {
+ return String(input.toLowerCase().split(" ", 1)) || "unknown";
+}
+
+// src/lib/plugins/spawn-options-plugin.ts
+init_utils();
+function spawnOptionsPlugin(spawnOptions) {
+ const options = pick(spawnOptions, ["uid", "gid"]);
+ return {
+ type: "spawn.options",
+ action(data) {
+ return __spreadValues(__spreadValues({}, options), data);
+ }
+ };
+}
+
+// src/lib/plugins/timout-plugin.ts
+function timeoutPlugin({
+ block,
+ stdErr = true,
+ stdOut = true
+}) {
+ if (block > 0) {
+ return {
+ type: "spawn.after",
+ action(_data, context) {
+ var _a2, _b;
+ let timeout;
+ function wait() {
+ timeout && clearTimeout(timeout);
+ timeout = setTimeout(kill, block);
+ }
+ function stop() {
+ var _a3, _b2;
+ (_a3 = context.spawned.stdout) == null ? void 0 : _a3.off("data", wait);
+ (_b2 = context.spawned.stderr) == null ? void 0 : _b2.off("data", wait);
+ context.spawned.off("exit", stop);
+ context.spawned.off("close", stop);
+ timeout && clearTimeout(timeout);
+ }
+ function kill() {
+ stop();
+ context.kill(new GitPluginError(void 0, "timeout", `block timeout reached`));
+ }
+ stdOut && ((_a2 = context.spawned.stdout) == null ? void 0 : _a2.on("data", wait));
+ stdErr && ((_b = context.spawned.stderr) == null ? void 0 : _b.on("data", wait));
+ context.spawned.on("exit", stop);
+ context.spawned.on("close", stop);
+ wait();
+ }
+ };
+ }
+}
+
+// src/lib/plugins/suffix-paths.plugin.ts
+init_pathspec();
+function suffixPathsPlugin() {
+ return {
+ type: "spawn.args",
+ action(data) {
+ const prefix = [];
+ let suffix;
+ function append2(args) {
+ (suffix = suffix || []).push(...args);
+ }
+ for (let i = 0; i < data.length; i++) {
+ const param = data[i];
+ if (isPathSpec(param)) {
+ append2(toPaths(param));
+ continue;
+ }
+ if (param === "--") {
+ append2(
+ data.slice(i + 1).flatMap((item) => isPathSpec(item) && toPaths(item) || item)
+ );
+ break;
+ }
+ prefix.push(param);
+ }
+ return !suffix ? prefix : [...prefix, "--", ...suffix.map(String)];
+ }
+ };
+}
+
+// src/lib/git-factory.ts
+init_utils();
+var Git = require_git();
+function gitInstanceFactory(baseDir, options) {
+ var _a2;
+ const plugins = new PluginStore();
+ const config = createInstanceConfig(
+ baseDir && (typeof baseDir === "string" ? { baseDir } : baseDir) || {},
+ options
+ );
+ if (!folderExists(config.baseDir)) {
+ throw new GitConstructError(
+ config,
+ `Cannot use simple-git on a directory that does not exist`
+ );
+ }
+ if (Array.isArray(config.config)) {
+ plugins.add(commandConfigPrefixingPlugin(config.config));
+ }
+ plugins.add(blockUnsafeOperationsPlugin(config.unsafe));
+ plugins.add(suffixPathsPlugin());
+ plugins.add(completionDetectionPlugin(config.completion));
+ config.abort && plugins.add(abortPlugin(config.abort));
+ config.progress && plugins.add(progressMonitorPlugin(config.progress));
+ config.timeout && plugins.add(timeoutPlugin(config.timeout));
+ config.spawnOptions && plugins.add(spawnOptionsPlugin(config.spawnOptions));
+ plugins.add(errorDetectionPlugin(errorDetectionHandler(true)));
+ config.errors && plugins.add(errorDetectionPlugin(config.errors));
+ customBinaryPlugin(plugins, config.binary, (_a2 = config.unsafe) == null ? void 0 : _a2.allowUnsafeCustomBinary);
+ return new Git(config, plugins);
+}
+
+// src/lib/runners/promise-wrapped.ts
+init_git_response_error();
+var functionNamesBuilderApi = ["customBinary", "env", "outputHandler", "silent"];
+var functionNamesPromiseApi = [
+ "add",
+ "addAnnotatedTag",
+ "addConfig",
+ "addRemote",
+ "addTag",
+ "applyPatch",
+ "binaryCatFile",
+ "branch",
+ "branchLocal",
+ "catFile",
+ "checkIgnore",
+ "checkIsRepo",
+ "checkout",
+ "checkoutBranch",
+ "checkoutLatestTag",
+ "checkoutLocalBranch",
+ "clean",
+ "clone",
+ "commit",
+ "cwd",
+ "deleteLocalBranch",
+ "deleteLocalBranches",
+ "diff",
+ "diffSummary",
+ "exec",
+ "fetch",
+ "getRemotes",
+ "init",
+ "listConfig",
+ "listRemote",
+ "log",
+ "merge",
+ "mergeFromTo",
+ "mirror",
+ "mv",
+ "pull",
+ "push",
+ "pushTags",
+ "raw",
+ "rebase",
+ "remote",
+ "removeRemote",
+ "reset",
+ "revert",
+ "revparse",
+ "rm",
+ "rmKeepLocal",
+ "show",
+ "stash",
+ "stashList",
+ "status",
+ "subModule",
+ "submoduleAdd",
+ "submoduleInit",
+ "submoduleUpdate",
+ "tag",
+ "tags",
+ "updateServerInfo"
+];
+function gitP(...args) {
+ let git;
+ let chain = Promise.resolve();
+ try {
+ git = gitInstanceFactory(...args);
+ } catch (e) {
+ chain = Promise.reject(e);
+ }
+ function builderReturn() {
+ return promiseApi;
+ }
+ function chainReturn() {
+ return chain;
+ }
+ const promiseApi = [...functionNamesBuilderApi, ...functionNamesPromiseApi].reduce(
+ (api, name) => {
+ const isAsync = functionNamesPromiseApi.includes(name);
+ const valid = isAsync ? asyncWrapper(name, git) : syncWrapper(name, git, api);
+ const alternative = isAsync ? chainReturn : builderReturn;
+ Object.defineProperty(api, name, {
+ enumerable: false,
+ configurable: false,
+ value: git ? valid : alternative
+ });
+ return api;
+ },
+ {}
+ );
+ return promiseApi;
+ function asyncWrapper(fn, git2) {
+ return function(...args2) {
+ if (typeof args2[args2.length] === "function") {
+ throw new TypeError(
+ "Promise interface requires that handlers are not supplied inline, trailing function not allowed in call to " + fn
+ );
+ }
+ return chain.then(function() {
+ return new Promise(function(resolve, reject) {
+ const callback = (err, result) => {
+ if (err) {
+ return reject(toError(err));
+ }
+ resolve(result);
+ };
+ args2.push(callback);
+ git2[fn].apply(git2, args2);
+ });
+ });
+ };
+ }
+ function syncWrapper(fn, git2, api) {
+ return (...args2) => {
+ git2[fn](...args2);
+ return api;
+ };
+ }
+}
+function toError(error) {
+ if (error instanceof Error) {
+ return error;
+ }
+ if (typeof error === "string") {
+ return new Error(error);
+ }
+ return new GitResponseError(error);
+}
+
+// src/esm.mjs
+var simpleGit = gitInstanceFactory;
+var esm_default = gitInstanceFactory;
+export {
+ CheckRepoActions,
+ CleanOptions,
+ DiffNameStatus,
+ GitConfigScope,
+ GitConstructError,
+ GitError,
+ GitPluginError,
+ GitResponseError,
+ ResetMode,
+ TaskConfigurationError,
+ esm_default as default,
+ gitP,
+ grepQueryBuilder,
+ pathspec,
+ simpleGit
+};
+//# sourceMappingURL=index.js.map
diff --git a/node_modules/simple-git/dist/esm/index.js.map b/node_modules/simple-git/dist/esm/index.js.map
new file mode 100644
index 0000000..abf696b
--- /dev/null
+++ b/node_modules/simple-git/dist/esm/index.js.map
@@ -0,0 +1,7 @@
+{
+ "version": 3,
+ "sources": ["../../src/lib/args/pathspec.ts", "../../src/lib/errors/git-error.ts", "../../src/lib/errors/git-response-error.ts", "../../src/lib/errors/task-configuration-error.ts", "../../src/lib/utils/util.ts", "../../src/lib/utils/argument-filters.ts", "../../src/lib/utils/exit-codes.ts", "../../src/lib/utils/git-output-streams.ts", "../../src/lib/utils/line-parser.ts", "../../src/lib/utils/simple-git-options.ts", "../../src/lib/utils/task-options.ts", "../../src/lib/utils/task-parser.ts", "../../src/lib/utils/index.ts", "../../src/lib/tasks/check-is-repo.ts", "../../src/lib/responses/CleanSummary.ts", "../../src/lib/tasks/task.ts", "../../src/lib/tasks/clean.ts", "../../src/lib/responses/ConfigList.ts", "../../src/lib/tasks/config.ts", "../../src/lib/tasks/diff-name-status.ts", "../../src/lib/tasks/grep.ts", "../../src/lib/tasks/reset.ts", "../../src/lib/git-logger.ts", "../../src/lib/runners/tasks-pending-queue.ts", "../../src/lib/runners/git-executor-chain.ts", "../../src/lib/runners/git-executor.ts", "../../src/lib/task-callback.ts", "../../src/lib/tasks/change-working-directory.ts", "../../src/lib/tasks/checkout.ts", "../../src/lib/parsers/parse-commit.ts", "../../src/lib/tasks/commit.ts", "../../src/lib/tasks/first-commit.ts", "../../src/lib/tasks/hash-object.ts", "../../src/lib/responses/InitSummary.ts", "../../src/lib/tasks/init.ts", "../../src/lib/args/log-format.ts", "../../src/lib/responses/DiffSummary.ts", "../../src/lib/parsers/parse-diff-summary.ts", "../../src/lib/parsers/parse-list-log-summary.ts", "../../src/lib/tasks/diff.ts", "../../src/lib/tasks/log.ts", "../../src/lib/responses/MergeSummary.ts", "../../src/lib/responses/PullSummary.ts", "../../src/lib/parsers/parse-remote-objects.ts", "../../src/lib/parsers/parse-remote-messages.ts", "../../src/lib/parsers/parse-pull.ts", "../../src/lib/parsers/parse-merge.ts", "../../src/lib/tasks/merge.ts", "../../src/lib/parsers/parse-push.ts", "../../src/lib/tasks/push.ts", "../../src/lib/tasks/show.ts", "../../src/lib/responses/FileStatusSummary.ts", "../../src/lib/responses/StatusSummary.ts", "../../src/lib/tasks/status.ts", "../../src/lib/tasks/version.ts", "../../src/lib/simple-git-api.ts", "../../src/lib/runners/scheduler.ts", "../../src/lib/tasks/apply-patch.ts", "../../src/lib/responses/BranchDeleteSummary.ts", "../../src/lib/parsers/parse-branch-delete.ts", "../../src/lib/responses/BranchSummary.ts", "../../src/lib/parsers/parse-branch.ts", "../../src/lib/tasks/branch.ts", "../../src/lib/responses/CheckIgnore.ts", "../../src/lib/tasks/check-ignore.ts", "../../src/lib/tasks/clone.ts", "../../src/lib/parsers/parse-fetch.ts", "../../src/lib/tasks/fetch.ts", "../../src/lib/parsers/parse-move.ts", "../../src/lib/tasks/move.ts", "../../src/lib/tasks/pull.ts", "../../src/lib/responses/GetRemoteSummary.ts", "../../src/lib/tasks/remote.ts", "../../src/lib/tasks/stash-list.ts", "../../src/lib/tasks/sub-module.ts", "../../src/lib/responses/TagList.ts", "../../src/lib/tasks/tag.ts", "../../src/git.js", "../../src/lib/api.ts", "../../src/lib/errors/git-construct-error.ts", "../../src/lib/errors/git-plugin-error.ts", "../../src/lib/plugins/abort-plugin.ts", "../../src/lib/plugins/block-unsafe-operations-plugin.ts", "../../src/lib/plugins/command-config-prefixing-plugin.ts", "../../src/lib/plugins/completion-detection.plugin.ts", "../../src/lib/plugins/custom-binary.plugin.ts", "../../src/lib/plugins/error-detection.plugin.ts", "../../src/lib/plugins/plugin-store.ts", "../../src/lib/plugins/progress-monitor-plugin.ts", "../../src/lib/plugins/spawn-options-plugin.ts", "../../src/lib/plugins/timout-plugin.ts", "../../src/lib/plugins/suffix-paths.plugin.ts", "../../src/lib/git-factory.ts", "../../src/lib/runners/promise-wrapped.ts", "../../src/esm.mjs"],
+ "sourcesContent": ["const cache = new WeakMap();\n\nexport function pathspec(...paths: string[]) {\n const key = new String(paths);\n cache.set(key, paths);\n\n return key as string;\n}\n\nexport function isPathSpec(path: string | unknown): path is string {\n return path instanceof String && cache.has(path);\n}\n\nexport function toPaths(pathSpec: string): string[] {\n return cache.get(pathSpec) || [];\n}\n", "import type { SimpleGitTask } from '../types';\n\n/**\n * The `GitError` is thrown when the underlying `git` process throws a\n * fatal exception (eg an `ENOENT` exception when attempting to use a\n * non-writable directory as the root for your repo), and acts as the\n * base class for more specific errors thrown by the parsing of the\n * git response or errors in the configuration of the task about to\n * be run.\n *\n * When an exception is thrown, pending tasks in the same instance will\n * not be executed. The recommended way to run a series of tasks that\n * can independently fail without needing to prevent future tasks from\n * running is to catch them individually:\n *\n * ```typescript\n import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';\n\n function catchTask (e: GitError) {\n return e.\n }\n\n const git = gitP(repoWorkingDir);\n const pulled: PullResult | GitError = await git.pull().catch(catchTask);\n const pushed: string | GitError = await git.pushTags().catch(catchTask);\n ```\n */\nexport class GitError extends Error {\n constructor(\n public task?: SimpleGitTask,\n message?: string\n ) {\n super(message);\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n", "import { GitError } from './git-error';\n\n/**\n * The `GitResponseError` is the wrapper for a parsed response that is treated as\n * a fatal error, for example attempting a `merge` can leave the repo in a corrupted\n * state when there are conflicts so the task will reject rather than resolve.\n *\n * For example, catching the merge conflict exception:\n *\n * ```typescript\n import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';\n\n const git = gitP(repoRoot);\n const mergeOptions: string[] = ['--no-ff', 'other-branch'];\n const mergeSummary: MergeSummary = await git.merge(mergeOptions)\n .catch((e: GitResponseError) => e.git);\n\n if (mergeSummary.failed) {\n // deal with the error\n }\n ```\n */\nexport class GitResponseError extends GitError {\n constructor(\n /**\n * `.git` access the parsed response that is treated as being an error\n */\n public readonly git: T,\n message?: string\n ) {\n super(undefined, message || String(git));\n }\n}\n", "import { GitError } from './git-error';\n\n/**\n * The `TaskConfigurationError` is thrown when a command was incorrectly\n * configured. An error of this kind means that no attempt was made to\n * run your command through the underlying `git` binary.\n *\n * Check the `.message` property for more detail on why your configuration\n * resulted in an error.\n */\nexport class TaskConfigurationError extends GitError {\n constructor(message?: string) {\n super(undefined, message);\n }\n}\n", "import { exists, FOLDER } from '@kwsites/file-exists';\nimport { Maybe } from '../types';\n\nexport const NULL = '\\0';\n\nexport const NOOP: (...args: any[]) => void = () => {};\n\n/**\n * Returns either the source argument when it is a `Function`, or the default\n * `NOOP` function constant\n */\nexport function asFunction any>(source: T | any): T {\n return typeof source === 'function' ? source : NOOP;\n}\n\n/**\n * Determines whether the supplied argument is both a function, and is not\n * the `NOOP` function.\n */\nexport function isUserFunction