@ondrej-svec/hog 1.1.1 → 1.1.3
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 +49 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4011,19 +4011,60 @@ function getGitHubLogin() {
|
|
|
4011
4011
|
const user = ghJson(["api", "user"]);
|
|
4012
4012
|
return user.login;
|
|
4013
4013
|
}
|
|
4014
|
-
function
|
|
4015
|
-
|
|
4014
|
+
function listUserOrgs() {
|
|
4015
|
+
try {
|
|
4016
|
+
const orgs = ghJson(["api", "user/orgs"]);
|
|
4017
|
+
return orgs.map((o) => o.login);
|
|
4018
|
+
} catch {
|
|
4019
|
+
return [];
|
|
4020
|
+
}
|
|
4021
|
+
}
|
|
4022
|
+
function listReposForOwner(owner) {
|
|
4023
|
+
const args = [
|
|
4024
|
+
"repo",
|
|
4025
|
+
"list",
|
|
4026
|
+
...owner ? [owner] : [],
|
|
4027
|
+
"--json",
|
|
4028
|
+
"nameWithOwner,name,owner",
|
|
4029
|
+
"--limit",
|
|
4030
|
+
"100"
|
|
4031
|
+
];
|
|
4032
|
+
try {
|
|
4033
|
+
return ghJson(args);
|
|
4034
|
+
} catch {
|
|
4035
|
+
return [];
|
|
4036
|
+
}
|
|
4037
|
+
}
|
|
4038
|
+
function listAllRepos() {
|
|
4039
|
+
const orgs = listUserOrgs();
|
|
4040
|
+
const personal = listReposForOwner();
|
|
4041
|
+
const orgRepos = orgs.flatMap((org) => listReposForOwner(org));
|
|
4042
|
+
const all = [...personal, ...orgRepos];
|
|
4043
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4044
|
+
return all.filter((r) => {
|
|
4045
|
+
if (seen.has(r.nameWithOwner)) return false;
|
|
4046
|
+
seen.add(r.nameWithOwner);
|
|
4047
|
+
return true;
|
|
4048
|
+
});
|
|
4016
4049
|
}
|
|
4017
4050
|
function listOrgProjects(owner) {
|
|
4018
4051
|
try {
|
|
4019
|
-
|
|
4052
|
+
const result = ghJson([
|
|
4053
|
+
"project",
|
|
4054
|
+
"list",
|
|
4055
|
+
"--owner",
|
|
4056
|
+
owner,
|
|
4057
|
+
"--format",
|
|
4058
|
+
"json"
|
|
4059
|
+
]);
|
|
4060
|
+
return result.projects ?? [];
|
|
4020
4061
|
} catch {
|
|
4021
4062
|
return [];
|
|
4022
4063
|
}
|
|
4023
4064
|
}
|
|
4024
4065
|
function listProjectFields(owner, projectNumber) {
|
|
4025
4066
|
try {
|
|
4026
|
-
|
|
4067
|
+
const result = ghJson([
|
|
4027
4068
|
"project",
|
|
4028
4069
|
"field-list",
|
|
4029
4070
|
String(projectNumber),
|
|
@@ -4032,6 +4073,7 @@ function listProjectFields(owner, projectNumber) {
|
|
|
4032
4073
|
"--format",
|
|
4033
4074
|
"json"
|
|
4034
4075
|
]);
|
|
4076
|
+
return result.fields ?? [];
|
|
4035
4077
|
} catch {
|
|
4036
4078
|
return [];
|
|
4037
4079
|
}
|
|
@@ -4078,7 +4120,8 @@ async function runWizard(opts) {
|
|
|
4078
4120
|
const login = getGitHubLogin();
|
|
4079
4121
|
console.log(` Detected GitHub user: ${login}
|
|
4080
4122
|
`);
|
|
4081
|
-
|
|
4123
|
+
console.log("Fetching repositories...");
|
|
4124
|
+
const allRepos = listAllRepos();
|
|
4082
4125
|
if (allRepos.length === 0) {
|
|
4083
4126
|
console.error("No repositories found. Check your GitHub CLI access.");
|
|
4084
4127
|
process.exit(1);
|
|
@@ -4631,7 +4674,7 @@ function resolveProjectId(projectId) {
|
|
|
4631
4674
|
process.exit(1);
|
|
4632
4675
|
}
|
|
4633
4676
|
var program = new Command();
|
|
4634
|
-
program.name("hog").description("Personal command deck \u2014 unified task dashboard for GitHub Projects + TickTick").version("1.1.
|
|
4677
|
+
program.name("hog").description("Personal command deck \u2014 unified task dashboard for GitHub Projects + TickTick").version("1.1.3").option("--json", "Force JSON output").option("--human", "Force human-readable output").hook("preAction", (thisCommand) => {
|
|
4635
4678
|
const opts = thisCommand.opts();
|
|
4636
4679
|
if (opts.json) setFormat("json");
|
|
4637
4680
|
if (opts.human) setFormat("human");
|