@prover-coder-ai/docker-git 1.0.54 → 1.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1740,7 +1740,7 @@ var isAutoSyncEnabled = (envValue, hasRemote) => {
|
|
|
1740
1740
|
//#endregion
|
|
1741
1741
|
//#region ../lib/src/usecases/state-repo/github-auth.ts
|
|
1742
1742
|
var githubTokenKey = "GITHUB_TOKEN";
|
|
1743
|
-
var githubHttpsRemoteRe = /^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/;
|
|
1743
|
+
var githubHttpsRemoteRe = /^https:\/\/(?:[^/]+@)?github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/;
|
|
1744
1744
|
var githubSshRemoteRe = /^git@github\.com:([^/]+)\/(.+?)(?:\.git)?$/;
|
|
1745
1745
|
var githubSshUrlRemoteRe = /^ssh:\/\/git@github\.com\/([^/]+)\/(.+?)(?:\.git)?$/;
|
|
1746
1746
|
var tryParseGithubRemoteParts = (originUrl) => {
|
|
@@ -1759,7 +1759,13 @@ var tryBuildGithubCompareUrl = (originUrl, baseBranch, headBranch) => {
|
|
|
1759
1759
|
if (parts === null) return null;
|
|
1760
1760
|
return `https://github.com/${parts.owner}/${parts.repo}/compare/${encodeURIComponent(baseBranch)}...${encodeURIComponent(headBranch)}?expand=1`;
|
|
1761
1761
|
};
|
|
1762
|
-
var isGithubHttpsRemote = (url) => /^https:\/\/github\.com\//.test(url.trim());
|
|
1762
|
+
var isGithubHttpsRemote = (url) => /^https:\/\/(?:[^/]+@)?github\.com\//.test(url.trim());
|
|
1763
|
+
var normalizeGithubHttpsRemote = (url) => {
|
|
1764
|
+
if (!isGithubHttpsRemote(url)) return null;
|
|
1765
|
+
const parts = tryParseGithubRemoteParts(url);
|
|
1766
|
+
return parts === null ? null : `https://github.com/${parts.owner}/${parts.repo}.git`;
|
|
1767
|
+
};
|
|
1768
|
+
var requiresGithubAuthHint = (originUrl, token) => isGithubHttpsRemote(originUrl) && (token?.trim() ?? "").length === 0;
|
|
1763
1769
|
var resolveTokenFromProcessEnv = () => {
|
|
1764
1770
|
const github = process.env["GITHUB_TOKEN"];
|
|
1765
1771
|
if (github !== void 0) {
|
|
@@ -1819,6 +1825,35 @@ var withGithubAskpassEnv = (token, use) => Effect.scoped(Effect.gen(function* (_
|
|
|
1819
1825
|
}));
|
|
1820
1826
|
}));
|
|
1821
1827
|
//#endregion
|
|
1828
|
+
//#region ../lib/src/usecases/state-repo/github-auth-state.ts
|
|
1829
|
+
var githubAuthLoginHint = "GitHub is not authorized for docker-git. To use state sync, run: docker-git auth github login --web";
|
|
1830
|
+
var normalizeOriginUrlIfNeeded = (root, originUrl) => Effect.gen(function* (_) {
|
|
1831
|
+
const normalized = normalizeGithubHttpsRemote(originUrl);
|
|
1832
|
+
if (normalized === null || normalized === originUrl) return originUrl;
|
|
1833
|
+
yield* _(git(root, [
|
|
1834
|
+
"remote",
|
|
1835
|
+
"set-url",
|
|
1836
|
+
"origin",
|
|
1837
|
+
normalized
|
|
1838
|
+
], gitBaseEnv$1));
|
|
1839
|
+
return normalized;
|
|
1840
|
+
});
|
|
1841
|
+
var resolveStateGithubContext = (fs, path, root) => Effect.gen(function* (_) {
|
|
1842
|
+
const originUrl = yield* _(normalizeOriginUrlIfNeeded(root, yield* _(gitCapture$1(root, [
|
|
1843
|
+
"remote",
|
|
1844
|
+
"get-url",
|
|
1845
|
+
"origin"
|
|
1846
|
+
], gitBaseEnv$1).pipe(Effect.map((value) => value.trim())))));
|
|
1847
|
+
const token = yield* _(resolveGithubToken(fs, path, root));
|
|
1848
|
+
return {
|
|
1849
|
+
originUrl,
|
|
1850
|
+
token,
|
|
1851
|
+
authHintNeeded: requiresGithubAuthHint(originUrl, token)
|
|
1852
|
+
};
|
|
1853
|
+
});
|
|
1854
|
+
var shouldLogGithubAuthHintForStateSyncFailure = (originUrl, token, error) => requiresGithubAuthHint(originUrl, token) || isGithubHttpsRemote(originUrl) && error._tag === "CommandFailedError" && error.command === "git fetch origin --prune";
|
|
1855
|
+
var withGithubAuthHintOnFailure = (effect, enabled) => effect.pipe(Effect.tapError(() => enabled ? Effect.logWarning(githubAuthLoginHint) : Effect.void));
|
|
1856
|
+
//#endregion
|
|
1822
1857
|
//#region ../lib/src/usecases/state-repo/gitignore.ts
|
|
1823
1858
|
var stateGitignoreMarker = "# docker-git state repository";
|
|
1824
1859
|
var legacySecretIgnorePatterns = ["**/.orch/env/", "**/.orch/auth/"];
|
|
@@ -4809,6 +4844,101 @@ var runStateSyncOps = (root, originUrl, message, env, options) => Effect.gen(fun
|
|
|
4809
4844
|
}).pipe(Effect.asVoid);
|
|
4810
4845
|
var runStateSyncWithToken = (token, root, originUrl, message) => withGithubAskpassEnv(token, (env) => runStateSyncOps(root, originUrl, message, env, { originPushUrlOverride: originUrl }));
|
|
4811
4846
|
//#endregion
|
|
4847
|
+
//#region ../lib/src/usecases/state-repo/local-ops.ts
|
|
4848
|
+
var resolveStateRoot$2 = (path, cwd) => path.resolve(defaultProjectsRoot(cwd));
|
|
4849
|
+
var managedRepositoryCachePaths$1 = [".cache/git-mirrors", ".cache/packages"];
|
|
4850
|
+
var ensureStateIgnoreAndUntrackCaches$1 = (fs, path, root) => Effect.gen(function* (_) {
|
|
4851
|
+
yield* _(ensureStateGitignore(fs, path, root));
|
|
4852
|
+
yield* _(git(root, [
|
|
4853
|
+
"rm",
|
|
4854
|
+
"-r",
|
|
4855
|
+
"--cached",
|
|
4856
|
+
"--ignore-unmatch",
|
|
4857
|
+
...managedRepositoryCachePaths$1
|
|
4858
|
+
], gitBaseEnv$1));
|
|
4859
|
+
}).pipe(Effect.asVoid);
|
|
4860
|
+
var stateStatus = Effect.gen(function* (_) {
|
|
4861
|
+
const output = yield* _(gitCapture$1(resolveStateRoot$2(yield* _(Path.Path), process.cwd()), [
|
|
4862
|
+
"status",
|
|
4863
|
+
"-sb",
|
|
4864
|
+
"--porcelain=v1"
|
|
4865
|
+
], gitBaseEnv$1));
|
|
4866
|
+
yield* _(Effect.log(output.trim().length > 0 ? output.trimEnd() : "(clean)"));
|
|
4867
|
+
}).pipe(Effect.asVoid);
|
|
4868
|
+
var stateCommit = (message) => Effect.gen(function* (_) {
|
|
4869
|
+
const fs = yield* _(FileSystem.FileSystem);
|
|
4870
|
+
const path = yield* _(Path.Path);
|
|
4871
|
+
const root = resolveStateRoot$2(path, process.cwd());
|
|
4872
|
+
yield* _(ensureStateIgnoreAndUntrackCaches$1(fs, path, root));
|
|
4873
|
+
yield* _(git(root, ["add", "-A"], gitBaseEnv$1));
|
|
4874
|
+
if ((yield* _(gitExitCode(root, [
|
|
4875
|
+
"diff",
|
|
4876
|
+
"--cached",
|
|
4877
|
+
"--quiet"
|
|
4878
|
+
], gitBaseEnv$1))) === successExitCode) {
|
|
4879
|
+
yield* _(Effect.log("Nothing to commit."));
|
|
4880
|
+
return;
|
|
4881
|
+
}
|
|
4882
|
+
yield* _(git(root, [
|
|
4883
|
+
"commit",
|
|
4884
|
+
"-m",
|
|
4885
|
+
message
|
|
4886
|
+
], gitBaseEnv$1));
|
|
4887
|
+
}).pipe(Effect.asVoid);
|
|
4888
|
+
//#endregion
|
|
4889
|
+
//#region ../lib/src/usecases/state-repo/pull-push.ts
|
|
4890
|
+
var resolveStateRoot$1 = (path, cwd) => path.resolve(defaultProjectsRoot(cwd));
|
|
4891
|
+
var statePull = Effect.gen(function* (_) {
|
|
4892
|
+
const fs = yield* _(FileSystem.FileSystem);
|
|
4893
|
+
const path = yield* _(Path.Path);
|
|
4894
|
+
const root = resolveStateRoot$1(path, process.cwd());
|
|
4895
|
+
if ((yield* _(gitExitCode(root, [
|
|
4896
|
+
"remote",
|
|
4897
|
+
"get-url",
|
|
4898
|
+
"origin"
|
|
4899
|
+
], gitBaseEnv$1))) !== successExitCode) {
|
|
4900
|
+
yield* _(git(root, ["pull", "--rebase"], gitBaseEnv$1));
|
|
4901
|
+
return;
|
|
4902
|
+
}
|
|
4903
|
+
const auth = yield* _(resolveStateGithubContext(fs, path, root));
|
|
4904
|
+
yield* _(withGithubAuthHintOnFailure(auth.token && auth.token.length > 0 && isGithubHttpsRemote(auth.originUrl) ? withGithubAskpassEnv(auth.token, (env) => git(root, ["pull", "--rebase"], env)) : git(root, ["pull", "--rebase"], gitBaseEnv$1), auth.authHintNeeded));
|
|
4905
|
+
}).pipe(Effect.asVoid);
|
|
4906
|
+
var statePush = Effect.gen(function* (_) {
|
|
4907
|
+
const fs = yield* _(FileSystem.FileSystem);
|
|
4908
|
+
const path = yield* _(Path.Path);
|
|
4909
|
+
const root = resolveStateRoot$1(path, process.cwd());
|
|
4910
|
+
if ((yield* _(gitExitCode(root, [
|
|
4911
|
+
"remote",
|
|
4912
|
+
"get-url",
|
|
4913
|
+
"origin"
|
|
4914
|
+
], gitBaseEnv$1))) !== successExitCode) {
|
|
4915
|
+
yield* _(git(root, [
|
|
4916
|
+
"push",
|
|
4917
|
+
"-u",
|
|
4918
|
+
"origin",
|
|
4919
|
+
"HEAD"
|
|
4920
|
+
], gitBaseEnv$1));
|
|
4921
|
+
return;
|
|
4922
|
+
}
|
|
4923
|
+
const auth = yield* _(resolveStateGithubContext(fs, path, root));
|
|
4924
|
+
yield* _(withGithubAuthHintOnFailure(auth.token && auth.token.length > 0 && isGithubHttpsRemote(auth.originUrl) ? withGithubAskpassEnv(auth.token, (env) => pipe(gitCapture$1(root, [
|
|
4925
|
+
"rev-parse",
|
|
4926
|
+
"--abbrev-ref",
|
|
4927
|
+
"HEAD"
|
|
4928
|
+
], env), Effect.map((value) => value.trim()), Effect.map((branch) => branch === "HEAD" ? "main" : branch), Effect.flatMap((branch) => git(root, [
|
|
4929
|
+
"push",
|
|
4930
|
+
"--no-verify",
|
|
4931
|
+
auth.originUrl,
|
|
4932
|
+
`HEAD:refs/heads/${branch}`
|
|
4933
|
+
], env)))) : git(root, [
|
|
4934
|
+
"push",
|
|
4935
|
+
"--no-verify",
|
|
4936
|
+
"-u",
|
|
4937
|
+
"origin",
|
|
4938
|
+
"HEAD"
|
|
4939
|
+
], gitBaseEnv$1), auth.authHintNeeded));
|
|
4940
|
+
}).pipe(Effect.asVoid);
|
|
4941
|
+
//#endregion
|
|
4812
4942
|
//#region ../lib/src/usecases/state-repo.ts
|
|
4813
4943
|
var resolveStateRoot = (path, cwd) => path.resolve(defaultProjectsRoot(cwd));
|
|
4814
4944
|
var managedRepositoryCachePaths = [".cache/git-mirrors", ".cache/packages"];
|
|
@@ -4853,13 +4983,13 @@ var stateSync = (message) => Effect.gen(function* (_) {
|
|
|
4853
4983
|
exitCode: originUrlExit
|
|
4854
4984
|
})));
|
|
4855
4985
|
}
|
|
4856
|
-
const originUrl = yield* _(gitCapture$1(root, [
|
|
4986
|
+
const originUrl = yield* _(normalizeOriginUrlIfNeeded(root, yield* _(gitCapture$1(root, [
|
|
4857
4987
|
"remote",
|
|
4858
4988
|
"get-url",
|
|
4859
4989
|
"origin"
|
|
4860
|
-
], gitBaseEnv$1).pipe(Effect.map((value) => value.trim())));
|
|
4990
|
+
], gitBaseEnv$1).pipe(Effect.map((value) => value.trim())))));
|
|
4861
4991
|
const token = yield* _(resolveGithubToken(fs, path, root));
|
|
4862
|
-
yield* _(token && token.length > 0 && isGithubHttpsRemote(originUrl) ? runStateSyncWithToken(token, root, originUrl, message) : runStateSyncOps(root, originUrl, message, gitBaseEnv$1));
|
|
4992
|
+
yield* _((token && token.length > 0 && isGithubHttpsRemote(originUrl) ? runStateSyncWithToken(token, root, originUrl, message) : runStateSyncOps(root, originUrl, message, gitBaseEnv$1)).pipe(Effect.tapError((error) => shouldLogGithubAuthHintForStateSyncFailure(originUrl, token, error) ? Effect.logWarning(githubAuthLoginHint) : Effect.void)));
|
|
4863
4993
|
}).pipe(Effect.asVoid);
|
|
4864
4994
|
var autoSyncState = (message) => Effect.gen(function* (_) {
|
|
4865
4995
|
const root = resolveStateRoot(yield* _(Path.Path), process.cwd());
|
|
@@ -4961,94 +5091,6 @@ var stateInit = (input) => {
|
|
|
4961
5091
|
const token = input.token?.trim() ?? "";
|
|
4962
5092
|
return token.length > 0 && isGithubHttpsRemote(input.repoUrl) ? withGithubAskpassEnv(token, doInit) : doInit(gitBaseEnv$1);
|
|
4963
5093
|
};
|
|
4964
|
-
var stateStatus = Effect.gen(function* (_) {
|
|
4965
|
-
const output = yield* _(gitCapture$1(resolveStateRoot(yield* _(Path.Path), process.cwd()), [
|
|
4966
|
-
"status",
|
|
4967
|
-
"-sb",
|
|
4968
|
-
"--porcelain=v1"
|
|
4969
|
-
], gitBaseEnv$1));
|
|
4970
|
-
yield* _(Effect.log(output.trim().length > 0 ? output.trimEnd() : "(clean)"));
|
|
4971
|
-
}).pipe(Effect.asVoid);
|
|
4972
|
-
var statePull = Effect.gen(function* (_) {
|
|
4973
|
-
const fs = yield* _(FileSystem.FileSystem);
|
|
4974
|
-
const path = yield* _(Path.Path);
|
|
4975
|
-
const root = resolveStateRoot(path, process.cwd());
|
|
4976
|
-
if ((yield* _(gitExitCode(root, [
|
|
4977
|
-
"remote",
|
|
4978
|
-
"get-url",
|
|
4979
|
-
"origin"
|
|
4980
|
-
], gitBaseEnv$1))) !== successExitCode) {
|
|
4981
|
-
yield* _(git(root, ["pull", "--rebase"], gitBaseEnv$1));
|
|
4982
|
-
return;
|
|
4983
|
-
}
|
|
4984
|
-
const originUrl = yield* _(gitCapture$1(root, [
|
|
4985
|
-
"remote",
|
|
4986
|
-
"get-url",
|
|
4987
|
-
"origin"
|
|
4988
|
-
], gitBaseEnv$1).pipe(Effect.map((value) => value.trim())));
|
|
4989
|
-
const token = yield* _(resolveGithubToken(fs, path, root));
|
|
4990
|
-
yield* _(token && token.length > 0 && isGithubHttpsRemote(originUrl) ? withGithubAskpassEnv(token, (env) => git(root, ["pull", "--rebase"], env)) : git(root, ["pull", "--rebase"], gitBaseEnv$1));
|
|
4991
|
-
}).pipe(Effect.asVoid);
|
|
4992
|
-
var statePush = Effect.gen(function* (_) {
|
|
4993
|
-
const fs = yield* _(FileSystem.FileSystem);
|
|
4994
|
-
const path = yield* _(Path.Path);
|
|
4995
|
-
const root = resolveStateRoot(path, process.cwd());
|
|
4996
|
-
if ((yield* _(gitExitCode(root, [
|
|
4997
|
-
"remote",
|
|
4998
|
-
"get-url",
|
|
4999
|
-
"origin"
|
|
5000
|
-
], gitBaseEnv$1))) !== successExitCode) {
|
|
5001
|
-
yield* _(git(root, [
|
|
5002
|
-
"push",
|
|
5003
|
-
"-u",
|
|
5004
|
-
"origin",
|
|
5005
|
-
"HEAD"
|
|
5006
|
-
], gitBaseEnv$1));
|
|
5007
|
-
return;
|
|
5008
|
-
}
|
|
5009
|
-
const originUrl = yield* _(gitCapture$1(root, [
|
|
5010
|
-
"remote",
|
|
5011
|
-
"get-url",
|
|
5012
|
-
"origin"
|
|
5013
|
-
], gitBaseEnv$1).pipe(Effect.map((value) => value.trim())));
|
|
5014
|
-
const token = yield* _(resolveGithubToken(fs, path, root));
|
|
5015
|
-
yield* _(token && token.length > 0 && isGithubHttpsRemote(originUrl) ? withGithubAskpassEnv(token, (env) => pipe(gitCapture$1(root, [
|
|
5016
|
-
"rev-parse",
|
|
5017
|
-
"--abbrev-ref",
|
|
5018
|
-
"HEAD"
|
|
5019
|
-
], env), Effect.map((value) => value.trim()), Effect.map((branch) => branch === "HEAD" ? "main" : branch), Effect.flatMap((branch) => git(root, [
|
|
5020
|
-
"push",
|
|
5021
|
-
"--no-verify",
|
|
5022
|
-
originUrl,
|
|
5023
|
-
`HEAD:refs/heads/${branch}`
|
|
5024
|
-
], env)))) : git(root, [
|
|
5025
|
-
"push",
|
|
5026
|
-
"--no-verify",
|
|
5027
|
-
"-u",
|
|
5028
|
-
"origin",
|
|
5029
|
-
"HEAD"
|
|
5030
|
-
], gitBaseEnv$1));
|
|
5031
|
-
}).pipe(Effect.asVoid);
|
|
5032
|
-
var stateCommit = (message) => Effect.gen(function* (_) {
|
|
5033
|
-
const fs = yield* _(FileSystem.FileSystem);
|
|
5034
|
-
const path = yield* _(Path.Path);
|
|
5035
|
-
const root = resolveStateRoot(path, process.cwd());
|
|
5036
|
-
yield* _(ensureStateIgnoreAndUntrackCaches(fs, path, root));
|
|
5037
|
-
yield* _(git(root, ["add", "-A"], gitBaseEnv$1));
|
|
5038
|
-
if ((yield* _(gitExitCode(root, [
|
|
5039
|
-
"diff",
|
|
5040
|
-
"--cached",
|
|
5041
|
-
"--quiet"
|
|
5042
|
-
], gitBaseEnv$1))) === successExitCode) {
|
|
5043
|
-
yield* _(Effect.log("Nothing to commit."));
|
|
5044
|
-
return;
|
|
5045
|
-
}
|
|
5046
|
-
yield* _(git(root, [
|
|
5047
|
-
"commit",
|
|
5048
|
-
"-m",
|
|
5049
|
-
message
|
|
5050
|
-
], gitBaseEnv$1));
|
|
5051
|
-
}).pipe(Effect.asVoid);
|
|
5052
5094
|
//#endregion
|
|
5053
5095
|
//#region ../lib/src/usecases/terminal-cursor.ts
|
|
5054
5096
|
var terminalSaneEscape = "\x1B[0m\x1B[?25h\x1B[?1l\x1B>\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1005l\x1B[?1006l\x1B[?1015l\x1B[?1007l\x1B[?1004l\x1B[?2004l\x1B[>4;0m\x1B[>4m\x1B[<u";
|