@jpkme/diff-review 0.1.6 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -1
- package/bin/diff-review.mjs +227 -18
- package/lib/agents.mjs +319 -0
- package/lib/agents.test.mjs +195 -0
- package/lib/check-report.mjs +2 -1
- package/lib/check-report.test.mjs +1 -0
- package/lib/fingerprint.mjs +24 -0
- package/lib/git.mjs +2 -19
- package/lib/output-name.mjs +1 -1
- package/lib/prompt.mjs +19 -18
- package/lib/review-meta.mjs +33 -0
- package/lib/review-meta.test.mjs +30 -0
- package/lib/review.test.mjs +1 -0
- package/lib/validate.mjs +28 -11
- package/lib/validate.test.mjs +25 -0
- package/lib/wait-output.mjs +43 -17
- package/lib/wait-output.test.mjs +68 -0
- package/package.json +1 -1
- package/schema.json +9 -10
- package/web/build/client/_app/immutable/assets/2.CNFDEnjx.css +1 -0
- package/web/build/client/_app/immutable/assets/2.CNFDEnjx.css.br +0 -0
- package/web/build/client/_app/immutable/assets/2.CNFDEnjx.css.gz +0 -0
- package/web/build/client/_app/immutable/assets/{3.qhPDz1xQ.css → 3.PHTPLlZ7.css} +1 -1
- package/web/build/client/_app/immutable/assets/3.PHTPLlZ7.css.br +0 -0
- package/web/build/client/_app/immutable/assets/{3.qhPDz1xQ.css.gz → 3.PHTPLlZ7.css.gz} +0 -0
- package/web/build/client/_app/immutable/chunks/BBWAo_yW.js +2 -0
- package/web/build/client/_app/immutable/chunks/BBWAo_yW.js.br +0 -0
- package/web/build/client/_app/immutable/chunks/BBWAo_yW.js.gz +0 -0
- package/web/build/client/_app/immutable/chunks/{DRga3k74.js → QdZF3nkf.js} +35 -33
- package/web/build/client/_app/immutable/chunks/QdZF3nkf.js.br +0 -0
- package/web/build/client/_app/immutable/chunks/QdZF3nkf.js.gz +0 -0
- package/web/build/client/_app/immutable/entry/{app.BP_R_kTF.js → app.Dce6uJU3.js} +2 -2
- package/web/build/client/_app/immutable/entry/app.Dce6uJU3.js.br +0 -0
- package/web/build/client/_app/immutable/entry/app.Dce6uJU3.js.gz +0 -0
- package/web/build/client/_app/immutable/entry/start.DnBSC38l.js +1 -0
- package/web/build/client/_app/immutable/entry/start.DnBSC38l.js.br +0 -0
- package/web/build/client/_app/immutable/entry/start.DnBSC38l.js.gz +0 -0
- package/web/build/client/_app/immutable/nodes/1.5Iv4ssDT.js +1 -0
- package/web/build/client/_app/immutable/nodes/1.5Iv4ssDT.js.br +0 -0
- package/web/build/client/_app/immutable/nodes/1.5Iv4ssDT.js.gz +0 -0
- package/web/build/client/_app/immutable/nodes/2.BomzYVBF.js +66 -0
- package/web/build/client/_app/immutable/nodes/2.BomzYVBF.js.br +0 -0
- package/web/build/client/_app/immutable/nodes/2.BomzYVBF.js.gz +0 -0
- package/web/build/client/_app/immutable/nodes/{3.Bn5l-P1e.js → 3.CeUs4lBX.js} +2 -2
- package/web/build/client/_app/immutable/nodes/3.CeUs4lBX.js.br +0 -0
- package/web/build/client/_app/immutable/nodes/3.CeUs4lBX.js.gz +0 -0
- package/web/build/client/_app/version.json +1 -1
- package/web/build/client/_app/version.json.br +0 -0
- package/web/build/client/_app/version.json.gz +0 -0
- package/web/build/handler.js +3 -3
- package/web/build/index.js +3 -3
- package/web/build/server/chunks/1-2OO2bb7H.js +7 -0
- package/web/build/server/chunks/1-2OO2bb7H.js.map +1 -0
- package/web/build/server/chunks/2-BJvuqKN6.js +7 -0
- package/web/build/server/chunks/2-BJvuqKN6.js.map +1 -0
- package/web/build/server/chunks/3-ZIl1rHef.js +7 -0
- package/web/build/server/chunks/{3-DaeIJXI7.js.map → 3-ZIl1rHef.js.map} +1 -1
- package/web/build/server/chunks/{handler-2eew4UOl.js → handler-B5P65tLk.js} +3 -3
- package/web/build/server/chunks/{handler-2eew4UOl.js.map → handler-B5P65tLk.js.map} +1 -1
- package/web/build/server/chunks/{index.js-DbiNsix3.js → index.js-CL95e0Gl.js} +2 -2
- package/web/build/server/chunks/index.js-CL95e0Gl.js.map +1 -0
- package/web/build/server/chunks/{manifest.js-BYNXhn6E.js → manifest.js-uD_a0079.js} +6 -6
- package/web/build/server/chunks/{manifest.js-BYNXhn6E.js.map → manifest.js-uD_a0079.js.map} +1 -1
- package/web/build/server/chunks/{remote-1g4ayag-DESnyPRn.js → remote-1g4ayag-B67QMR_2.js} +154 -149
- package/web/build/server/chunks/remote-1g4ayag-B67QMR_2.js.map +1 -0
- package/web/build/client/_app/immutable/assets/2.Xnfq26gJ.css +0 -1
- package/web/build/client/_app/immutable/assets/2.Xnfq26gJ.css.br +0 -0
- package/web/build/client/_app/immutable/assets/2.Xnfq26gJ.css.gz +0 -0
- package/web/build/client/_app/immutable/assets/3.qhPDz1xQ.css.br +0 -0
- package/web/build/client/_app/immutable/chunks/Ber_0nz7.js +0 -1
- package/web/build/client/_app/immutable/chunks/Ber_0nz7.js.br +0 -2
- package/web/build/client/_app/immutable/chunks/Ber_0nz7.js.gz +0 -0
- package/web/build/client/_app/immutable/chunks/DRga3k74.js.br +0 -0
- package/web/build/client/_app/immutable/chunks/DRga3k74.js.gz +0 -0
- package/web/build/client/_app/immutable/chunks/zvcaSoGP.js +0 -2
- package/web/build/client/_app/immutable/chunks/zvcaSoGP.js.br +0 -0
- package/web/build/client/_app/immutable/chunks/zvcaSoGP.js.gz +0 -0
- package/web/build/client/_app/immutable/entry/app.BP_R_kTF.js.br +0 -0
- package/web/build/client/_app/immutable/entry/app.BP_R_kTF.js.gz +0 -0
- package/web/build/client/_app/immutable/entry/start.lXpYdwbt.js +0 -1
- package/web/build/client/_app/immutable/entry/start.lXpYdwbt.js.br +0 -1
- package/web/build/client/_app/immutable/entry/start.lXpYdwbt.js.gz +0 -0
- package/web/build/client/_app/immutable/nodes/1.CGJk77oo.js +0 -1
- package/web/build/client/_app/immutable/nodes/1.CGJk77oo.js.br +0 -3
- package/web/build/client/_app/immutable/nodes/1.CGJk77oo.js.gz +0 -0
- package/web/build/client/_app/immutable/nodes/2.Dl2xIvoV.js +0 -66
- package/web/build/client/_app/immutable/nodes/2.Dl2xIvoV.js.br +0 -0
- package/web/build/client/_app/immutable/nodes/2.Dl2xIvoV.js.gz +0 -0
- package/web/build/client/_app/immutable/nodes/3.Bn5l-P1e.js.br +0 -0
- package/web/build/client/_app/immutable/nodes/3.Bn5l-P1e.js.gz +0 -0
- package/web/build/server/chunks/1-CRg9pswO.js +0 -7
- package/web/build/server/chunks/1-CRg9pswO.js.map +0 -1
- package/web/build/server/chunks/2-BmYzresl.js +0 -7
- package/web/build/server/chunks/2-BmYzresl.js.map +0 -1
- package/web/build/server/chunks/3-DaeIJXI7.js +0 -7
- package/web/build/server/chunks/index.js-DbiNsix3.js.map +0 -1
- package/web/build/server/chunks/remote-1g4ayag-DESnyPRn.js.map +0 -1
|
@@ -10,15 +10,15 @@ return {
|
|
|
10
10
|
assets: new Set([]),
|
|
11
11
|
mimeTypes: {},
|
|
12
12
|
_: {
|
|
13
|
-
client: {start:"_app/immutable/entry/start.
|
|
13
|
+
client: {start:"_app/immutable/entry/start.DnBSC38l.js",app:"_app/immutable/entry/app.Dce6uJU3.js",imports:["_app/immutable/entry/start.DnBSC38l.js","_app/immutable/chunks/BBWAo_yW.js","_app/immutable/chunks/Dur-vdUf.js","_app/immutable/entry/app.Dce6uJU3.js","_app/immutable/chunks/Dur-vdUf.js","_app/immutable/chunks/tYeNsyIK.js"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},
|
|
14
14
|
nodes: [
|
|
15
15
|
__memo(() => import('./0-SseDy__O.js')),
|
|
16
|
-
__memo(() => import('./1-
|
|
17
|
-
__memo(() => import('./2-
|
|
18
|
-
__memo(() => import('./3-
|
|
16
|
+
__memo(() => import('./1-2OO2bb7H.js')),
|
|
17
|
+
__memo(() => import('./2-BJvuqKN6.js')),
|
|
18
|
+
__memo(() => import('./3-ZIl1rHef.js'))
|
|
19
19
|
],
|
|
20
20
|
remotes: {
|
|
21
|
-
'1g4ayag': __memo(() => import('./remote-1g4ayag-
|
|
21
|
+
'1g4ayag': __memo(() => import('./remote-1g4ayag-B67QMR_2.js'))
|
|
22
22
|
},
|
|
23
23
|
routes: [
|
|
24
24
|
{
|
|
@@ -47,4 +47,4 @@ return {
|
|
|
47
47
|
})();
|
|
48
48
|
|
|
49
49
|
export { manifest as m };
|
|
50
|
-
//# sourceMappingURL=manifest.js-
|
|
50
|
+
//# sourceMappingURL=manifest.js-uD_a0079.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js-
|
|
1
|
+
{"version":3,"file":"manifest.js-uD_a0079.js","sources":["../../../.svelte-kit/output/server/manifest.js"],"sourcesContent":["export const manifest = (() => {\nfunction __memo(fn) {\n\tlet value;\n\treturn () => value ??= (value = fn());\n}\n\nreturn {\n\tappDir: \"_app\",\n\tappPath: \"_app\",\n\tassets: new Set([]),\n\tmimeTypes: {},\n\t_: {\n\t\tclient: {start:\"_app/immutable/entry/start.DnBSC38l.js\",app:\"_app/immutable/entry/app.Dce6uJU3.js\",imports:[\"_app/immutable/entry/start.DnBSC38l.js\",\"_app/immutable/chunks/BBWAo_yW.js\",\"_app/immutable/chunks/Dur-vdUf.js\",\"_app/immutable/entry/app.Dce6uJU3.js\",\"_app/immutable/chunks/Dur-vdUf.js\",\"_app/immutable/chunks/tYeNsyIK.js\"],stylesheets:[],fonts:[],uses_env_dynamic_public:false},\n\t\tnodes: [\n\t\t\t__memo(() => import('./nodes/0.js')),\n\t\t\t__memo(() => import('./nodes/1.js')),\n\t\t\t__memo(() => import('./nodes/2.js')),\n\t\t\t__memo(() => import('./nodes/3.js'))\n\t\t],\n\t\tremotes: {\n\t\t\t'1g4ayag': __memo(() => import('./chunks/remote-1g4ayag.js'))\n\t\t},\n\t\troutes: [\n\t\t\t{\n\t\t\t\tid: \"/\",\n\t\t\t\tpattern: /^\\/$/,\n\t\t\t\tparams: [],\n\t\t\t\tpage: { layouts: [0,], errors: [1,], leaf: 2 },\n\t\t\t\tendpoint: null\n\t\t\t},\n\t\t\t{\n\t\t\t\tid: \"/report/[id]\",\n\t\t\t\tpattern: /^\\/report\\/([^/]+?)\\/?$/,\n\t\t\t\tparams: [{\"name\":\"id\",\"optional\":false,\"rest\":false,\"chained\":false}],\n\t\t\t\tpage: { layouts: [0,], errors: [1,], leaf: 3 },\n\t\t\t\tendpoint: null\n\t\t\t}\n\t\t],\n\t\tprerendered_routes: new Set([]),\n\t\tmatchers: async () => {\n\t\t\t\n\t\t\treturn { };\n\t\t},\n\t\tserver_assets: {}\n\t}\n}\n})();\n"],"names":[],"mappings":"AAAY,MAAC,QAAQ,GAAG,CAAC,MAAM;AAC/B,SAAS,MAAM,CAAC,EAAE,EAAE;AACpB,CAAC,IAAI,KAAK;AACV,CAAC,OAAO,MAAM,KAAK,MAAM,KAAK,GAAG,EAAE,EAAE,CAAC;AACtC;;AAEA,OAAO;AACP,CAAC,MAAM,EAAE,MAAM;AACf,CAAC,OAAO,EAAE,MAAM;AAChB,CAAC,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC;AACpB,CAAC,SAAS,EAAE,EAAE;AACd,CAAC,CAAC,EAAE;AACJ,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,wCAAwC,CAAC,GAAG,CAAC,sCAAsC,CAAC,OAAO,CAAC,CAAC,wCAAwC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,sCAAsC,CAAC,mCAAmC,CAAC,mCAAmC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAAC,KAAK,CAAC;AACrY,EAAE,KAAK,EAAE;AACT,GAAG,MAAM,CAAC,MAAM,OAAO,iBAAc,CAAC,CAAC;AACvC,GAAG,MAAM,CAAC,MAAM,OAAO,iBAAc,CAAC,CAAC;AACvC,GAAG,MAAM,CAAC,MAAM,OAAO,iBAAc,CAAC,CAAC;AACvC,GAAG,MAAM,CAAC,MAAM,OAAO,iBAAc,CAAC;AACtC,GAAG;AACH,EAAE,OAAO,EAAE;AACX,GAAG,SAAS,EAAE,MAAM,CAAC,MAAM,OAAO,8BAA4B,CAAC;AAC/D,GAAG;AACH,EAAE,MAAM,EAAE;AACV,GAAG;AACH,IAAI,EAAE,EAAE,GAAG;AACX,IAAI,OAAO,EAAE,MAAM;AACnB,IAAI,MAAM,EAAE,EAAE;AACd,IAAI,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAClD,IAAI,QAAQ,EAAE;AACd,IAAI;AACJ,GAAG;AACH,IAAI,EAAE,EAAE,cAAc;AACtB,IAAI,OAAO,EAAE,yBAAyB;AACtC,IAAI,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACzE,IAAI,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;AAClD,IAAI,QAAQ,EAAE;AACd;AACA,GAAG;AACH,EAAE,kBAAkB,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC;AACjC,EAAE,QAAQ,EAAE,YAAY;AACxB;AACA,GAAG,OAAO,IAAI;AACd,EAAE,CAAC;AACH,EAAE,aAAa,EAAE;AACjB;AACA;AACA,CAAC;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { e as error, g as get_request_store, b as stringify_remote_arg, M as MUTATIVE_METHODS, w as with_request_store, c as create_remote_key, n as noop, H as HttpError, S as SvelteKitError, h as handle_error_and_jsonify, _ as __exportAll, i as init_remote_functions } from './index.js-
|
|
2
|
-
import { execFileSync, spawnSync } from 'node:child_process';
|
|
3
|
-
import { existsSync, readFileSync, statSync, readdirSync, mkdtempSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
1
|
+
import { e as error, g as get_request_store, b as stringify_remote_arg, M as MUTATIVE_METHODS, w as with_request_store, c as create_remote_key, n as noop, H as HttpError, S as SvelteKitError, h as handle_error_and_jsonify, _ as __exportAll, i as init_remote_functions } from './index.js-CL95e0Gl.js';
|
|
4
2
|
import { join, basename, resolve } from 'node:path';
|
|
3
|
+
import { existsSync, readFileSync, statSync, readdirSync, mkdtempSync, rmSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
4
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
5
5
|
import { createHash } from 'node:crypto';
|
|
6
6
|
import { tmpdir, platform } from 'node:os';
|
|
7
7
|
import process$1 from 'node:process';
|
|
@@ -957,58 +957,13 @@ Object.defineProperty(query, "live", {
|
|
|
957
957
|
enumerable: true
|
|
958
958
|
});
|
|
959
959
|
|
|
960
|
-
//#region ../lib/
|
|
961
|
-
function assertGitRepo(repo) {
|
|
962
|
-
const raw = String(repo || "").trim();
|
|
963
|
-
if (!raw) throw new Error("Indicá la ruta absoluta de un repositorio git.");
|
|
964
|
-
if (!/[\\/]/.test(raw) && !/^[A-Za-z]:/.test(raw)) throw new Error(`"${raw}" no es una ruta. Pegá la ruta absoluta del repo (ej. C:\\tienda-argenta\\tienda-argenta-2).`);
|
|
965
|
-
const resolved = resolve(raw);
|
|
966
|
-
if (!resolved || resolved === ".") throw new Error("Indicá la ruta absoluta de un repositorio git.");
|
|
967
|
-
if (!existsSync(resolved)) throw new Error(`No existe la carpeta: ${resolved}`);
|
|
968
|
-
if (!existsSync(join(resolved, ".git"))) throw new Error(`No es un repositorio git (falta .git): ${resolved}`);
|
|
969
|
-
return resolved;
|
|
970
|
-
}
|
|
960
|
+
//#region ../lib/fingerprint.mjs
|
|
971
961
|
/**
|
|
972
|
-
*
|
|
973
|
-
* Acepta subcarpetas (usa `git rev-parse --show-toplevel`).
|
|
962
|
+
* Tips cortos de SHA. Sin APIs de Node: la UI lo importa para armar el nombre del JSON.
|
|
974
963
|
*/
|
|
975
|
-
function
|
|
976
|
-
const
|
|
977
|
-
|
|
978
|
-
const dir = resolve(raw);
|
|
979
|
-
if (!existsSync(dir)) return null;
|
|
980
|
-
try {
|
|
981
|
-
const root = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
982
|
-
cwd: dir,
|
|
983
|
-
encoding: "utf8",
|
|
984
|
-
windowsHide: true,
|
|
985
|
-
stdio: [
|
|
986
|
-
"ignore",
|
|
987
|
-
"pipe",
|
|
988
|
-
"ignore"
|
|
989
|
-
]
|
|
990
|
-
}).trim();
|
|
991
|
-
return root ? resolve(root) : null;
|
|
992
|
-
} catch {
|
|
993
|
-
return null;
|
|
994
|
-
}
|
|
995
|
-
}
|
|
996
|
-
function git(repo, args, { maxBuffer = 64 * 1024 * 1024 } = {}) {
|
|
997
|
-
return execFileSync("git", args, {
|
|
998
|
-
cwd: repo,
|
|
999
|
-
encoding: "utf8",
|
|
1000
|
-
maxBuffer,
|
|
1001
|
-
windowsHide: true
|
|
1002
|
-
});
|
|
1003
|
-
}
|
|
1004
|
-
function resolveRev(repo, ref) {
|
|
1005
|
-
return git(repo, ["rev-parse", ref]).trim();
|
|
1006
|
-
}
|
|
1007
|
-
function branchTips(repo, branch, base) {
|
|
1008
|
-
return {
|
|
1009
|
-
branchSha: resolveRev(repo, branch),
|
|
1010
|
-
baseSha: resolveRev(repo, base)
|
|
1011
|
-
};
|
|
964
|
+
function shortSha(sha, n = 10) {
|
|
965
|
+
const hex = String(sha || "").toLowerCase().replace(/[^a-f0-9]/g, "");
|
|
966
|
+
return hex.length >= 7 ? hex.slice(0, n) : "";
|
|
1012
967
|
}
|
|
1013
968
|
function fingerprint(branchSha, baseSha) {
|
|
1014
969
|
const a = shortSha(branchSha);
|
|
@@ -1016,101 +971,6 @@ function fingerprint(branchSha, baseSha) {
|
|
|
1016
971
|
if (!a || !b) return null;
|
|
1017
972
|
return `${a}-${b}`;
|
|
1018
973
|
}
|
|
1019
|
-
function shortSha(sha, n = 10) {
|
|
1020
|
-
const hex = String(sha || "").toLowerCase().replace(/[^a-f0-9]/g, "");
|
|
1021
|
-
return hex.length >= 7 ? hex.slice(0, n) : "";
|
|
1022
|
-
}
|
|
1023
|
-
function commitLog(repo, mergeBase, branch, limit = 25) {
|
|
1024
|
-
try {
|
|
1025
|
-
return git(repo, [
|
|
1026
|
-
"log",
|
|
1027
|
-
"--oneline",
|
|
1028
|
-
"--no-merges",
|
|
1029
|
-
"-n",
|
|
1030
|
-
String(limit),
|
|
1031
|
-
`${mergeBase}..${branch}`
|
|
1032
|
-
]).trim().split("\n").filter(Boolean);
|
|
1033
|
-
} catch {
|
|
1034
|
-
return [];
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
var FILE_LINE_CACHE = /* @__PURE__ */ new Map();
|
|
1038
|
-
var FILE_LINE_CACHE_MAX = 48;
|
|
1039
|
-
function rememberFileLines(key, lines) {
|
|
1040
|
-
if (FILE_LINE_CACHE.has(key)) FILE_LINE_CACHE.delete(key);
|
|
1041
|
-
FILE_LINE_CACHE.set(key, lines);
|
|
1042
|
-
while (FILE_LINE_CACHE.size > FILE_LINE_CACHE_MAX) {
|
|
1043
|
-
const oldest = FILE_LINE_CACHE.keys().next().value;
|
|
1044
|
-
FILE_LINE_CACHE.delete(oldest);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
function showFileLines(repo, rev, path) {
|
|
1048
|
-
const resolved = assertGitRepo(repo);
|
|
1049
|
-
const safeRev = String(rev || "").trim();
|
|
1050
|
-
const safePath = String(path || "").replace(/\\/g, "/").trim();
|
|
1051
|
-
if (!safeRev || !/^[A-Za-z0-9._/\-]+$/.test(safeRev)) throw new Error("Rev inválido.");
|
|
1052
|
-
if (!safePath || safePath.startsWith("/") || safePath.includes("..") || safePath.includes("\0")) throw new Error("Ruta inválida.");
|
|
1053
|
-
const key = `${resolved}\0${safeRev}\0${safePath}`;
|
|
1054
|
-
if (FILE_LINE_CACHE.has(key)) return FILE_LINE_CACHE.get(key);
|
|
1055
|
-
let text;
|
|
1056
|
-
try {
|
|
1057
|
-
text = git(resolved, ["show", `${safeRev}:${safePath}`]);
|
|
1058
|
-
} catch {
|
|
1059
|
-
rememberFileLines(key, null);
|
|
1060
|
-
return null;
|
|
1061
|
-
}
|
|
1062
|
-
if (text.includes("\0")) {
|
|
1063
|
-
rememberFileLines(key, null);
|
|
1064
|
-
return null;
|
|
1065
|
-
}
|
|
1066
|
-
const raw = text.replace(/\r\n/g, "\n");
|
|
1067
|
-
const lines = raw.endsWith("\n") ? raw.slice(0, -1).split("\n") : raw.split("\n");
|
|
1068
|
-
rememberFileLines(key, lines);
|
|
1069
|
-
return lines;
|
|
1070
|
-
}
|
|
1071
|
-
function listBranches(repo) {
|
|
1072
|
-
const names = git(repo, [
|
|
1073
|
-
"for-each-ref",
|
|
1074
|
-
"--sort=-committerdate",
|
|
1075
|
-
"--format=%(refname:short)",
|
|
1076
|
-
"refs/heads",
|
|
1077
|
-
"refs/remotes"
|
|
1078
|
-
]).split("\n").map((s) => s.trim()).filter(Boolean).map((name) => name.replace(/^origin\//, "")).filter((name) => name !== "HEAD" && !name.endsWith("/HEAD"));
|
|
1079
|
-
const unique = [...new Set(names)];
|
|
1080
|
-
const current = git(repo, [
|
|
1081
|
-
"rev-parse",
|
|
1082
|
-
"--abbrev-ref",
|
|
1083
|
-
"HEAD"
|
|
1084
|
-
]).trim();
|
|
1085
|
-
const bases = unique.filter((n) => n === "develop" || n === "main" || n === "master");
|
|
1086
|
-
return {
|
|
1087
|
-
branches: unique,
|
|
1088
|
-
current,
|
|
1089
|
-
defaultBase: bases.includes("develop") ? "develop" : bases.includes("main") ? "main" : bases[0] || "develop"
|
|
1090
|
-
};
|
|
1091
|
-
}
|
|
1092
|
-
/** URL del remote (origin, o el primero disponible). Vacío si no hay. */
|
|
1093
|
-
function getRemoteUrl(repo, preferred = "origin") {
|
|
1094
|
-
try {
|
|
1095
|
-
const url = git(repo, [
|
|
1096
|
-
"remote",
|
|
1097
|
-
"get-url",
|
|
1098
|
-
preferred
|
|
1099
|
-
]).trim();
|
|
1100
|
-
if (url) return url;
|
|
1101
|
-
} catch {}
|
|
1102
|
-
try {
|
|
1103
|
-
const remotes = git(repo, ["remote"]).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
1104
|
-
if (!remotes.length) return "";
|
|
1105
|
-
return git(repo, [
|
|
1106
|
-
"remote",
|
|
1107
|
-
"get-url",
|
|
1108
|
-
remotes[0]
|
|
1109
|
-
]).trim();
|
|
1110
|
-
} catch {
|
|
1111
|
-
return "";
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
974
|
//#endregion
|
|
1115
975
|
//#region ../lib/output-name.mjs
|
|
1116
976
|
/**
|
|
@@ -1339,6 +1199,151 @@ function capDiff(diff, max = STORE_DIFF_MAX) {
|
|
|
1339
1199
|
};
|
|
1340
1200
|
}
|
|
1341
1201
|
//#endregion
|
|
1202
|
+
//#region ../lib/git.mjs
|
|
1203
|
+
function assertGitRepo(repo) {
|
|
1204
|
+
const raw = String(repo || "").trim();
|
|
1205
|
+
if (!raw) throw new Error("Indicá la ruta absoluta de un repositorio git.");
|
|
1206
|
+
if (!/[\\/]/.test(raw) && !/^[A-Za-z]:/.test(raw)) throw new Error(`"${raw}" no es una ruta. Pegá la ruta absoluta del repo (ej. C:\\tienda-argenta\\tienda-argenta-2).`);
|
|
1207
|
+
const resolved = resolve(raw);
|
|
1208
|
+
if (!resolved || resolved === ".") throw new Error("Indicá la ruta absoluta de un repositorio git.");
|
|
1209
|
+
if (!existsSync(resolved)) throw new Error(`No existe la carpeta: ${resolved}`);
|
|
1210
|
+
if (!existsSync(join(resolved, ".git"))) throw new Error(`No es un repositorio git (falta .git): ${resolved}`);
|
|
1211
|
+
return resolved;
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Si `cwd` está dentro de un repo git, devuelve la raíz absoluta; si no, null.
|
|
1215
|
+
* Acepta subcarpetas (usa `git rev-parse --show-toplevel`).
|
|
1216
|
+
*/
|
|
1217
|
+
function tryResolveGitRoot(cwd) {
|
|
1218
|
+
const raw = String(cwd || "").trim();
|
|
1219
|
+
if (!raw) return null;
|
|
1220
|
+
const dir = resolve(raw);
|
|
1221
|
+
if (!existsSync(dir)) return null;
|
|
1222
|
+
try {
|
|
1223
|
+
const root = execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
1224
|
+
cwd: dir,
|
|
1225
|
+
encoding: "utf8",
|
|
1226
|
+
windowsHide: true,
|
|
1227
|
+
stdio: [
|
|
1228
|
+
"ignore",
|
|
1229
|
+
"pipe",
|
|
1230
|
+
"ignore"
|
|
1231
|
+
]
|
|
1232
|
+
}).trim();
|
|
1233
|
+
return root ? resolve(root) : null;
|
|
1234
|
+
} catch {
|
|
1235
|
+
return null;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function git(repo, args, { maxBuffer = 64 * 1024 * 1024 } = {}) {
|
|
1239
|
+
return execFileSync("git", args, {
|
|
1240
|
+
cwd: repo,
|
|
1241
|
+
encoding: "utf8",
|
|
1242
|
+
maxBuffer,
|
|
1243
|
+
windowsHide: true
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
function resolveRev(repo, ref) {
|
|
1247
|
+
return git(repo, ["rev-parse", ref]).trim();
|
|
1248
|
+
}
|
|
1249
|
+
function branchTips(repo, branch, base) {
|
|
1250
|
+
return {
|
|
1251
|
+
branchSha: resolveRev(repo, branch),
|
|
1252
|
+
baseSha: resolveRev(repo, base)
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
function commitLog(repo, mergeBase, branch, limit = 25) {
|
|
1256
|
+
try {
|
|
1257
|
+
return git(repo, [
|
|
1258
|
+
"log",
|
|
1259
|
+
"--oneline",
|
|
1260
|
+
"--no-merges",
|
|
1261
|
+
"-n",
|
|
1262
|
+
String(limit),
|
|
1263
|
+
`${mergeBase}..${branch}`
|
|
1264
|
+
]).trim().split("\n").filter(Boolean);
|
|
1265
|
+
} catch {
|
|
1266
|
+
return [];
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
var FILE_LINE_CACHE = /* @__PURE__ */ new Map();
|
|
1270
|
+
var FILE_LINE_CACHE_MAX = 48;
|
|
1271
|
+
function rememberFileLines(key, lines) {
|
|
1272
|
+
if (FILE_LINE_CACHE.has(key)) FILE_LINE_CACHE.delete(key);
|
|
1273
|
+
FILE_LINE_CACHE.set(key, lines);
|
|
1274
|
+
while (FILE_LINE_CACHE.size > FILE_LINE_CACHE_MAX) {
|
|
1275
|
+
const oldest = FILE_LINE_CACHE.keys().next().value;
|
|
1276
|
+
FILE_LINE_CACHE.delete(oldest);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
function showFileLines(repo, rev, path) {
|
|
1280
|
+
const resolved = assertGitRepo(repo);
|
|
1281
|
+
const safeRev = String(rev || "").trim();
|
|
1282
|
+
const safePath = String(path || "").replace(/\\/g, "/").trim();
|
|
1283
|
+
if (!safeRev || !/^[A-Za-z0-9._/\-]+$/.test(safeRev)) throw new Error("Rev inválido.");
|
|
1284
|
+
if (!safePath || safePath.startsWith("/") || safePath.includes("..") || safePath.includes("\0")) throw new Error("Ruta inválida.");
|
|
1285
|
+
const key = `${resolved}\0${safeRev}\0${safePath}`;
|
|
1286
|
+
if (FILE_LINE_CACHE.has(key)) return FILE_LINE_CACHE.get(key);
|
|
1287
|
+
let text;
|
|
1288
|
+
try {
|
|
1289
|
+
text = git(resolved, ["show", `${safeRev}:${safePath}`]);
|
|
1290
|
+
} catch {
|
|
1291
|
+
rememberFileLines(key, null);
|
|
1292
|
+
return null;
|
|
1293
|
+
}
|
|
1294
|
+
if (text.includes("\0")) {
|
|
1295
|
+
rememberFileLines(key, null);
|
|
1296
|
+
return null;
|
|
1297
|
+
}
|
|
1298
|
+
const raw = text.replace(/\r\n/g, "\n");
|
|
1299
|
+
const lines = raw.endsWith("\n") ? raw.slice(0, -1).split("\n") : raw.split("\n");
|
|
1300
|
+
rememberFileLines(key, lines);
|
|
1301
|
+
return lines;
|
|
1302
|
+
}
|
|
1303
|
+
function listBranches(repo) {
|
|
1304
|
+
const names = git(repo, [
|
|
1305
|
+
"for-each-ref",
|
|
1306
|
+
"--sort=-committerdate",
|
|
1307
|
+
"--format=%(refname:short)",
|
|
1308
|
+
"refs/heads",
|
|
1309
|
+
"refs/remotes"
|
|
1310
|
+
]).split("\n").map((s) => s.trim()).filter(Boolean).map((name) => name.replace(/^origin\//, "")).filter((name) => name !== "HEAD" && !name.endsWith("/HEAD"));
|
|
1311
|
+
const unique = [...new Set(names)];
|
|
1312
|
+
const current = git(repo, [
|
|
1313
|
+
"rev-parse",
|
|
1314
|
+
"--abbrev-ref",
|
|
1315
|
+
"HEAD"
|
|
1316
|
+
]).trim();
|
|
1317
|
+
const bases = unique.filter((n) => n === "develop" || n === "main" || n === "master");
|
|
1318
|
+
return {
|
|
1319
|
+
branches: unique,
|
|
1320
|
+
current,
|
|
1321
|
+
defaultBase: bases.includes("develop") ? "develop" : bases.includes("main") ? "main" : bases[0] || "develop"
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
/** URL del remote (origin, o el primero disponible). Vacío si no hay. */
|
|
1325
|
+
function getRemoteUrl(repo, preferred = "origin") {
|
|
1326
|
+
try {
|
|
1327
|
+
const url = git(repo, [
|
|
1328
|
+
"remote",
|
|
1329
|
+
"get-url",
|
|
1330
|
+
preferred
|
|
1331
|
+
]).trim();
|
|
1332
|
+
if (url) return url;
|
|
1333
|
+
} catch {}
|
|
1334
|
+
try {
|
|
1335
|
+
const remotes = git(repo, ["remote"]).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
1336
|
+
if (!remotes.length) return "";
|
|
1337
|
+
return git(repo, [
|
|
1338
|
+
"remote",
|
|
1339
|
+
"get-url",
|
|
1340
|
+
remotes[0]
|
|
1341
|
+
]).trim();
|
|
1342
|
+
} catch {
|
|
1343
|
+
return "";
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
//#endregion
|
|
1342
1347
|
//#region ../lib/extract.mjs
|
|
1343
1348
|
function extractBranchDiff({ repo, branch, base = "develop" }) {
|
|
1344
1349
|
if (!branch) throw new Error("Falta el branch a revisar.");
|
|
@@ -2772,4 +2777,4 @@ for (const [name, fn] of Object.entries(git_remote_exports)) {
|
|
|
2772
2777
|
var _sveltekit_remote_1g4ayag_default = git_remote_exports;
|
|
2773
2778
|
|
|
2774
2779
|
export { _sveltekit_remote_1g4ayag_default as default };
|
|
2775
|
-
//# sourceMappingURL=remote-1g4ayag-
|
|
2780
|
+
//# sourceMappingURL=remote-1g4ayag-B67QMR_2.js.map
|