lazyreview 1.0.49 → 1.0.52
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/dist/cli.js +209 -50
- package/package.json +6 -2
package/dist/cli.js
CHANGED
|
@@ -118675,9 +118675,17 @@ var BookmarkedRepoSchema = Schema_exports.Struct({
|
|
|
118675
118675
|
repo: Schema_exports.String
|
|
118676
118676
|
});
|
|
118677
118677
|
var AppConfig = class extends Schema_exports.Class("AppConfig")({
|
|
118678
|
-
provider: Schema_exports.optionalWith(
|
|
118679
|
-
|
|
118680
|
-
|
|
118678
|
+
provider: Schema_exports.optionalWith(
|
|
118679
|
+
Schema_exports.Union(
|
|
118680
|
+
Schema_exports.Literal("github"),
|
|
118681
|
+
Schema_exports.Literal("gitlab"),
|
|
118682
|
+
Schema_exports.Literal("bitbucket"),
|
|
118683
|
+
Schema_exports.Literal("azure"),
|
|
118684
|
+
Schema_exports.Literal("gitea")
|
|
118685
|
+
),
|
|
118686
|
+
{ default: () => "github" }
|
|
118687
|
+
),
|
|
118688
|
+
baseUrl: Schema_exports.optional(Schema_exports.String),
|
|
118681
118689
|
gitlab: Schema_exports.optional(GitLabConfigSchema),
|
|
118682
118690
|
theme: Schema_exports.optionalWith(Schema_exports.String, { default: () => "tokyo-night" }),
|
|
118683
118691
|
defaultOwner: Schema_exports.optional(Schema_exports.String),
|
|
@@ -124920,6 +124928,195 @@ function ReReviewModal({
|
|
|
124920
124928
|
import { execFile as execFile3 } from "child_process";
|
|
124921
124929
|
import { promisify as promisify2 } from "util";
|
|
124922
124930
|
var execFileAsync2 = promisify2(execFile3);
|
|
124931
|
+
function detectProvider(host) {
|
|
124932
|
+
const lower = host.toLowerCase();
|
|
124933
|
+
if (lower === "github.com") return "github";
|
|
124934
|
+
if (lower === "gitlab.com") return "gitlab";
|
|
124935
|
+
if (lower === "bitbucket.org") return "bitbucket";
|
|
124936
|
+
if (lower.includes("dev.azure.com") || lower.includes("visualstudio.com")) return "azure";
|
|
124937
|
+
if (lower.includes("ssh.dev.azure.com")) return "azure";
|
|
124938
|
+
return "unknown";
|
|
124939
|
+
}
|
|
124940
|
+
function getApiBaseUrl(provider, host) {
|
|
124941
|
+
switch (provider) {
|
|
124942
|
+
case "github":
|
|
124943
|
+
return host.toLowerCase() === "github.com" ? "https://api.github.com" : `https://${host}/api/v3`;
|
|
124944
|
+
case "gitlab":
|
|
124945
|
+
return host.toLowerCase() === "gitlab.com" ? "https://gitlab.com/api/v4" : `https://${host}/api/v4`;
|
|
124946
|
+
case "bitbucket":
|
|
124947
|
+
return "https://api.bitbucket.org/2.0";
|
|
124948
|
+
case "azure":
|
|
124949
|
+
return "https://dev.azure.com";
|
|
124950
|
+
case "gitea":
|
|
124951
|
+
return `https://${host}/api/v1`;
|
|
124952
|
+
default:
|
|
124953
|
+
return `https://${host}`;
|
|
124954
|
+
}
|
|
124955
|
+
}
|
|
124956
|
+
function parseAzureSsh(url2) {
|
|
124957
|
+
const match15 = url2.match(
|
|
124958
|
+
/git@ssh\.dev\.azure\.com:v3\/([^/]+)\/([^/]+)\/([^/.]+?)(?:\.git)?$/
|
|
124959
|
+
);
|
|
124960
|
+
if (!match15?.[1] || !match15[2] || !match15[3]) return null;
|
|
124961
|
+
return {
|
|
124962
|
+
provider: "azure",
|
|
124963
|
+
host: "dev.azure.com",
|
|
124964
|
+
owner: `${match15[1]}/${match15[2]}`,
|
|
124965
|
+
repo: match15[3],
|
|
124966
|
+
baseUrl: "https://dev.azure.com"
|
|
124967
|
+
};
|
|
124968
|
+
}
|
|
124969
|
+
function parseAzureHttps(url2) {
|
|
124970
|
+
const devMatch = url2.match(
|
|
124971
|
+
/https?:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/?#.]+?)(?:\.git)?$/
|
|
124972
|
+
);
|
|
124973
|
+
if (devMatch?.[1] && devMatch[2] && devMatch[3]) {
|
|
124974
|
+
return {
|
|
124975
|
+
provider: "azure",
|
|
124976
|
+
host: "dev.azure.com",
|
|
124977
|
+
owner: `${devMatch[1]}/${devMatch[2]}`,
|
|
124978
|
+
repo: devMatch[3],
|
|
124979
|
+
baseUrl: "https://dev.azure.com"
|
|
124980
|
+
};
|
|
124981
|
+
}
|
|
124982
|
+
const vsMatch = url2.match(
|
|
124983
|
+
/https?:\/\/([^.]+)\.visualstudio\.com\/([^/]+)\/_git\/([^/?#.]+?)(?:\.git)?$/
|
|
124984
|
+
);
|
|
124985
|
+
if (vsMatch?.[1] && vsMatch[2] && vsMatch[3]) {
|
|
124986
|
+
return {
|
|
124987
|
+
provider: "azure",
|
|
124988
|
+
host: `${vsMatch[1]}.visualstudio.com`,
|
|
124989
|
+
owner: `${vsMatch[1]}/${vsMatch[2]}`,
|
|
124990
|
+
repo: vsMatch[3],
|
|
124991
|
+
baseUrl: "https://dev.azure.com"
|
|
124992
|
+
};
|
|
124993
|
+
}
|
|
124994
|
+
return null;
|
|
124995
|
+
}
|
|
124996
|
+
function parseSshUrl(url2) {
|
|
124997
|
+
const azureResult = parseAzureSsh(url2);
|
|
124998
|
+
if (azureResult) return azureResult;
|
|
124999
|
+
const match15 = url2.match(/git@([^:]+):([^/]+)\/([^/.]+?)(?:\.git)?$/);
|
|
125000
|
+
if (!match15?.[1] || !match15[2] || !match15[3]) return null;
|
|
125001
|
+
const host = match15[1];
|
|
125002
|
+
const provider = detectProvider(host);
|
|
125003
|
+
return {
|
|
125004
|
+
provider,
|
|
125005
|
+
host,
|
|
125006
|
+
owner: match15[2],
|
|
125007
|
+
repo: match15[3],
|
|
125008
|
+
baseUrl: getApiBaseUrl(provider, host)
|
|
125009
|
+
};
|
|
125010
|
+
}
|
|
125011
|
+
function parseHttpsUrl(url2) {
|
|
125012
|
+
const azureResult = parseAzureHttps(url2);
|
|
125013
|
+
if (azureResult) return azureResult;
|
|
125014
|
+
const match15 = url2.match(
|
|
125015
|
+
/https?:\/\/([^/]+)\/([^/]+)\/([^/?#.]+?)(?:\.git)?$/
|
|
125016
|
+
);
|
|
125017
|
+
if (!match15?.[1] || !match15[2] || !match15[3]) return null;
|
|
125018
|
+
const host = match15[1];
|
|
125019
|
+
const provider = detectProvider(host);
|
|
125020
|
+
return {
|
|
125021
|
+
provider,
|
|
125022
|
+
host,
|
|
125023
|
+
owner: match15[2],
|
|
125024
|
+
repo: match15[3],
|
|
125025
|
+
baseUrl: getApiBaseUrl(provider, host)
|
|
125026
|
+
};
|
|
125027
|
+
}
|
|
125028
|
+
function parseGitRemote(url2) {
|
|
125029
|
+
if (!url2) return null;
|
|
125030
|
+
const trimmed2 = url2.trim();
|
|
125031
|
+
if (trimmed2.startsWith("git@")) {
|
|
125032
|
+
return parseSshUrl(trimmed2);
|
|
125033
|
+
}
|
|
125034
|
+
if (trimmed2.startsWith("http://") || trimmed2.startsWith("https://")) {
|
|
125035
|
+
return parseHttpsUrl(trimmed2);
|
|
125036
|
+
}
|
|
125037
|
+
return null;
|
|
125038
|
+
}
|
|
125039
|
+
function parsePRUrl(url2) {
|
|
125040
|
+
if (!url2) return null;
|
|
125041
|
+
const ghMatch = url2.match(
|
|
125042
|
+
/https?:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/
|
|
125043
|
+
);
|
|
125044
|
+
if (ghMatch?.[1] && ghMatch[2] && ghMatch[3]) {
|
|
125045
|
+
return {
|
|
125046
|
+
provider: "github",
|
|
125047
|
+
owner: ghMatch[1],
|
|
125048
|
+
repo: ghMatch[2],
|
|
125049
|
+
number: parseInt(ghMatch[3], 10)
|
|
125050
|
+
};
|
|
125051
|
+
}
|
|
125052
|
+
const glMatch = url2.match(
|
|
125053
|
+
/https?:\/\/gitlab\.com\/([^/]+)\/([^/]+)\/-\/merge_requests\/(\d+)/
|
|
125054
|
+
);
|
|
125055
|
+
if (glMatch?.[1] && glMatch[2] && glMatch[3]) {
|
|
125056
|
+
return {
|
|
125057
|
+
provider: "gitlab",
|
|
125058
|
+
owner: glMatch[1],
|
|
125059
|
+
repo: glMatch[2],
|
|
125060
|
+
number: parseInt(glMatch[3], 10)
|
|
125061
|
+
};
|
|
125062
|
+
}
|
|
125063
|
+
const bbMatch = url2.match(
|
|
125064
|
+
/https?:\/\/bitbucket\.org\/([^/]+)\/([^/]+)\/pull-requests\/(\d+)/
|
|
125065
|
+
);
|
|
125066
|
+
if (bbMatch?.[1] && bbMatch[2] && bbMatch[3]) {
|
|
125067
|
+
return {
|
|
125068
|
+
provider: "bitbucket",
|
|
125069
|
+
owner: bbMatch[1],
|
|
125070
|
+
repo: bbMatch[2],
|
|
125071
|
+
number: parseInt(bbMatch[3], 10)
|
|
125072
|
+
};
|
|
125073
|
+
}
|
|
125074
|
+
const azMatch = url2.match(
|
|
125075
|
+
/https?:\/\/dev\.azure\.com\/([^/]+)\/([^/]+)\/_git\/([^/]+)\/pullrequest\/(\d+)/
|
|
125076
|
+
);
|
|
125077
|
+
if (azMatch?.[1] && azMatch[2] && azMatch[3] && azMatch[4]) {
|
|
125078
|
+
return {
|
|
125079
|
+
provider: "azure",
|
|
125080
|
+
owner: `${azMatch[1]}/${azMatch[2]}`,
|
|
125081
|
+
repo: azMatch[3],
|
|
125082
|
+
number: parseInt(azMatch[4], 10)
|
|
125083
|
+
};
|
|
125084
|
+
}
|
|
125085
|
+
return null;
|
|
125086
|
+
}
|
|
125087
|
+
function parseGitHubPRUrl(url2) {
|
|
125088
|
+
if (!url2) return null;
|
|
125089
|
+
const prResult = parsePRUrl(url2);
|
|
125090
|
+
if (prResult && prResult.provider === "github") {
|
|
125091
|
+
return {
|
|
125092
|
+
owner: prResult.owner,
|
|
125093
|
+
repo: prResult.repo,
|
|
125094
|
+
number: prResult.number
|
|
125095
|
+
};
|
|
125096
|
+
}
|
|
125097
|
+
const repoMatch = url2.match(
|
|
125098
|
+
/https?:\/\/github\.com\/([^/]+)\/([^/?#]+)/
|
|
125099
|
+
);
|
|
125100
|
+
if (repoMatch?.[1] && repoMatch[2]) {
|
|
125101
|
+
return {
|
|
125102
|
+
owner: repoMatch[1],
|
|
125103
|
+
repo: repoMatch[2]
|
|
125104
|
+
};
|
|
125105
|
+
}
|
|
125106
|
+
return null;
|
|
125107
|
+
}
|
|
125108
|
+
function extractRepoFromPRUrl(url2) {
|
|
125109
|
+
if (!url2) return null;
|
|
125110
|
+
const parsed = parsePRUrl(url2);
|
|
125111
|
+
if (parsed) {
|
|
125112
|
+
return `${parsed.owner}/${parsed.repo}`;
|
|
125113
|
+
}
|
|
125114
|
+
const match15 = url2.match(
|
|
125115
|
+
/https?:\/\/github\.com\/([^/]+)\/([^/]+)\/pull/
|
|
125116
|
+
);
|
|
125117
|
+
if (!match15?.[1] || !match15[2]) return null;
|
|
125118
|
+
return `${match15[1]}/${match15[2]}`;
|
|
125119
|
+
}
|
|
124923
125120
|
async function detectGitRepo() {
|
|
124924
125121
|
try {
|
|
124925
125122
|
await execFileAsync2("git", ["rev-parse", "--git-dir"]);
|
|
@@ -124929,19 +125126,25 @@ async function detectGitRepo() {
|
|
|
124929
125126
|
"origin"
|
|
124930
125127
|
]);
|
|
124931
125128
|
const remoteUrl = stdout.trim();
|
|
124932
|
-
const parsed =
|
|
125129
|
+
const parsed = parseGitRemote(remoteUrl);
|
|
124933
125130
|
return {
|
|
124934
125131
|
isGitRepo: true,
|
|
124935
125132
|
owner: parsed?.owner ?? null,
|
|
124936
125133
|
repo: parsed?.repo ?? null,
|
|
124937
|
-
remoteUrl
|
|
125134
|
+
remoteUrl,
|
|
125135
|
+
provider: parsed?.provider ?? null,
|
|
125136
|
+
host: parsed?.host ?? null,
|
|
125137
|
+
baseUrl: parsed?.baseUrl ?? null
|
|
124938
125138
|
};
|
|
124939
125139
|
} catch {
|
|
124940
125140
|
return {
|
|
124941
125141
|
isGitRepo: false,
|
|
124942
125142
|
owner: null,
|
|
124943
125143
|
repo: null,
|
|
124944
|
-
remoteUrl: null
|
|
125144
|
+
remoteUrl: null,
|
|
125145
|
+
provider: null,
|
|
125146
|
+
host: null,
|
|
125147
|
+
baseUrl: null
|
|
124945
125148
|
};
|
|
124946
125149
|
}
|
|
124947
125150
|
}
|
|
@@ -125008,50 +125211,6 @@ async function checkoutPR(prNumber) {
|
|
|
125008
125211
|
};
|
|
125009
125212
|
}
|
|
125010
125213
|
}
|
|
125011
|
-
function parseGitHubUrl(url2) {
|
|
125012
|
-
const sshMatch = url2.match(/git@github\.com:([^/]+)\/([^/.]+)(?:\.git)?/);
|
|
125013
|
-
if (sshMatch) {
|
|
125014
|
-
return { owner: sshMatch[1], repo: sshMatch[2] };
|
|
125015
|
-
}
|
|
125016
|
-
const httpsMatch = url2.match(
|
|
125017
|
-
/https?:\/\/github\.com\/([^/]+)\/([^/.]+)(?:\.git)?/
|
|
125018
|
-
);
|
|
125019
|
-
if (httpsMatch) {
|
|
125020
|
-
return { owner: httpsMatch[1], repo: httpsMatch[2] };
|
|
125021
|
-
}
|
|
125022
|
-
return null;
|
|
125023
|
-
}
|
|
125024
|
-
function parseGitHubPRUrl(url2) {
|
|
125025
|
-
if (!url2) return null;
|
|
125026
|
-
const prMatch = url2.match(
|
|
125027
|
-
/https?:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)/
|
|
125028
|
-
);
|
|
125029
|
-
if (prMatch?.[1] && prMatch[2] && prMatch[3]) {
|
|
125030
|
-
return {
|
|
125031
|
-
owner: prMatch[1],
|
|
125032
|
-
repo: prMatch[2],
|
|
125033
|
-
number: parseInt(prMatch[3], 10)
|
|
125034
|
-
};
|
|
125035
|
-
}
|
|
125036
|
-
const repoMatch = url2.match(
|
|
125037
|
-
/https?:\/\/github\.com\/([^/]+)\/([^/?#]+)/
|
|
125038
|
-
);
|
|
125039
|
-
if (repoMatch?.[1] && repoMatch[2]) {
|
|
125040
|
-
return {
|
|
125041
|
-
owner: repoMatch[1],
|
|
125042
|
-
repo: repoMatch[2]
|
|
125043
|
-
};
|
|
125044
|
-
}
|
|
125045
|
-
return null;
|
|
125046
|
-
}
|
|
125047
|
-
function extractRepoFromPRUrl(url2) {
|
|
125048
|
-
if (!url2) return null;
|
|
125049
|
-
const match15 = url2.match(
|
|
125050
|
-
/https?:\/\/github\.com\/([^/]+)\/([^/]+)\/pull/
|
|
125051
|
-
);
|
|
125052
|
-
if (!match15?.[1] || !match15[2]) return null;
|
|
125053
|
-
return `${match15[1]}/${match15[2]}`;
|
|
125054
|
-
}
|
|
125055
125214
|
|
|
125056
125215
|
// src/hooks/useReadState.ts
|
|
125057
125216
|
var import_react89 = __toESM(require_react(), 1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lazyreview",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.52",
|
|
4
4
|
"description": "A TUI code review tool for GitHub PRs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Tauan Camargo",
|
|
@@ -33,7 +33,11 @@
|
|
|
33
33
|
"test:watch": "vitest",
|
|
34
34
|
"test:coverage": "vitest run --coverage",
|
|
35
35
|
"lint": "prettier --check 'src/**/*.{ts,tsx}'",
|
|
36
|
-
"format": "prettier --write 'src/**/*.{ts,tsx}'"
|
|
36
|
+
"format": "prettier --write 'src/**/*.{ts,tsx}'",
|
|
37
|
+
"release": "./scripts/release.sh",
|
|
38
|
+
"release:patch": "./scripts/release.sh patch",
|
|
39
|
+
"release:minor": "./scripts/release.sh minor",
|
|
40
|
+
"release:major": "./scripts/release.sh major"
|
|
37
41
|
},
|
|
38
42
|
"devDependencies": {
|
|
39
43
|
"@effect/platform": "^0.77.0",
|