@theholocron/cli 5.0.0-alpha.439 → 5.0.0-alpha.440
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 +9 -1
- package/dist/cli.mjs +202 -111
- package/dist/cli.mjs.map +1 -1
- package/package.json +10 -10
package/dist/cli.mjs
CHANGED
|
@@ -1070,6 +1070,12 @@ const registry = createCommandRegistry([
|
|
|
1070
1070
|
supportsDryRun: true
|
|
1071
1071
|
},
|
|
1072
1072
|
ideasSyncEntry,
|
|
1073
|
+
{
|
|
1074
|
+
name: "sync tooling",
|
|
1075
|
+
description: "Sync each tooling provider (collections, environments, specs) without running the rest of setup",
|
|
1076
|
+
positionals: [],
|
|
1077
|
+
supportsDryRun: true
|
|
1078
|
+
},
|
|
1073
1079
|
ideasPromoteEntry,
|
|
1074
1080
|
issueCreateEntry,
|
|
1075
1081
|
{
|
|
@@ -2373,6 +2379,7 @@ const COMMAND_CONTEXTS = {
|
|
|
2373
2379
|
"sync github": "workspace",
|
|
2374
2380
|
"sync issues": "workspace",
|
|
2375
2381
|
"sync ideas": "workspace",
|
|
2382
|
+
"sync tooling": "workspace",
|
|
2376
2383
|
"new spec": "workspace",
|
|
2377
2384
|
"new issue": "workspace"
|
|
2378
2385
|
};
|
|
@@ -6816,7 +6823,7 @@ async function runDoctorDns(input) {
|
|
|
6816
6823
|
});
|
|
6817
6824
|
else if (!loader.has("dns")) {
|
|
6818
6825
|
const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
|
|
6819
|
-
for (const zone of zones) rows.push(row$
|
|
6826
|
+
for (const zone of zones) rows.push(row$14(zone, "skip", why));
|
|
6820
6827
|
for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
|
|
6821
6828
|
} else {
|
|
6822
6829
|
const dns = loader.get("dns");
|
|
@@ -6838,7 +6845,7 @@ async function runDoctorDns(input) {
|
|
|
6838
6845
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
6839
6846
|
};
|
|
6840
6847
|
}
|
|
6841
|
-
function row$
|
|
6848
|
+
function row$14(zone, status, detail, problems = []) {
|
|
6842
6849
|
return {
|
|
6843
6850
|
id: `dns-${zone}`,
|
|
6844
6851
|
title: `${zone} records exist`,
|
|
@@ -6867,7 +6874,7 @@ async function checkDomain(dns, deploy, project, hostname) {
|
|
|
6867
6874
|
return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
|
|
6868
6875
|
}
|
|
6869
6876
|
}
|
|
6870
|
-
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$
|
|
6877
|
+
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$14(zone, ...args)) {
|
|
6871
6878
|
try {
|
|
6872
6879
|
const have = await dns.listRecords(zone);
|
|
6873
6880
|
const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
|
|
@@ -7002,7 +7009,7 @@ function installationSettingsUrl(account, id) {
|
|
|
7002
7009
|
return `https://github.com/settings/installations/${id}`;
|
|
7003
7010
|
}
|
|
7004
7011
|
// src/commands/doctor-github-app/app-rows.ts
|
|
7005
|
-
const row$
|
|
7012
|
+
const row$13 = (name, what, problems, ok) => ({
|
|
7006
7013
|
id: `${name}:${what}`,
|
|
7007
7014
|
title: `${name}: ${what}`,
|
|
7008
7015
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -7029,9 +7036,9 @@ function appRows(name, manifest, app, installations) {
|
|
|
7029
7036
|
return [`${who} has not accepted the current App: ${gaps.join("; ")}`, `fix: ${who} accepts the update at ${url}`];
|
|
7030
7037
|
});
|
|
7031
7038
|
return [
|
|
7032
|
-
row$
|
|
7033
|
-
row$
|
|
7034
|
-
row$
|
|
7039
|
+
row$13(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
|
|
7040
|
+
row$13(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
|
|
7041
|
+
row$13(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
|
|
7035
7042
|
];
|
|
7036
7043
|
}
|
|
7037
7044
|
// src/commands/doctor-github-app/parse-manifest.ts
|
|
@@ -7089,7 +7096,7 @@ async function runDoctorGitHubApp(input) {
|
|
|
7089
7096
|
assertPluginsResolvable$1(loader, "doctor github-app");
|
|
7090
7097
|
}
|
|
7091
7098
|
const rows = [];
|
|
7092
|
-
if (instances.length === 0) rows.push(row$
|
|
7099
|
+
if (instances.length === 0) rows.push(row$12("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
|
|
7093
7100
|
for (const instance of instances) rows.push(...await checkInstance(instance, loader, input));
|
|
7094
7101
|
printCheckRows(rows, print);
|
|
7095
7102
|
const summary = summariseChecks(rows);
|
|
@@ -7106,7 +7113,7 @@ async function runDoctorGitHubApp(input) {
|
|
|
7106
7113
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
7107
7114
|
};
|
|
7108
7115
|
}
|
|
7109
|
-
function row$
|
|
7116
|
+
function row$12(name, what, status, detail) {
|
|
7110
7117
|
return {
|
|
7111
7118
|
id: `${name}:${what}`,
|
|
7112
7119
|
title: `${name}: ${what}`,
|
|
@@ -7147,19 +7154,19 @@ async function checkInstance(instance, loader, input) {
|
|
|
7147
7154
|
try {
|
|
7148
7155
|
manifest = parseManifest(readManifest(instance.manifest));
|
|
7149
7156
|
} catch (err) {
|
|
7150
|
-
return [row$
|
|
7157
|
+
return [row$12(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
|
|
7151
7158
|
}
|
|
7152
7159
|
const read = await readCredentials(instance, loader);
|
|
7153
|
-
if ("reason" in read) return [row$
|
|
7160
|
+
if ("reason" in read) return [row$12(name, "reachable", "skip", read.reason)];
|
|
7154
7161
|
const api = input.api ?? defaultApi;
|
|
7155
7162
|
const secrets = [read.creds.privateKey];
|
|
7156
7163
|
try {
|
|
7157
7164
|
const app = await api.getApp(read.creds);
|
|
7158
7165
|
const installations = await api.listAppInstallations(read.creds);
|
|
7159
7166
|
const owner = app.owner ? `, owned by ${app.owner.login}` : "";
|
|
7160
|
-
return [row$
|
|
7167
|
+
return [row$12(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`), ...appRows(name, manifest, app, installations)];
|
|
7161
7168
|
} catch (err) {
|
|
7162
|
-
return [row$
|
|
7169
|
+
return [row$12(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
|
|
7163
7170
|
}
|
|
7164
7171
|
}
|
|
7165
7172
|
// src/commands/doctor-github-app/doctor-github-app.command.ts
|
|
@@ -7226,7 +7233,7 @@ function datasetTargets(config) {
|
|
|
7226
7233
|
* dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
|
|
7227
7234
|
* a name, a token or a response that cannot be read is a skip with the reason.
|
|
7228
7235
|
*/
|
|
7229
|
-
const row$
|
|
7236
|
+
const row$11 = (id, title, status, detail, problems = []) => ({
|
|
7230
7237
|
id,
|
|
7231
7238
|
title,
|
|
7232
7239
|
status,
|
|
@@ -7243,7 +7250,7 @@ async function runDoctorLogs(input) {
|
|
|
7243
7250
|
if (!loader.has("logs")) {
|
|
7244
7251
|
const failure = loader.loadFailures().find((f) => f.key === "logs");
|
|
7245
7252
|
const why = failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `logs` provider is configured in holocron.config.ts";
|
|
7246
|
-
rows.push(row$
|
|
7253
|
+
rows.push(row$11("logs", "logs", "skip", why));
|
|
7247
7254
|
} else rows.push(...await checkLogs(loader.get("logs"), datasetTargets(input.loaded.resolved)));
|
|
7248
7255
|
printCheckRows(rows, print);
|
|
7249
7256
|
const summary = summariseChecks(rows);
|
|
@@ -7267,38 +7274,38 @@ async function checkLogs(logs, targets) {
|
|
|
7267
7274
|
for (const target of targets) {
|
|
7268
7275
|
const id = `logs:dataset:${target.id}`;
|
|
7269
7276
|
const title = `dataset for ${target.label}`;
|
|
7270
|
-
if (!target.name) rows.push(row$
|
|
7271
|
-
else if (!token.usable) rows.push(row$
|
|
7272
|
-
else if (!logs.readDataset) rows.push(row$
|
|
7277
|
+
if (!target.name) rows.push(row$11(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
|
|
7278
|
+
else if (!token.usable) rows.push(row$11(id, title, "skip", `${target.name}: not checked, the token is not usable`));
|
|
7279
|
+
else if (!logs.readDataset) rows.push(row$11(id, title, "skip", `${logs.providerName} cannot read a dataset`));
|
|
7273
7280
|
else rows.push(...await checkDataset(logs, target, target.name, id, title));
|
|
7274
7281
|
}
|
|
7275
7282
|
const org = resolveValue$2(["AXIOM_ORG"], void 0, { prefix: PREFIX });
|
|
7276
|
-
rows.push(org ? row$
|
|
7283
|
+
rows.push(org ? row$11("logs:org", "organization", "ok", `${PREFIX}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$11("logs:org", "organization", "skip", `${PREFIX}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links and check-dispatched need it`));
|
|
7277
7284
|
return rows;
|
|
7278
7285
|
}
|
|
7279
7286
|
/** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
|
|
7280
7287
|
async function checkToken$1(logs) {
|
|
7281
7288
|
const title = "token is accepted";
|
|
7282
7289
|
if (!logs.checkToken) return {
|
|
7283
|
-
row: row$
|
|
7290
|
+
row: row$11("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
|
|
7284
7291
|
usable: true
|
|
7285
7292
|
};
|
|
7286
7293
|
try {
|
|
7287
7294
|
const result = await logs.checkToken();
|
|
7288
7295
|
if (result.ok) return {
|
|
7289
|
-
row: row$
|
|
7296
|
+
row: row$11("logs:token", title, "ok", `${logs.providerName} accepts the token`),
|
|
7290
7297
|
usable: true
|
|
7291
7298
|
};
|
|
7292
7299
|
const reason = result.reason ?? `${logs.providerName} refused the token`;
|
|
7293
7300
|
return {
|
|
7294
|
-
row: row$
|
|
7301
|
+
row: row$11("logs:token", title, "fail", reason, [reason]),
|
|
7295
7302
|
usable: false
|
|
7296
7303
|
};
|
|
7297
7304
|
} catch (err) {
|
|
7298
7305
|
const noToken = missingTokenReason(err);
|
|
7299
7306
|
const detail = noToken ?? `could not check the token: ${describeError(err)}`;
|
|
7300
7307
|
return {
|
|
7301
|
-
row: row$
|
|
7308
|
+
row: row$11("logs:token", title, "skip", detail),
|
|
7302
7309
|
usable: noToken === void 0
|
|
7303
7310
|
};
|
|
7304
7311
|
}
|
|
@@ -7308,13 +7315,13 @@ async function checkDataset(logs, target, name, id, title) {
|
|
|
7308
7315
|
const found = await logs.readDataset(name);
|
|
7309
7316
|
if (!found.exists) {
|
|
7310
7317
|
const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
|
|
7311
|
-
return [row$
|
|
7318
|
+
return [row$11(id, title, "fail", `${name} does not exist`, [problem])];
|
|
7312
7319
|
}
|
|
7313
7320
|
const retention = found.retentionDays === void 0 ? `retention: ${logs.providerName} did not report one for ${name}` : `retention: ${found.retentionDays} days for ${name}`;
|
|
7314
|
-
return [row$
|
|
7321
|
+
return [row$11(id, title, "ok", `${name} exists`), row$11(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
|
|
7315
7322
|
} catch (err) {
|
|
7316
7323
|
const detail = missingTokenReason(err) ?? `could not read ${name}: ${describeError(err)}`;
|
|
7317
|
-
return [row$
|
|
7324
|
+
return [row$11(id, title, "skip", detail)];
|
|
7318
7325
|
}
|
|
7319
7326
|
}
|
|
7320
7327
|
// src/commands/doctor-logs/doctor-logs.command.ts
|
|
@@ -10256,7 +10263,7 @@ const info = (id, title, noun, extras) => ({
|
|
|
10256
10263
|
detail: `info: ${extras.length} ${noun} not in the template (never deleted)`,
|
|
10257
10264
|
problems: extras
|
|
10258
10265
|
});
|
|
10259
|
-
const row$
|
|
10266
|
+
const row$10 = (id, title, problems, ok) => ({
|
|
10260
10267
|
id,
|
|
10261
10268
|
title,
|
|
10262
10269
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -10292,19 +10299,19 @@ function viewProblems(want, found) {
|
|
|
10292
10299
|
function boardRows(boardName, template, state) {
|
|
10293
10300
|
const id = `project:${boardName}`;
|
|
10294
10301
|
const rows = [];
|
|
10295
|
-
rows.push(row$
|
|
10302
|
+
rows.push(row$10(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
|
|
10296
10303
|
const extraStatuses = state.statuses.filter((s) => !template.statuses.some((t) => t.name === s));
|
|
10297
10304
|
if (extraStatuses.length > 0) rows.push(info(`${id}:extra-statuses`, `${boardName}: extra statuses`, "status(es)", extraStatuses));
|
|
10298
|
-
for (const want of template.fields) rows.push(row$
|
|
10305
|
+
for (const want of template.fields) rows.push(row$10(`${id}:field:${want.name}`, `${boardName}: field ${want.name}`, fieldProblems(want, state.fields.find((f) => f.name === want.name)), want.options ? `${want.options.length} options in order` : want.type));
|
|
10299
10306
|
const extraFields = state.fields.filter((f) => !template.fields.some((t) => t.name === f.name));
|
|
10300
10307
|
if (extraFields.length > 0) rows.push(info(`${id}:extra-fields`, `${boardName}: extra fields`, "field(s)", extraFields.map((f) => f.name)));
|
|
10301
|
-
for (const want of template.views) rows.push(row$
|
|
10308
|
+
for (const want of template.views) rows.push(row$10(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
|
|
10302
10309
|
const extraViews = state.views.filter((v) => !template.views.some((t) => t.name === v.name));
|
|
10303
10310
|
if (extraViews.length > 0) rows.push(info(`${id}:extra-views`, `${boardName}: extra views`, "view(s)", extraViews.map((v) => v.name)));
|
|
10304
10311
|
for (const name of template.rules ?? []) {
|
|
10305
10312
|
const found = state.rules.find((r) => r.name === name);
|
|
10306
10313
|
const problems = !found ? [`missing rule ${name}`] : found.enabled ? [] : [`rule ${name} is off`];
|
|
10307
|
-
rows.push(row$
|
|
10314
|
+
rows.push(row$10(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
|
|
10308
10315
|
}
|
|
10309
10316
|
return rows;
|
|
10310
10317
|
}
|
|
@@ -10364,7 +10371,7 @@ function itemRows(boardName, items) {
|
|
|
10364
10371
|
* never fail the run. A template file that does not read is a failure naming the file. `--post [channel]` shares the
|
|
10365
10372
|
* failing rows through the `notifications` provider's bot, like `doctor notifications --post`.
|
|
10366
10373
|
*/
|
|
10367
|
-
const row$
|
|
10374
|
+
const row$9 = (id, title, status, detail, problems = []) => ({
|
|
10368
10375
|
id,
|
|
10369
10376
|
title,
|
|
10370
10377
|
status,
|
|
@@ -10418,14 +10425,14 @@ async function checkBoards(input, loader) {
|
|
|
10418
10425
|
loader,
|
|
10419
10426
|
...input.io ? { io: input.io } : {}
|
|
10420
10427
|
});
|
|
10421
|
-
if (!opened.ok) return [row$
|
|
10428
|
+
if (!opened.ok) return [row$9("project", "project", opened.kind, opened.reason, opened.problems)];
|
|
10422
10429
|
const { projects, owner, boards, templates, templateProblems } = opened.context;
|
|
10423
10430
|
const rows = templateProblems.map((problem) => {
|
|
10424
10431
|
/* v8 ignore next -- split always returns at least one element; the fallback only satisfies noUncheckedIndexedAccess */
|
|
10425
10432
|
const file = problem.split(": ")[0] ?? problem;
|
|
10426
|
-
return row$
|
|
10433
|
+
return row$9(`project:template:${file}`, `template file ${file}`, "fail", problem);
|
|
10427
10434
|
});
|
|
10428
|
-
if (boards.length === 0) return [...rows, row$
|
|
10435
|
+
if (boards.length === 0) return [...rows, row$9("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
|
|
10429
10436
|
for (const declared of boards) {
|
|
10430
10437
|
const template = templates[declared.template];
|
|
10431
10438
|
const title = `${declared.name}: board exists and is open`;
|
|
@@ -10433,18 +10440,18 @@ async function checkBoards(input, loader) {
|
|
|
10433
10440
|
const board = await projects.find(owner, declared.name);
|
|
10434
10441
|
if (!board) {
|
|
10435
10442
|
const closed = (await projects.list(owner)).some((b) => b.name === declared.name && b.closed);
|
|
10436
|
-
rows.push(row$
|
|
10443
|
+
rows.push(row$9(`project:${declared.name}`, title, "fail", closed ? "the board is closed" : "no open board has this name", [closed ? "reopen it, or run `holocron setup project` to make a new one" : "run `holocron setup project`"]));
|
|
10437
10444
|
continue;
|
|
10438
10445
|
}
|
|
10439
|
-
rows.push(row$
|
|
10446
|
+
rows.push(row$9(`project:${declared.name}`, title, "ok", board.url));
|
|
10440
10447
|
if (!template) {
|
|
10441
|
-
rows.push(row$
|
|
10448
|
+
rows.push(row$9(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
|
|
10442
10449
|
continue;
|
|
10443
10450
|
}
|
|
10444
10451
|
rows.push(...boardRows(declared.name, template, await projects.read(owner, board)));
|
|
10445
|
-
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$
|
|
10452
|
+
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$9(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
|
|
10446
10453
|
} catch (err) {
|
|
10447
|
-
rows.push(row$
|
|
10454
|
+
rows.push(row$9(`project:${declared.name}`, title, "fail", describeError(err)));
|
|
10448
10455
|
}
|
|
10449
10456
|
}
|
|
10450
10457
|
return rows;
|
|
@@ -11118,19 +11125,19 @@ async function runDoctorRepo(input) {
|
|
|
11118
11125
|
const rows = [];
|
|
11119
11126
|
if (!loader.has("source")) {
|
|
11120
11127
|
const why = whyMissing(loader, "source", "no `source` provider to read the repository with");
|
|
11121
|
-
for (const check of checks) rows.push(row$
|
|
11128
|
+
for (const check of checks) rows.push(row$8(check, { skip: why }));
|
|
11122
11129
|
} else {
|
|
11123
11130
|
const source = loader.get("source");
|
|
11124
11131
|
for (const check of checks) {
|
|
11125
11132
|
if (typeof source[check.needs] !== "function") {
|
|
11126
|
-
rows.push(row$
|
|
11133
|
+
rows.push(row$8(check, { skip: `provider does not implement ${check.needs}` }));
|
|
11127
11134
|
continue;
|
|
11128
11135
|
}
|
|
11129
11136
|
try {
|
|
11130
|
-
rows.push(row$
|
|
11137
|
+
rows.push(row$8(check, await check.run(source)));
|
|
11131
11138
|
} catch (err) {
|
|
11132
11139
|
const noToken = missingTokenReason(err);
|
|
11133
|
-
if (noToken !== void 0) rows.push(row$
|
|
11140
|
+
if (noToken !== void 0) rows.push(row$8(check, { skip: noToken }));
|
|
11134
11141
|
else rows.push({
|
|
11135
11142
|
id: check.id,
|
|
11136
11143
|
title: check.title,
|
|
@@ -11156,7 +11163,7 @@ async function runDoctorRepo(input) {
|
|
|
11156
11163
|
...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
|
|
11157
11164
|
};
|
|
11158
11165
|
}
|
|
11159
|
-
function row$
|
|
11166
|
+
function row$8(check, result) {
|
|
11160
11167
|
const { id, title } = check;
|
|
11161
11168
|
if ("skip" in result) return {
|
|
11162
11169
|
id,
|
|
@@ -11679,7 +11686,7 @@ function providerGroup(providerName) {
|
|
|
11679
11686
|
}
|
|
11680
11687
|
// src/commands/doctor-secrets/credentials-rows.ts
|
|
11681
11688
|
/** A row for the provider as a whole, or for one of its variables when `name` is given. */
|
|
11682
|
-
function row$
|
|
11689
|
+
function row$7(provider, status, detail, name) {
|
|
11683
11690
|
return name === void 0 ? {
|
|
11684
11691
|
id: provider,
|
|
11685
11692
|
title: provider,
|
|
@@ -11704,10 +11711,10 @@ async function credentialsRows(input) {
|
|
|
11704
11711
|
const { loader } = input;
|
|
11705
11712
|
const { resolved } = input.loaded;
|
|
11706
11713
|
if (!resolved.providers.credentials) return {
|
|
11707
|
-
rows: input.asked ? [row$
|
|
11714
|
+
rows: input.asked ? [row$7("credentials", "skip", "no `credentials` provider is configured")] : [],
|
|
11708
11715
|
places: []
|
|
11709
11716
|
};
|
|
11710
|
-
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$
|
|
11717
|
+
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$7(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
|
|
11711
11718
|
const places = [];
|
|
11712
11719
|
if (!loader.has("credentials")) return {
|
|
11713
11720
|
rows,
|
|
@@ -11719,7 +11726,7 @@ async function credentialsRows(input) {
|
|
|
11719
11726
|
const tuple = tuples.find((t) => t.provider === impl.providerName);
|
|
11720
11727
|
const explicit = tuple && credentialsEnvironment(tuple, resolved);
|
|
11721
11728
|
if (!explicit && !derivesEnvironment(impl.providerName)) {
|
|
11722
|
-
rows.push(row$
|
|
11729
|
+
rows.push(row$7(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
|
|
11723
11730
|
continue;
|
|
11724
11731
|
}
|
|
11725
11732
|
try {
|
|
@@ -11731,7 +11738,7 @@ async function credentialsRows(input) {
|
|
|
11731
11738
|
rows.push(...checked.rows);
|
|
11732
11739
|
places.push(...checked.places);
|
|
11733
11740
|
} catch (err) {
|
|
11734
|
-
rows.push(row$
|
|
11741
|
+
rows.push(row$7(impl.providerName, "fail", errorMessage(err)));
|
|
11735
11742
|
}
|
|
11736
11743
|
}
|
|
11737
11744
|
return {
|
|
@@ -11747,17 +11754,17 @@ async function credentialsRows(input) {
|
|
|
11747
11754
|
async function checkProvider(impl, candidates, expected, synced) {
|
|
11748
11755
|
const provider = impl.providerName;
|
|
11749
11756
|
if (!impl.inspect) return {
|
|
11750
|
-
rows: [row$
|
|
11757
|
+
rows: [row$7(provider, "skip", "cannot list the variables without reading their values")],
|
|
11751
11758
|
places: []
|
|
11752
11759
|
};
|
|
11753
11760
|
if (expected.length === 0) return {
|
|
11754
|
-
rows: [row$
|
|
11761
|
+
rows: [row$7(provider, "skip", "no configured plugin lists the tokens it takes")],
|
|
11755
11762
|
places: []
|
|
11756
11763
|
};
|
|
11757
11764
|
const inspect = impl.inspect.bind(impl);
|
|
11758
11765
|
try {
|
|
11759
11766
|
const { found, missing } = await tryEnvironments(candidates, inspect);
|
|
11760
|
-
const rows = missing.map((name) => row$
|
|
11767
|
+
const rows = missing.map((name) => row$7(provider, "fail", `${provider} has no Environment named "${name}"`));
|
|
11761
11768
|
const group = providerGroup(provider);
|
|
11762
11769
|
const unreadPlaces = missing.map((name) => ({
|
|
11763
11770
|
column: {
|
|
@@ -11780,9 +11787,9 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
11780
11787
|
const have = (name) => found.some((f) => f.result.names.includes(name));
|
|
11781
11788
|
let present = 0;
|
|
11782
11789
|
for (const { name, optional } of expected) if (have(name)) present++;
|
|
11783
|
-
else if (optional) rows.push(row$
|
|
11784
|
-
else rows.push(row$
|
|
11785
|
-
if (present > 0) rows.push(row$
|
|
11790
|
+
else if (optional) rows.push(row$7(provider, "skip", `optional, not set in ${where}`, name));
|
|
11791
|
+
else rows.push(row$7(provider, "fail", `missing from ${where}`, name));
|
|
11792
|
+
if (present > 0) rows.push(row$7(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
|
|
11786
11793
|
const names = new Set(expected.map((e) => e.name));
|
|
11787
11794
|
const places = [];
|
|
11788
11795
|
const missingRequired = expected.filter((e) => !e.optional && !have(e.name)).map((e) => e.name);
|
|
@@ -11821,7 +11828,7 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
11821
11828
|
};
|
|
11822
11829
|
} catch (err) {
|
|
11823
11830
|
return {
|
|
11824
|
-
rows: [row$
|
|
11831
|
+
rows: [row$7(provider, "fail", errorMessage(err))],
|
|
11825
11832
|
places: []
|
|
11826
11833
|
};
|
|
11827
11834
|
}
|
|
@@ -12695,7 +12702,7 @@ async function variableRows(loader, config, org) {
|
|
|
12695
12702
|
if (!loader.has("source")) {
|
|
12696
12703
|
const why = whyMissing(loader, "source", "no `source` provider to read them with");
|
|
12697
12704
|
for (const check of checks) {
|
|
12698
|
-
rows.push(row$
|
|
12705
|
+
rows.push(row$6(check, { skip: why }));
|
|
12699
12706
|
observations.push({
|
|
12700
12707
|
scope: check.scope,
|
|
12701
12708
|
unread: why
|
|
@@ -12705,7 +12712,7 @@ async function variableRows(loader, config, org) {
|
|
|
12705
12712
|
const source = loader.get("source");
|
|
12706
12713
|
for (const check of checks) try {
|
|
12707
12714
|
const result = await check.run(source);
|
|
12708
|
-
rows.push(row$
|
|
12715
|
+
rows.push(row$6(check, result));
|
|
12709
12716
|
observations.push("skip" in result ? {
|
|
12710
12717
|
scope: check.scope,
|
|
12711
12718
|
unread: result.skip
|
|
@@ -12716,7 +12723,7 @@ async function variableRows(loader, config, org) {
|
|
|
12716
12723
|
} catch (err) {
|
|
12717
12724
|
const noToken = missingTokenReason(err);
|
|
12718
12725
|
if (noToken !== void 0) {
|
|
12719
|
-
rows.push(row$
|
|
12726
|
+
rows.push(row$6(check, { skip: noToken }));
|
|
12720
12727
|
observations.push({
|
|
12721
12728
|
scope: check.scope,
|
|
12722
12729
|
unread: noToken
|
|
@@ -12742,7 +12749,7 @@ async function variableRows(loader, config, org) {
|
|
|
12742
12749
|
observations
|
|
12743
12750
|
};
|
|
12744
12751
|
}
|
|
12745
|
-
function row$
|
|
12752
|
+
function row$6(check, result) {
|
|
12746
12753
|
const { id, title } = check;
|
|
12747
12754
|
if ("skip" in result) return {
|
|
12748
12755
|
id,
|
|
@@ -12832,7 +12839,7 @@ function describeExpiry(expiresAt, now) {
|
|
|
12832
12839
|
*
|
|
12833
12840
|
* What a token may do is not checked: GitHub does not return a fine-grained token's permissions.
|
|
12834
12841
|
*/
|
|
12835
|
-
function row$
|
|
12842
|
+
function row$5(id, status, detail) {
|
|
12836
12843
|
return {
|
|
12837
12844
|
id: `verify:${id}`,
|
|
12838
12845
|
title: `verify ${id}`,
|
|
@@ -12860,12 +12867,12 @@ async function verifyRows(input) {
|
|
|
12860
12867
|
try {
|
|
12861
12868
|
module = await importer(pkg);
|
|
12862
12869
|
} catch (err) {
|
|
12863
|
-
rows.push(row$
|
|
12870
|
+
rows.push(row$5(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
|
|
12864
12871
|
continue;
|
|
12865
12872
|
}
|
|
12866
12873
|
for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, readToken, now()));
|
|
12867
12874
|
}
|
|
12868
|
-
if (rows.length === 0) rows.push(row$
|
|
12875
|
+
if (rows.length === 0) rows.push(row$5("tokens", "skip", "no configured plugin lists the tokens it takes"));
|
|
12869
12876
|
return rows;
|
|
12870
12877
|
}
|
|
12871
12878
|
/**
|
|
@@ -12878,30 +12885,30 @@ async function loadCredentials(input) {
|
|
|
12878
12885
|
try {
|
|
12879
12886
|
await input.loader.load();
|
|
12880
12887
|
} catch (err) {
|
|
12881
|
-
return [row$
|
|
12888
|
+
return [row$5("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
|
|
12882
12889
|
}
|
|
12883
|
-
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$
|
|
12890
|
+
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$5(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
|
|
12884
12891
|
}
|
|
12885
12892
|
async function checkToken(token, module, env, readToken, now) {
|
|
12886
12893
|
const { keyringKey, envName, vendorEnvName } = token;
|
|
12887
12894
|
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
12888
12895
|
const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
|
|
12889
12896
|
const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
|
|
12890
|
-
if (!value) return row$
|
|
12897
|
+
if (!value) return row$5(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
|
|
12891
12898
|
const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
|
|
12892
|
-
if (!verify) return row$
|
|
12899
|
+
if (!verify) return row$5(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
12893
12900
|
const from = fromEnv ?? stored?.source ?? "keyring";
|
|
12894
12901
|
try {
|
|
12895
12902
|
const verified = await verify(value);
|
|
12896
|
-
if (!verified.ok) return row$
|
|
12903
|
+
if (!verified.ok) return row$5(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|
|
12897
12904
|
const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
|
|
12898
|
-
if (!expiry) return row$
|
|
12905
|
+
if (!expiry) return row$5(keyringKey, "ok", `${verified.subject} (${from})`);
|
|
12899
12906
|
return expiry.soon ? {
|
|
12900
|
-
...row$
|
|
12907
|
+
...row$5(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
|
|
12901
12908
|
problems: [`${expiry.text}: renew it`]
|
|
12902
|
-
} : row$
|
|
12909
|
+
} : row$5(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
|
|
12903
12910
|
} catch (err) {
|
|
12904
|
-
return row$
|
|
12911
|
+
return row$5(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
|
|
12905
12912
|
}
|
|
12906
12913
|
}
|
|
12907
12914
|
// src/commands/doctor-secrets/doctor-secrets.ts
|
|
@@ -14047,7 +14054,7 @@ function resolveExportDir(input) {
|
|
|
14047
14054
|
* listed under the provider's row and does not fail the run. It writes files, so it asks first unless `--dry-run` (the
|
|
14048
14055
|
* files are converted and listed, nothing is written) or `--yes` (without a terminal it refuses instead).
|
|
14049
14056
|
*/
|
|
14050
|
-
const row$
|
|
14057
|
+
const row$4 = (id, status, detail, problems = []) => ({
|
|
14051
14058
|
id,
|
|
14052
14059
|
title: id,
|
|
14053
14060
|
status,
|
|
@@ -14074,9 +14081,9 @@ async function runRequestsExport(input) {
|
|
|
14074
14081
|
print("");
|
|
14075
14082
|
const entry = input.loaded.resolved.providers.tooling;
|
|
14076
14083
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
14077
|
-
if (tuples.length === 0) return finish([row$
|
|
14084
|
+
if (tuples.length === 0) return finish([row$4("tooling", "fail", "the config has no `tooling` provider to export for")]);
|
|
14078
14085
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
14079
|
-
if (chosen.length === 0) return finish([row$
|
|
14086
|
+
if (chosen.length === 0) return finish([row$4(input.to, "fail", `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`)]);
|
|
14080
14087
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
14081
14088
|
const loader = input.loader ?? new PluginLoader({
|
|
14082
14089
|
...input.loaded.resolved,
|
|
@@ -14096,17 +14103,17 @@ async function runRequestsExport(input) {
|
|
|
14096
14103
|
const tool = loaded.find((t) => t.providerName === id);
|
|
14097
14104
|
if (!tool) {
|
|
14098
14105
|
const failure = loader.loadFailures().find((f) => f.key === "tooling" && f.provider === id);
|
|
14099
|
-
rows.push(row$
|
|
14106
|
+
rows.push(row$4(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
|
|
14100
14107
|
continue;
|
|
14101
14108
|
}
|
|
14102
14109
|
if (!tool.export) {
|
|
14103
|
-
rows.push(row$
|
|
14110
|
+
rows.push(row$4(id, "skip", "has no export: it reads the repo's files as they are"));
|
|
14104
14111
|
continue;
|
|
14105
14112
|
}
|
|
14106
14113
|
const collectionFiles = fileList(tuple.options.collectionFiles);
|
|
14107
14114
|
const envFiles = fileList(tuple.options.envFiles);
|
|
14108
14115
|
if (collectionFiles.length === 0) {
|
|
14109
|
-
rows.push(row$
|
|
14116
|
+
rows.push(row$4(id, "skip", "names no `collectionFiles`, so there is nothing to export"));
|
|
14110
14117
|
continue;
|
|
14111
14118
|
}
|
|
14112
14119
|
const dir = resolveExportDir({
|
|
@@ -14116,7 +14123,7 @@ async function runRequestsExport(input) {
|
|
|
14116
14123
|
...input.out !== void 0 ? { out: input.out } : {}
|
|
14117
14124
|
});
|
|
14118
14125
|
if (!dir.ok) {
|
|
14119
|
-
rows.push(row$
|
|
14126
|
+
rows.push(row$4(id, "fail", dir.message));
|
|
14120
14127
|
continue;
|
|
14121
14128
|
}
|
|
14122
14129
|
targets.push({
|
|
@@ -14151,9 +14158,9 @@ async function runRequestsExport(input) {
|
|
|
14151
14158
|
});
|
|
14152
14159
|
const where = relative(repoRoot, outDir);
|
|
14153
14160
|
const files = result.files.length > 0 ? ` (${result.files.join(", ")})` : "";
|
|
14154
|
-
rows.push(row$
|
|
14161
|
+
rows.push(row$4(provider, "ok", `${dryRun ? "would write" : "wrote"} ${result.files.length} file(s) to ${where}${files}`, result.issues.map((issue) => `issue in ${issue.file}: ${issue.message}`)));
|
|
14155
14162
|
} catch (err) {
|
|
14156
|
-
rows.push(row$
|
|
14163
|
+
rows.push(row$4(provider, "fail", describeError(err)));
|
|
14157
14164
|
}
|
|
14158
14165
|
return finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
14159
14166
|
}
|
|
@@ -17513,7 +17520,7 @@ function specName(title, name) {
|
|
|
17513
17520
|
*/
|
|
17514
17521
|
/** How many lines of the spec a dry run shows. */
|
|
17515
17522
|
const PREVIEW_LINES$1 = 12;
|
|
17516
|
-
const row$
|
|
17523
|
+
const row$3 = (id, status, detail) => ({
|
|
17517
17524
|
id,
|
|
17518
17525
|
title: id,
|
|
17519
17526
|
status,
|
|
@@ -17543,7 +17550,7 @@ async function runIdeasPromote(input) {
|
|
|
17543
17550
|
print(style.header(`Holocron new spec${dryRun ? " (dry-run)" : ""}`));
|
|
17544
17551
|
print("");
|
|
17545
17552
|
const entry = input.loaded.resolved.providers.issues;
|
|
17546
|
-
if (!entry) return finish([row$
|
|
17553
|
+
if (!entry) return finish([row$3(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
|
|
17547
17554
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
17548
17555
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
17549
17556
|
const loader = input.loader ?? new PluginLoader({
|
|
@@ -17558,18 +17565,18 @@ async function runIdeasPromote(input) {
|
|
|
17558
17565
|
assertPluginsResolvable$1(loader, "new spec");
|
|
17559
17566
|
if (!loader.has("issues")) {
|
|
17560
17567
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
17561
|
-
return finish([row$
|
|
17568
|
+
return finish([row$3(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
17562
17569
|
}
|
|
17563
17570
|
let issue;
|
|
17564
17571
|
try {
|
|
17565
17572
|
issue = await loader.get("issues").get(input.issue);
|
|
17566
17573
|
} catch (err) {
|
|
17567
|
-
return finish([row$
|
|
17574
|
+
return finish([row$3(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
|
|
17568
17575
|
}
|
|
17569
17576
|
const name = specName(issue.summary, input.name);
|
|
17570
|
-
if (!name) return finish([row$
|
|
17577
|
+
if (!name) return finish([row$3(issue.key, "fail", input.name === void 0 ? "no spec name can be made from the title; pass --name" : `"${input.name}" is not a spec name: use lower-case words joined by hyphens, such as tech-my-topic`)]);
|
|
17571
17578
|
const relative = join(".notes", `${name}.spec.md`);
|
|
17572
|
-
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$
|
|
17579
|
+
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$3(relative, "fail", "the spec already exists; it is never overwritten")], relative);
|
|
17573
17580
|
const { org, name: repoName } = input.loaded.resolved;
|
|
17574
17581
|
const ref = githubRef(issue.url) ?? (issue.key.startsWith("#") ? `${org}/${repoName}${issue.key}` : issue.key);
|
|
17575
17582
|
const { content, fromIdea } = buildSpec({
|
|
@@ -17582,7 +17589,7 @@ async function runIdeasPromote(input) {
|
|
|
17582
17589
|
print(` ${relative}`);
|
|
17583
17590
|
for (const line of content.split("\n").slice(0, PREVIEW_LINES$1)) print(` ${style.skip(line)}`);
|
|
17584
17591
|
print("");
|
|
17585
|
-
return finish([row$
|
|
17592
|
+
return finish([row$3(relative, "skip", `would write the spec ${origin}`)], relative);
|
|
17586
17593
|
}
|
|
17587
17594
|
if (!input.yes) {
|
|
17588
17595
|
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`new spec\` writes ${relative}; pass --yes to run it without asking, or --dry-run to preview`);
|
|
@@ -17601,9 +17608,9 @@ async function runIdeasPromote(input) {
|
|
|
17601
17608
|
try {
|
|
17602
17609
|
io.write(join(input.context.repoRoot, relative), content);
|
|
17603
17610
|
} catch (err) {
|
|
17604
|
-
return finish([row$
|
|
17611
|
+
return finish([row$3(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
|
|
17605
17612
|
}
|
|
17606
|
-
return finish([row$
|
|
17613
|
+
return finish([row$3(relative, "ok", `wrote the spec ${origin}`)], relative);
|
|
17607
17614
|
}
|
|
17608
17615
|
// src/commands/ideas-promote/ideas-promote.command.ts
|
|
17609
17616
|
const ideasPromoteCommand = {
|
|
@@ -17649,7 +17656,7 @@ const ideasPromoteCommand = {
|
|
|
17649
17656
|
*/
|
|
17650
17657
|
/** How many lines of the body a dry run shows. */
|
|
17651
17658
|
const PREVIEW_LINES = 8;
|
|
17652
|
-
const row$
|
|
17659
|
+
const row$2 = (id, status, detail) => ({
|
|
17653
17660
|
id,
|
|
17654
17661
|
title: id,
|
|
17655
17662
|
status,
|
|
@@ -17673,9 +17680,9 @@ async function runIssueCreate(input) {
|
|
|
17673
17680
|
print(style.header(`Holocron new issue${dryRun ? " (dry-run)" : ""}`));
|
|
17674
17681
|
print("");
|
|
17675
17682
|
const title = input.title.trim();
|
|
17676
|
-
if (!title) return finish([row$
|
|
17683
|
+
if (!title) return finish([row$2("title", "fail", "the title is empty")]);
|
|
17677
17684
|
const entry = input.loaded.resolved.providers.issues;
|
|
17678
|
-
if (!entry) return finish([row$
|
|
17685
|
+
if (!entry) return finish([row$2(title, "fail", "the config has no `issues` provider to file the issue with")]);
|
|
17679
17686
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
17680
17687
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
17681
17688
|
const loader = input.loader ?? new PluginLoader({
|
|
@@ -17690,7 +17697,7 @@ async function runIssueCreate(input) {
|
|
|
17690
17697
|
assertPluginsResolvable$1(loader, "new issue");
|
|
17691
17698
|
if (!loader.has("issues")) {
|
|
17692
17699
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
17693
|
-
return finish([row$
|
|
17700
|
+
return finish([row$2(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
17694
17701
|
}
|
|
17695
17702
|
const labels = [...new Set((input.labels ?? []).map((l) => l.trim()).filter(Boolean))];
|
|
17696
17703
|
const body = input.body?.trim() ? input.body : void 0;
|
|
@@ -17701,7 +17708,7 @@ async function runIssueCreate(input) {
|
|
|
17701
17708
|
print(` ${title}`);
|
|
17702
17709
|
for (const line of (body ?? "").split("\n").slice(0, PREVIEW_LINES)) print(` ${style.skip(line)}`);
|
|
17703
17710
|
print("");
|
|
17704
|
-
return finish([row$
|
|
17711
|
+
return finish([row$2(title, "skip", `would file the issue${summary}`)]);
|
|
17705
17712
|
}
|
|
17706
17713
|
if (!input.yes) {
|
|
17707
17714
|
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError("`new issue` files an issue; pass --yes to run it without asking, or --dry-run to preview");
|
|
@@ -17723,9 +17730,9 @@ async function runIssueCreate(input) {
|
|
|
17723
17730
|
...labels.length > 0 ? { labels } : {},
|
|
17724
17731
|
...milestone ? { milestone } : {}
|
|
17725
17732
|
});
|
|
17726
|
-
return finish([row$
|
|
17733
|
+
return finish([row$2(title, "ok", `filed ${key}`)], key);
|
|
17727
17734
|
} catch (err) {
|
|
17728
|
-
return finish([row$
|
|
17735
|
+
return finish([row$2(title, "fail", `could not file the issue: ${describeError(err)}`)]);
|
|
17729
17736
|
}
|
|
17730
17737
|
}
|
|
17731
17738
|
// src/commands/issue-create/issue-create.command.ts
|
|
@@ -24817,7 +24824,7 @@ async function convergeCreatedIssue(issues, marker, created) {
|
|
|
24817
24824
|
*/
|
|
24818
24825
|
/** The state that files a note when the config names none. */
|
|
24819
24826
|
const DEFAULT_FILING_STATE = "in-progress";
|
|
24820
|
-
const row = (id, status, detail) => ({
|
|
24827
|
+
const row$1 = (id, status, detail) => ({
|
|
24821
24828
|
id,
|
|
24822
24829
|
title: id,
|
|
24823
24830
|
status,
|
|
@@ -24849,7 +24856,7 @@ async function runIdeasSync(input) {
|
|
|
24849
24856
|
print(style.header(`Holocron sync ideas${dryRun ? " (dry-run)" : ""}`));
|
|
24850
24857
|
print("");
|
|
24851
24858
|
const entry = resolveIdeasProvider(input.loaded.resolved, input.env);
|
|
24852
|
-
if (!entry) return finish([row("ideas", "fail", "no `ideas` provider: set `providers.ideas` (`[\"obsidian\", { dir }]`) in holocron.config or HOLOCRON_IDEAS_DIR")]);
|
|
24859
|
+
if (!entry) return finish([row$1("ideas", "fail", "no `ideas` provider: set `providers.ideas` (`[\"obsidian\", { dir }]`) in holocron.config or HOLOCRON_IDEAS_DIR")]);
|
|
24853
24860
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
24854
24861
|
const reader = input.ideasLoader ?? new PluginLoader({
|
|
24855
24862
|
...input.loaded.resolved,
|
|
@@ -24860,25 +24867,25 @@ async function runIdeasSync(input) {
|
|
|
24860
24867
|
assertPluginsResolvable$1(reader, "sync ideas");
|
|
24861
24868
|
if (!reader.has("ideas")) {
|
|
24862
24869
|
const failure = reader.loadFailures().find((f) => f.key === "ideas");
|
|
24863
|
-
return finish([row("ideas", "fail", `the \`ideas\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
24870
|
+
return finish([row$1("ideas", "fail", `the \`ideas\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
24864
24871
|
}
|
|
24865
24872
|
const ideas = reader.get("ideas");
|
|
24866
24873
|
let records;
|
|
24867
24874
|
try {
|
|
24868
24875
|
records = await ideas.list();
|
|
24869
24876
|
} catch (err) {
|
|
24870
|
-
return finish([row("ideas", "fail", describeError(err))]);
|
|
24877
|
+
return finish([row$1("ideas", "fail", describeError(err))]);
|
|
24871
24878
|
}
|
|
24872
24879
|
const fileState = input.loaded.resolved.ideas?.states?.file ?? DEFAULT_FILING_STATE;
|
|
24873
24880
|
const rows = [];
|
|
24874
24881
|
const ready = [];
|
|
24875
|
-
for (const idea of records) if (idea.error !== void 0) rows.push(row(idea.key, "fail", idea.error));
|
|
24882
|
+
for (const idea of records) if (idea.error !== void 0) rows.push(row$1(idea.key, "fail", idea.error));
|
|
24876
24883
|
else if (idea.status !== fileState || idea.issue !== void 0) notReady++;
|
|
24877
|
-
else if (idea.attachments.length > 0) rows.push(row(idea.key, "skip", `has embedded files an issue cannot carry (${idea.attachments.join(", ")}); not filed`));
|
|
24884
|
+
else if (idea.attachments.length > 0) rows.push(row$1(idea.key, "skip", `has embedded files an issue cannot carry (${idea.attachments.join(", ")}); not filed`));
|
|
24878
24885
|
else ready.push(idea);
|
|
24879
24886
|
if (ready.length === 0) return finish(rows);
|
|
24880
24887
|
if (dryRun) {
|
|
24881
|
-
for (const idea of ready) rows.push(row(idea.key, "skip", `would file "${idea.title}"`));
|
|
24888
|
+
for (const idea of ready) rows.push(row$1(idea.key, "skip", `would file "${idea.title}"`));
|
|
24882
24889
|
return finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
24883
24890
|
}
|
|
24884
24891
|
if (!input.yes) {
|
|
@@ -24902,7 +24909,7 @@ async function runIdeasSync(input) {
|
|
|
24902
24909
|
for (const idea of ready) {
|
|
24903
24910
|
const path = idea.key;
|
|
24904
24911
|
if (!issues) {
|
|
24905
|
-
rows.push(row(path, "fail", "the config has no `issues` provider to file it with"));
|
|
24912
|
+
rows.push(row$1(path, "fail", "the config has no `issues` provider to file it with"));
|
|
24906
24913
|
continue;
|
|
24907
24914
|
}
|
|
24908
24915
|
let existing;
|
|
@@ -24912,7 +24919,7 @@ async function runIdeasSync(input) {
|
|
|
24912
24919
|
limit: 100
|
|
24913
24920
|
})).filter((issue) => issue.body?.includes(marker(path))));
|
|
24914
24921
|
} catch (err) {
|
|
24915
|
-
rows.push(row(path, "fail", `could not check for an existing issue, so none was created: ${describeError(err)}`));
|
|
24922
|
+
rows.push(row$1(path, "fail", `could not check for an existing issue, so none was created: ${describeError(err)}`));
|
|
24916
24923
|
continue;
|
|
24917
24924
|
}
|
|
24918
24925
|
let key;
|
|
@@ -24927,7 +24934,7 @@ async function runIdeasSync(input) {
|
|
|
24927
24934
|
body: issueBody(idea)
|
|
24928
24935
|
}));
|
|
24929
24936
|
} catch (err) {
|
|
24930
|
-
rows.push(row(path, "fail", `could not create the issue: ${describeError(err)}`));
|
|
24937
|
+
rows.push(row$1(path, "fail", `could not create the issue: ${describeError(err)}`));
|
|
24931
24938
|
continue;
|
|
24932
24939
|
}
|
|
24933
24940
|
({key, detail, warning} = await convergeCreatedIssue(issues, marker(path), created));
|
|
@@ -24935,12 +24942,12 @@ async function runIdeasSync(input) {
|
|
|
24935
24942
|
try {
|
|
24936
24943
|
await ideas.markFiled(path, key);
|
|
24937
24944
|
rows.push({
|
|
24938
|
-
...row(path, "ok", detail),
|
|
24945
|
+
...row$1(path, "ok", detail),
|
|
24939
24946
|
problems: warning ? ["a duplicate issue for this idea may be open: close the extra one by hand"] : []
|
|
24940
24947
|
});
|
|
24941
24948
|
} catch (err) {
|
|
24942
24949
|
rows.push({
|
|
24943
|
-
...row(path, "fail", `issue ${key} was created but \`issue:\` was not written: ${describeError(err)}`),
|
|
24950
|
+
...row$1(path, "fail", `issue ${key} was created but \`issue:\` was not written: ${describeError(err)}`),
|
|
24944
24951
|
problems: [`add \`issue: ${key}\` to the note by hand`]
|
|
24945
24952
|
});
|
|
24946
24953
|
}
|
|
@@ -26825,6 +26832,90 @@ const syncReadmeCommand = {
|
|
|
26825
26832
|
}
|
|
26826
26833
|
}
|
|
26827
26834
|
};
|
|
26835
|
+
// src/commands/sync-tooling/run-sync-tooling/run-sync-tooling.ts
|
|
26836
|
+
/**
|
|
26837
|
+
* `holocron sync tooling` — runs each `tooling` provider's `sync()` and nothing else.
|
|
26838
|
+
*
|
|
26839
|
+
* `holocron setup` does this too, but after every other step the config declares (the vault, the deployment domain, DNS),
|
|
26840
|
+
* so pushing a collection to a tool needed all of them to be reachable. This loads only the `tooling` providers and the
|
|
26841
|
+
* `credentials` provider their tokens may come from, so no other provider is loaded, called or reported. Each provider
|
|
26842
|
+
* is one row; a provider that throws is a failing row and the others still run. `--dry-run` names what would be synced
|
|
26843
|
+
* and calls no provider. It asks nothing first: like `setup`, it makes the tool match what the repo declares.
|
|
26844
|
+
*/
|
|
26845
|
+
const row = (id, status, detail) => ({
|
|
26846
|
+
id,
|
|
26847
|
+
title: id,
|
|
26848
|
+
status,
|
|
26849
|
+
detail,
|
|
26850
|
+
problems: []
|
|
26851
|
+
});
|
|
26852
|
+
async function runSyncTooling(input) {
|
|
26853
|
+
/* v8 ignore next -- the console is only used outside tests, which inject `print` */
|
|
26854
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
26855
|
+
const dryRun = Boolean(input.context.dryRun);
|
|
26856
|
+
const finish = (rows) => {
|
|
26857
|
+
printCheckRows(rows, print);
|
|
26858
|
+
const summary = summariseChecks(rows);
|
|
26859
|
+
printCheckSummary(summary, print);
|
|
26860
|
+
return {
|
|
26861
|
+
status: summary.fail > 0 ? "fail" : "ok",
|
|
26862
|
+
rows
|
|
26863
|
+
};
|
|
26864
|
+
};
|
|
26865
|
+
print(style.header(`Holocron sync tooling${dryRun ? " (dry-run)" : ""}`));
|
|
26866
|
+
print("");
|
|
26867
|
+
const { tooling, credentials } = input.loaded.resolved.providers;
|
|
26868
|
+
if (!tooling) return finish([row("tooling", "fail", "no `tooling` provider: set `providers.tooling` (for example `postman`) in holocron.config")]);
|
|
26869
|
+
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
26870
|
+
const loader = input.loader ?? new PluginLoader({
|
|
26871
|
+
...input.loaded.resolved,
|
|
26872
|
+
providers: {
|
|
26873
|
+
tooling,
|
|
26874
|
+
...credentials ? { credentials } : {}
|
|
26875
|
+
}
|
|
26876
|
+
}, input.context);
|
|
26877
|
+
/* v8 ignore stop */
|
|
26878
|
+
await loader.load();
|
|
26879
|
+
assertPluginsResolvable$1(loader, "sync tooling");
|
|
26880
|
+
if (!loader.has("tooling")) {
|
|
26881
|
+
const failure = loader.loadFailures().find((f) => f.key === "tooling");
|
|
26882
|
+
return finish([row("tooling", "fail", `the \`tooling\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
26883
|
+
}
|
|
26884
|
+
const rows = [];
|
|
26885
|
+
for (const tool of loader.get("tooling")) {
|
|
26886
|
+
if (dryRun) {
|
|
26887
|
+
rows.push(row(tool.providerName, "skip", "would sync"));
|
|
26888
|
+
continue;
|
|
26889
|
+
}
|
|
26890
|
+
try {
|
|
26891
|
+
await tool.sync();
|
|
26892
|
+
rows.push(row(tool.providerName, "ok", "synced"));
|
|
26893
|
+
} catch (err) {
|
|
26894
|
+
rows.push(row(tool.providerName, "fail", describeError(err)));
|
|
26895
|
+
}
|
|
26896
|
+
}
|
|
26897
|
+
return finish(rows);
|
|
26898
|
+
}
|
|
26899
|
+
// src/commands/sync-tooling/sync-tooling.command.ts
|
|
26900
|
+
const syncToolingCommand = {
|
|
26901
|
+
command: "tooling",
|
|
26902
|
+
describe: "Sync each tooling provider (collections, environments, specs) without running the rest of setup",
|
|
26903
|
+
handler: async (argv) => {
|
|
26904
|
+
const tokens = tokenContext$1(argv.token);
|
|
26905
|
+
if (!tokens) return;
|
|
26906
|
+
const loaded = await loadConfig(argv.cwd);
|
|
26907
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
26908
|
+
if ((await runSyncTooling({
|
|
26909
|
+
loaded,
|
|
26910
|
+
context: {
|
|
26911
|
+
repoRoot: argv.cwd,
|
|
26912
|
+
dryRun: argv.dryRun,
|
|
26913
|
+
...tokens,
|
|
26914
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
26915
|
+
}
|
|
26916
|
+
})).status === "fail") process.exitCode = 1;
|
|
26917
|
+
}
|
|
26918
|
+
};
|
|
26828
26919
|
// src/presets/constants.ts
|
|
26829
26920
|
/**
|
|
26830
26921
|
* The org's DNS zone as the presets ship it to a consumer repo that has no `.holocron/org.ts` of its own. A repo
|
|
@@ -27661,7 +27752,7 @@ const syncArgs = (y) => y.positional("steps", {
|
|
|
27661
27752
|
const syncCommand = {
|
|
27662
27753
|
command: "sync [steps..]",
|
|
27663
27754
|
describe: "Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)",
|
|
27664
|
-
builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
|
|
27755
|
+
builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(syncToolingCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
|
|
27665
27756
|
handler: async (argv) => {
|
|
27666
27757
|
const tokens = tokenContext$1(argv.token);
|
|
27667
27758
|
if (!tokens) return;
|