@theholocron/cli 5.0.0-alpha.455 → 5.0.0-alpha.457
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 +3 -3
- package/dist/cli.mjs +346 -129
- package/dist/cli.mjs.map +1 -1
- package/dist/{index-DgTMwh2a.d.mts → index-BDQERqlN.d.mts} +56 -1
- package/dist/index.d.mts +2 -2
- package/dist/plugin/capabilities.d.mts +2 -2
- package/dist/presets.d.mts +1 -1
- package/package.json +10 -10
package/dist/cli.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { hideBin } from "yargs/helpers";
|
|
|
13
13
|
import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, numeric } from "@theholocron/kyber/menu";
|
|
14
14
|
import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
15
15
|
import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver as createFeatureResolver$1, createKeyring, dotenvLine, findCredential, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue as resolveValue$1, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
|
|
16
|
-
import { DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, codecovFlagNames,
|
|
16
|
+
import { DEFAULT_ORG, DOCUMENTATION_FLAG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, codecovFlagNames, createAstromech, createCommitMsg, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, formatJson, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, localizeActions, mergeScripts, packageLocation, readWorkspacePackages, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, workflowFile, workflowKey, workflowKeys, workspacePackages as workspacePackages$1 } from "@theholocron/astromech";
|
|
17
17
|
import { loadTasksConfig } from "@theholocron/astromech/config";
|
|
18
18
|
import { ConfigError, ConfigError as ConfigError$1, createConfigSystem, lastWins, mergeByKey, shallowMerge, union } from "@theholocron/kyber/config";
|
|
19
19
|
import { LoaderError, assertPluginsResolvable as assertPluginsResolvable$1, createPluginSystem, defaultImporter as defaultImporter$1, isModuleNotFound, isModuleNotFound as isModuleNotFound$1, resolvePluginPackage as resolvePluginPackage$1 } from "@theholocron/kyber/plugins";
|
|
@@ -1084,6 +1084,18 @@ const registry = createCommandRegistry([
|
|
|
1084
1084
|
positionals: [],
|
|
1085
1085
|
supportsDryRun: true
|
|
1086
1086
|
},
|
|
1087
|
+
{
|
|
1088
|
+
name: "sync requests",
|
|
1089
|
+
description: "Keep each tooling provider's own workspace and the repo's request files in step, both ways",
|
|
1090
|
+
positionals: [],
|
|
1091
|
+
skipOptions: [
|
|
1092
|
+
"yes",
|
|
1093
|
+
"to",
|
|
1094
|
+
"check",
|
|
1095
|
+
"prefer"
|
|
1096
|
+
],
|
|
1097
|
+
supportsDryRun: true
|
|
1098
|
+
},
|
|
1087
1099
|
ideasPromoteEntry,
|
|
1088
1100
|
issueCreateEntry,
|
|
1089
1101
|
{
|
|
@@ -2433,6 +2445,7 @@ const COMMAND_CONTEXTS = {
|
|
|
2433
2445
|
"sync issues": "workspace",
|
|
2434
2446
|
"sync ideas": "workspace",
|
|
2435
2447
|
"sync tooling": "workspace",
|
|
2448
|
+
"sync requests": "workspace",
|
|
2436
2449
|
"new spec": "workspace",
|
|
2437
2450
|
"new issue": "workspace"
|
|
2438
2451
|
};
|
|
@@ -6914,7 +6927,7 @@ async function runDoctorDns(input) {
|
|
|
6914
6927
|
});
|
|
6915
6928
|
else if (!loader.has("dns")) {
|
|
6916
6929
|
const why = whyMissing(loader, "dns", "no `dns` provider to check them with");
|
|
6917
|
-
for (const zone of zones) rows.push(row$
|
|
6930
|
+
for (const zone of zones) rows.push(row$17(zone, "skip", why));
|
|
6918
6931
|
for (const { hostname } of domains) rows.push(domainRow(hostname, "skip", why));
|
|
6919
6932
|
} else {
|
|
6920
6933
|
const dns = loader.get("dns");
|
|
@@ -6936,7 +6949,7 @@ async function runDoctorDns(input) {
|
|
|
6936
6949
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
6937
6950
|
};
|
|
6938
6951
|
}
|
|
6939
|
-
function row$
|
|
6952
|
+
function row$17(zone, status, detail, problems = []) {
|
|
6940
6953
|
return {
|
|
6941
6954
|
id: `dns-${zone}`,
|
|
6942
6955
|
title: `${zone} records exist`,
|
|
@@ -6965,7 +6978,7 @@ async function checkDomain(dns, deploy, project, hostname) {
|
|
|
6965
6978
|
return noToken !== void 0 ? domainRow(hostname, "skip", noToken) : domainRow(hostname, "fail", errorMessage(err));
|
|
6966
6979
|
}
|
|
6967
6980
|
}
|
|
6968
|
-
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$
|
|
6981
|
+
async function checkZone(dns, zone, wanted, rowOf = (...args) => row$17(zone, ...args)) {
|
|
6969
6982
|
try {
|
|
6970
6983
|
const have = await dns.listRecords(zone);
|
|
6971
6984
|
const problems = declaredVsActual(new Map(wanted.map((w) => [keyOf(w), w])), new Map(have.map((h) => [keyOf(h), h])), {
|
|
@@ -7100,7 +7113,7 @@ function installationSettingsUrl(account, id) {
|
|
|
7100
7113
|
return `https://github.com/settings/installations/${id}`;
|
|
7101
7114
|
}
|
|
7102
7115
|
// src/commands/doctor-github-app/app-rows.ts
|
|
7103
|
-
const row$
|
|
7116
|
+
const row$16 = (name, what, problems, ok) => ({
|
|
7104
7117
|
id: `${name}:${what}`,
|
|
7105
7118
|
title: `${name}: ${what}`,
|
|
7106
7119
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -7127,9 +7140,9 @@ function appRows(name, manifest, app, installations) {
|
|
|
7127
7140
|
return [`${who} has not accepted the current App: ${gaps.join("; ")}`, `fix: ${who} accepts the update at ${url}`];
|
|
7128
7141
|
});
|
|
7129
7142
|
return [
|
|
7130
|
-
row$
|
|
7131
|
-
row$
|
|
7132
|
-
row$
|
|
7143
|
+
row$16(name, "events", eventProblems.length > 0 ? [...eventProblems, fix] : [], `all ${manifest.events.length} subscribed${extrasNote("extra event(s)", extraEvents)}`),
|
|
7144
|
+
row$16(name, "permissions", permissionProblems.length > 0 ? [...permissionProblems, fix] : [], `all ${Object.keys(manifest.permissions).length} granted${extrasNote("extra permission(s)", extraPermissions)}`),
|
|
7145
|
+
row$16(name, "installations", installationProblems, `${installations.length} installation(s) up to date`)
|
|
7133
7146
|
];
|
|
7134
7147
|
}
|
|
7135
7148
|
// src/commands/doctor-github-app/parse-manifest.ts
|
|
@@ -7187,7 +7200,7 @@ async function runDoctorGitHubApp(input) {
|
|
|
7187
7200
|
assertPluginsResolvable(loader, "doctor github-app");
|
|
7188
7201
|
}
|
|
7189
7202
|
const rows = [];
|
|
7190
|
-
if (instances.length === 0) rows.push(row$
|
|
7203
|
+
if (instances.length === 0) rows.push(row$15("github-app", "reachable", "skip", "no `githubApps` are declared in holocron.config.ts"));
|
|
7191
7204
|
for (const instance of instances) rows.push(...await checkInstance(instance, loader, input));
|
|
7192
7205
|
printCheckRows(rows, print);
|
|
7193
7206
|
const summary = summariseChecks(rows);
|
|
@@ -7204,7 +7217,7 @@ async function runDoctorGitHubApp(input) {
|
|
|
7204
7217
|
...status === "skip" ? { reason: [...new Set(rows.map((r) => r.detail))].join("; ") } : {}
|
|
7205
7218
|
};
|
|
7206
7219
|
}
|
|
7207
|
-
function row$
|
|
7220
|
+
function row$15(name, what, status, detail) {
|
|
7208
7221
|
return {
|
|
7209
7222
|
id: `${name}:${what}`,
|
|
7210
7223
|
title: `${name}: ${what}`,
|
|
@@ -7245,19 +7258,19 @@ async function checkInstance(instance, loader, input) {
|
|
|
7245
7258
|
try {
|
|
7246
7259
|
manifest = parseManifest(readManifest(instance.manifest));
|
|
7247
7260
|
} catch (err) {
|
|
7248
|
-
return [row$
|
|
7261
|
+
return [row$15(name, "manifest", "fail", `cannot read ${instance.manifest}: ${errorMessage(err)}`)];
|
|
7249
7262
|
}
|
|
7250
7263
|
const read = await readCredentials(instance, loader);
|
|
7251
|
-
if ("reason" in read) return [row$
|
|
7264
|
+
if ("reason" in read) return [row$15(name, "reachable", "skip", read.reason)];
|
|
7252
7265
|
const api = input.api ?? defaultApi;
|
|
7253
7266
|
const secrets = [read.creds.privateKey];
|
|
7254
7267
|
try {
|
|
7255
7268
|
const app = await api.getApp(read.creds);
|
|
7256
7269
|
const installations = await api.listAppInstallations(read.creds);
|
|
7257
7270
|
const owner = app.owner ? `, owned by ${app.owner.login}` : "";
|
|
7258
|
-
return [row$
|
|
7271
|
+
return [row$15(name, "reachable", "ok", `${app.slug}${owner}, settings: ${appSettingsUrl(app)}`), ...appRows(name, manifest, app, installations)];
|
|
7259
7272
|
} catch (err) {
|
|
7260
|
-
return [row$
|
|
7273
|
+
return [row$15(name, "reachable", "fail", `cannot call GitHub as the App: ${scrubbed$1(err, secrets)}`)];
|
|
7261
7274
|
}
|
|
7262
7275
|
}
|
|
7263
7276
|
// src/commands/doctor-github-app/doctor-github-app.command.ts
|
|
@@ -7324,7 +7337,7 @@ function datasetTargets(config) {
|
|
|
7324
7337
|
* dataset, shared by every environment in it). Only a dataset the provider says is missing, or a token it refuses, fails;
|
|
7325
7338
|
* a name, a token or a response that cannot be read is a skip with the reason.
|
|
7326
7339
|
*/
|
|
7327
|
-
const row$
|
|
7340
|
+
const row$14 = (id, title, status, detail, problems = []) => ({
|
|
7328
7341
|
id,
|
|
7329
7342
|
title,
|
|
7330
7343
|
status,
|
|
@@ -7341,7 +7354,7 @@ async function runDoctorLogs(input) {
|
|
|
7341
7354
|
if (!loader.has("logs")) {
|
|
7342
7355
|
const failure = loader.loadFailures().find((f) => f.key === "logs");
|
|
7343
7356
|
const why = failure ? `\`${failure.provider}\` failed to load: ${describeError(failure.error)}` : "no `logs` provider is configured in holocron.config.ts";
|
|
7344
|
-
rows.push(row$
|
|
7357
|
+
rows.push(row$14("logs", "logs", "skip", why));
|
|
7345
7358
|
} else rows.push(...await checkLogs(loader.get("logs"), datasetTargets(input.loaded.resolved)));
|
|
7346
7359
|
printCheckRows(rows, print);
|
|
7347
7360
|
const summary = summariseChecks(rows);
|
|
@@ -7365,38 +7378,38 @@ async function checkLogs(logs, targets) {
|
|
|
7365
7378
|
for (const target of targets) {
|
|
7366
7379
|
const id = `logs:dataset:${target.id}`;
|
|
7367
7380
|
const title = `dataset for ${target.label}`;
|
|
7368
|
-
if (!target.name) rows.push(row$
|
|
7369
|
-
else if (!token.usable) rows.push(row$
|
|
7370
|
-
else if (!logs.readDataset) rows.push(row$
|
|
7381
|
+
if (!target.name) rows.push(row$14(id, title, "skip", `${target.variable} is not set here, so there is no name to look for`));
|
|
7382
|
+
else if (!token.usable) rows.push(row$14(id, title, "skip", `${target.name}: not checked, the token is not usable`));
|
|
7383
|
+
else if (!logs.readDataset) rows.push(row$14(id, title, "skip", `${logs.providerName} cannot read a dataset`));
|
|
7371
7384
|
else rows.push(...await checkDataset(logs, target, target.name, id, title));
|
|
7372
7385
|
}
|
|
7373
7386
|
const org = resolveValue$1(["AXIOM_ORG"], void 0, { prefix: PREFIX$1 });
|
|
7374
|
-
rows.push(org ? row$
|
|
7387
|
+
rows.push(org ? row$14("logs:org", "organization", "ok", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is set`) : row$14("logs:org", "organization", "skip", `${PREFIX$1}_AXIOM_ORG (or AXIOM_ORG) is not set here; Sentinel's log links need it`));
|
|
7375
7388
|
return rows;
|
|
7376
7389
|
}
|
|
7377
7390
|
/** Whether the provider accepts the token. `usable` is false when it was refused or could not be tried. */
|
|
7378
7391
|
async function checkToken$1(logs) {
|
|
7379
7392
|
const title = "token is accepted";
|
|
7380
7393
|
if (!logs.checkToken) return {
|
|
7381
|
-
row: row$
|
|
7394
|
+
row: row$14("logs:token", title, "skip", `${logs.providerName} cannot check a token`),
|
|
7382
7395
|
usable: true
|
|
7383
7396
|
};
|
|
7384
7397
|
try {
|
|
7385
7398
|
const result = await logs.checkToken();
|
|
7386
7399
|
if (result.ok) return {
|
|
7387
|
-
row: row$
|
|
7400
|
+
row: row$14("logs:token", title, "ok", `${logs.providerName} accepts the token`),
|
|
7388
7401
|
usable: true
|
|
7389
7402
|
};
|
|
7390
7403
|
const reason = result.reason ?? `${logs.providerName} refused the token`;
|
|
7391
7404
|
return {
|
|
7392
|
-
row: row$
|
|
7405
|
+
row: row$14("logs:token", title, "fail", reason, [reason]),
|
|
7393
7406
|
usable: false
|
|
7394
7407
|
};
|
|
7395
7408
|
} catch (err) {
|
|
7396
7409
|
const noToken = missingTokenReason(err);
|
|
7397
7410
|
const detail = noToken ?? `could not check the token: ${describeError(err)}`;
|
|
7398
7411
|
return {
|
|
7399
|
-
row: row$
|
|
7412
|
+
row: row$14("logs:token", title, "skip", detail),
|
|
7400
7413
|
usable: noToken === void 0
|
|
7401
7414
|
};
|
|
7402
7415
|
}
|
|
@@ -7406,13 +7419,13 @@ async function checkDataset(logs, target, name, id, title) {
|
|
|
7406
7419
|
const found = await logs.readDataset(name);
|
|
7407
7420
|
if (!found.exists) {
|
|
7408
7421
|
const problem = `dataset ${name} does not exist (${target.variable}); ${target.fix}`;
|
|
7409
|
-
return [row$
|
|
7422
|
+
return [row$14(id, title, "fail", `${name} does not exist`, [problem])];
|
|
7410
7423
|
}
|
|
7411
7424
|
const retention = found.retentionDays === void 0 ? `retention: ${logs.providerName} did not report one for ${name}` : `retention: ${found.retentionDays} days for ${name}`;
|
|
7412
|
-
return [row$
|
|
7425
|
+
return [row$14(id, title, "ok", `${name} exists`), row$14(`logs:retention:${target.id}`, `retention of ${name}`, "skip", `info: ${retention}; one setting shared by every environment in the dataset (ADR-0019)`)];
|
|
7413
7426
|
} catch (err) {
|
|
7414
7427
|
const detail = missingTokenReason(err) ?? `could not read ${name}: ${describeError(err)}`;
|
|
7415
|
-
return [row$
|
|
7428
|
+
return [row$14(id, title, "skip", detail)];
|
|
7416
7429
|
}
|
|
7417
7430
|
}
|
|
7418
7431
|
// src/commands/doctor-logs/doctor-logs.command.ts
|
|
@@ -10354,7 +10367,7 @@ const info = (id, title, noun, extras) => ({
|
|
|
10354
10367
|
detail: `info: ${extras.length} ${noun} not in the template (never deleted)`,
|
|
10355
10368
|
problems: extras
|
|
10356
10369
|
});
|
|
10357
|
-
const row$
|
|
10370
|
+
const row$13 = (id, title, problems, ok) => ({
|
|
10358
10371
|
id,
|
|
10359
10372
|
title,
|
|
10360
10373
|
status: problems.length > 0 ? "fail" : "ok",
|
|
@@ -10390,19 +10403,19 @@ function viewProblems(want, found) {
|
|
|
10390
10403
|
function boardRows(boardName, template, state) {
|
|
10391
10404
|
const id = `project:${boardName}`;
|
|
10392
10405
|
const rows = [];
|
|
10393
|
-
rows.push(row$
|
|
10406
|
+
rows.push(row$13(`${id}:statuses`, `${boardName}: statuses`, listProblems("status", "statuses", template.statuses.map((s) => s.name), state.statuses), `${template.statuses.length} in order`));
|
|
10394
10407
|
const extraStatuses = state.statuses.filter((s) => !template.statuses.some((t) => t.name === s));
|
|
10395
10408
|
if (extraStatuses.length > 0) rows.push(info(`${id}:extra-statuses`, `${boardName}: extra statuses`, "status(es)", extraStatuses));
|
|
10396
|
-
for (const want of template.fields) rows.push(row$
|
|
10409
|
+
for (const want of template.fields) rows.push(row$13(`${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));
|
|
10397
10410
|
const extraFields = state.fields.filter((f) => !template.fields.some((t) => t.name === f.name));
|
|
10398
10411
|
if (extraFields.length > 0) rows.push(info(`${id}:extra-fields`, `${boardName}: extra fields`, "field(s)", extraFields.map((f) => f.name)));
|
|
10399
|
-
for (const want of template.views) rows.push(row$
|
|
10412
|
+
for (const want of template.views) rows.push(row$13(`${id}:view:${want.name}`, `${boardName}: view ${want.name}`, viewProblems(want, state.views.find((v) => v.name === want.name)), `${want.layout}${want.filter ? `, ${want.filter}` : ""}`));
|
|
10400
10413
|
const extraViews = state.views.filter((v) => !template.views.some((t) => t.name === v.name));
|
|
10401
10414
|
if (extraViews.length > 0) rows.push(info(`${id}:extra-views`, `${boardName}: extra views`, "view(s)", extraViews.map((v) => v.name)));
|
|
10402
10415
|
for (const name of template.rules ?? []) {
|
|
10403
10416
|
const found = state.rules.find((r) => r.name === name);
|
|
10404
10417
|
const problems = !found ? [`missing rule ${name}`] : found.enabled ? [] : [`rule ${name} is off`];
|
|
10405
|
-
rows.push(row$
|
|
10418
|
+
rows.push(row$13(`${id}:rule:${name}`, `${boardName}: rule ${name}`, problems, "on"));
|
|
10406
10419
|
}
|
|
10407
10420
|
return rows;
|
|
10408
10421
|
}
|
|
@@ -10462,7 +10475,7 @@ function itemRows(boardName, items) {
|
|
|
10462
10475
|
* never fail the run. A template file that does not read is a failure naming the file. `--post [channel]` shares the
|
|
10463
10476
|
* failing rows through the `notifications` provider's bot, like `doctor notifications --post`.
|
|
10464
10477
|
*/
|
|
10465
|
-
const row$
|
|
10478
|
+
const row$12 = (id, title, status, detail, problems = []) => ({
|
|
10466
10479
|
id,
|
|
10467
10480
|
title,
|
|
10468
10481
|
status,
|
|
@@ -10516,14 +10529,14 @@ async function checkBoards(input, loader) {
|
|
|
10516
10529
|
loader,
|
|
10517
10530
|
...input.io ? { io: input.io } : {}
|
|
10518
10531
|
});
|
|
10519
|
-
if (!opened.ok) return [row$
|
|
10532
|
+
if (!opened.ok) return [row$12("project", "project", opened.kind, opened.reason, opened.problems)];
|
|
10520
10533
|
const { projects, owner, boards, templates, templateProblems } = opened.context;
|
|
10521
10534
|
const rows = templateProblems.map((problem) => {
|
|
10522
10535
|
/* v8 ignore next -- split always returns at least one element; the fallback only satisfies noUncheckedIndexedAccess */
|
|
10523
10536
|
const file = problem.split(": ")[0] ?? problem;
|
|
10524
|
-
return row$
|
|
10537
|
+
return row$12(`project:template:${file}`, `template file ${file}`, "fail", problem);
|
|
10525
10538
|
});
|
|
10526
|
-
if (boards.length === 0) return [...rows, row$
|
|
10539
|
+
if (boards.length === 0) return [...rows, row$12("project", "project", "skip", "no boards are declared in `providers.projects.boards`")];
|
|
10527
10540
|
for (const declared of boards) {
|
|
10528
10541
|
const template = templates[declared.template];
|
|
10529
10542
|
const title = `${declared.name}: board exists and is open`;
|
|
@@ -10531,18 +10544,18 @@ async function checkBoards(input, loader) {
|
|
|
10531
10544
|
const board = await projects.find(owner, declared.name);
|
|
10532
10545
|
if (!board) {
|
|
10533
10546
|
const closed = (await projects.list(owner)).some((b) => b.name === declared.name && b.closed);
|
|
10534
|
-
rows.push(row$
|
|
10547
|
+
rows.push(row$12(`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`"]));
|
|
10535
10548
|
continue;
|
|
10536
10549
|
}
|
|
10537
|
-
rows.push(row$
|
|
10550
|
+
rows.push(row$12(`project:${declared.name}`, title, "ok", board.url));
|
|
10538
10551
|
if (!template) {
|
|
10539
|
-
rows.push(row$
|
|
10552
|
+
rows.push(row$12(`project:${declared.name}:template`, `${declared.name}: template ${declared.template}`, "fail", "no built-in or file template has this name"));
|
|
10540
10553
|
continue;
|
|
10541
10554
|
}
|
|
10542
10555
|
rows.push(...boardRows(declared.name, template, await projects.read(owner, board)));
|
|
10543
|
-
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$
|
|
10556
|
+
rows.push(...projects.items ? itemRows(declared.name, await projects.items(owner, board, template)) : [row$12(`project:${declared.name}:items`, `${declared.name}: items`, "skip", "the provider cannot list a board's items")]);
|
|
10544
10557
|
} catch (err) {
|
|
10545
|
-
rows.push(row$
|
|
10558
|
+
rows.push(row$12(`project:${declared.name}`, title, "fail", describeError(err)));
|
|
10546
10559
|
}
|
|
10547
10560
|
}
|
|
10548
10561
|
return rows;
|
|
@@ -11254,19 +11267,19 @@ async function runDoctorRepo(input) {
|
|
|
11254
11267
|
const rows = [];
|
|
11255
11268
|
if (!loader.has("source")) {
|
|
11256
11269
|
const why = whyMissing(loader, "source", "no `source` provider to read the repository with");
|
|
11257
|
-
for (const check of checks) rows.push(row$
|
|
11270
|
+
for (const check of checks) rows.push(row$11(check, { skip: why }));
|
|
11258
11271
|
} else {
|
|
11259
11272
|
const source = loader.get("source");
|
|
11260
11273
|
for (const check of checks) {
|
|
11261
11274
|
if (typeof source[check.needs] !== "function") {
|
|
11262
|
-
rows.push(row$
|
|
11275
|
+
rows.push(row$11(check, { skip: `provider does not implement ${check.needs}` }));
|
|
11263
11276
|
continue;
|
|
11264
11277
|
}
|
|
11265
11278
|
try {
|
|
11266
|
-
rows.push(row$
|
|
11279
|
+
rows.push(row$11(check, await check.run(source)));
|
|
11267
11280
|
} catch (err) {
|
|
11268
11281
|
const noToken = missingTokenReason(err);
|
|
11269
|
-
if (noToken !== void 0) rows.push(row$
|
|
11282
|
+
if (noToken !== void 0) rows.push(row$11(check, { skip: noToken }));
|
|
11270
11283
|
else rows.push({
|
|
11271
11284
|
id: check.id,
|
|
11272
11285
|
title: check.title,
|
|
@@ -11292,7 +11305,7 @@ async function runDoctorRepo(input) {
|
|
|
11292
11305
|
...status === "skip" ? { reason: rows.map((r) => r.detail).join("; ") } : {}
|
|
11293
11306
|
};
|
|
11294
11307
|
}
|
|
11295
|
-
function row$
|
|
11308
|
+
function row$11(check, result) {
|
|
11296
11309
|
const { id, title } = check;
|
|
11297
11310
|
if ("skip" in result) return {
|
|
11298
11311
|
id,
|
|
@@ -11815,7 +11828,7 @@ function providerGroup(providerName) {
|
|
|
11815
11828
|
}
|
|
11816
11829
|
// src/commands/doctor-secrets/credentials-rows.ts
|
|
11817
11830
|
/** A row for the provider as a whole, or for one of its variables when `name` is given. */
|
|
11818
|
-
function row$
|
|
11831
|
+
function row$10(provider, status, detail, name) {
|
|
11819
11832
|
return name === void 0 ? {
|
|
11820
11833
|
id: provider,
|
|
11821
11834
|
title: provider,
|
|
@@ -11840,10 +11853,10 @@ async function credentialsRows(input) {
|
|
|
11840
11853
|
const { loader } = input;
|
|
11841
11854
|
const { resolved } = input.loaded;
|
|
11842
11855
|
if (!resolved.providers.credentials) return {
|
|
11843
|
-
rows: input.asked ? [row$
|
|
11856
|
+
rows: input.asked ? [row$10("credentials", "skip", "no `credentials` provider is configured")] : [],
|
|
11844
11857
|
places: []
|
|
11845
11858
|
};
|
|
11846
|
-
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$
|
|
11859
|
+
const rows = loader.loadFailures().filter((f) => f.key === "credentials").map((f) => row$10(f.provider, "fail", `failed to load: ${errorMessage(f.error)}`));
|
|
11847
11860
|
const places = [];
|
|
11848
11861
|
if (!loader.has("credentials")) return {
|
|
11849
11862
|
rows,
|
|
@@ -11855,7 +11868,7 @@ async function credentialsRows(input) {
|
|
|
11855
11868
|
const tuple = tuples.find((t) => t.provider === impl.providerName);
|
|
11856
11869
|
const explicit = tuple && credentialsEnvironment(tuple, resolved);
|
|
11857
11870
|
if (!explicit && !derivesEnvironment(impl.providerName)) {
|
|
11858
|
-
rows.push(row$
|
|
11871
|
+
rows.push(row$10(impl.providerName, "skip", "no `environment` option and `credentials.environment` is not set"));
|
|
11859
11872
|
continue;
|
|
11860
11873
|
}
|
|
11861
11874
|
try {
|
|
@@ -11867,7 +11880,7 @@ async function credentialsRows(input) {
|
|
|
11867
11880
|
rows.push(...checked.rows);
|
|
11868
11881
|
places.push(...checked.places);
|
|
11869
11882
|
} catch (err) {
|
|
11870
|
-
rows.push(row$
|
|
11883
|
+
rows.push(row$10(impl.providerName, "fail", errorMessage(err)));
|
|
11871
11884
|
}
|
|
11872
11885
|
}
|
|
11873
11886
|
return {
|
|
@@ -11883,17 +11896,17 @@ async function credentialsRows(input) {
|
|
|
11883
11896
|
async function checkProvider(impl, candidates, expected, synced) {
|
|
11884
11897
|
const provider = impl.providerName;
|
|
11885
11898
|
if (!impl.inspect) return {
|
|
11886
|
-
rows: [row$
|
|
11899
|
+
rows: [row$10(provider, "skip", "cannot list the variables without reading their values")],
|
|
11887
11900
|
places: []
|
|
11888
11901
|
};
|
|
11889
11902
|
if (expected.length === 0) return {
|
|
11890
|
-
rows: [row$
|
|
11903
|
+
rows: [row$10(provider, "skip", "no configured plugin lists the tokens it takes")],
|
|
11891
11904
|
places: []
|
|
11892
11905
|
};
|
|
11893
11906
|
const inspect = impl.inspect.bind(impl);
|
|
11894
11907
|
try {
|
|
11895
11908
|
const { found, missing } = await tryEnvironments(candidates, inspect);
|
|
11896
|
-
const rows = missing.map((name) => row$
|
|
11909
|
+
const rows = missing.map((name) => row$10(provider, "fail", `${provider} has no Environment named "${name}"`));
|
|
11897
11910
|
const group = providerGroup(provider);
|
|
11898
11911
|
const unreadPlaces = missing.map((name) => ({
|
|
11899
11912
|
column: {
|
|
@@ -11916,9 +11929,9 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
11916
11929
|
const have = (name) => found.some((f) => f.result.names.includes(name));
|
|
11917
11930
|
let present = 0;
|
|
11918
11931
|
for (const { name, optional } of expected) if (have(name)) present++;
|
|
11919
|
-
else if (optional) rows.push(row$
|
|
11920
|
-
else rows.push(row$
|
|
11921
|
-
if (present > 0) rows.push(row$
|
|
11932
|
+
else if (optional) rows.push(row$10(provider, "skip", `optional, not set in ${where}`, name));
|
|
11933
|
+
else rows.push(row$10(provider, "fail", `missing from ${where}`, name));
|
|
11934
|
+
if (present > 0) rows.push(row$10(provider, "ok", `${present} of ${expected.length} tokens present in ${where}`, "tokens"));
|
|
11922
11935
|
const names = new Set(expected.map((e) => e.name));
|
|
11923
11936
|
const places = [];
|
|
11924
11937
|
const missingRequired = expected.filter((e) => !e.optional && !have(e.name)).map((e) => e.name);
|
|
@@ -11957,7 +11970,7 @@ async function checkProvider(impl, candidates, expected, synced) {
|
|
|
11957
11970
|
};
|
|
11958
11971
|
} catch (err) {
|
|
11959
11972
|
return {
|
|
11960
|
-
rows: [row$
|
|
11973
|
+
rows: [row$10(provider, "fail", errorMessage(err))],
|
|
11961
11974
|
places: []
|
|
11962
11975
|
};
|
|
11963
11976
|
}
|
|
@@ -12831,7 +12844,7 @@ async function variableRows(loader, config, org) {
|
|
|
12831
12844
|
if (!loader.has("source")) {
|
|
12832
12845
|
const why = whyMissing(loader, "source", "no `source` provider to read them with");
|
|
12833
12846
|
for (const check of checks) {
|
|
12834
|
-
rows.push(row$
|
|
12847
|
+
rows.push(row$9(check, { skip: why }));
|
|
12835
12848
|
observations.push({
|
|
12836
12849
|
scope: check.scope,
|
|
12837
12850
|
unread: why
|
|
@@ -12841,7 +12854,7 @@ async function variableRows(loader, config, org) {
|
|
|
12841
12854
|
const source = loader.get("source");
|
|
12842
12855
|
for (const check of checks) try {
|
|
12843
12856
|
const result = await check.run(source);
|
|
12844
|
-
rows.push(row$
|
|
12857
|
+
rows.push(row$9(check, result));
|
|
12845
12858
|
observations.push("skip" in result ? {
|
|
12846
12859
|
scope: check.scope,
|
|
12847
12860
|
unread: result.skip
|
|
@@ -12852,7 +12865,7 @@ async function variableRows(loader, config, org) {
|
|
|
12852
12865
|
} catch (err) {
|
|
12853
12866
|
const noToken = missingTokenReason(err);
|
|
12854
12867
|
if (noToken !== void 0) {
|
|
12855
|
-
rows.push(row$
|
|
12868
|
+
rows.push(row$9(check, { skip: noToken }));
|
|
12856
12869
|
observations.push({
|
|
12857
12870
|
scope: check.scope,
|
|
12858
12871
|
unread: noToken
|
|
@@ -12878,7 +12891,7 @@ async function variableRows(loader, config, org) {
|
|
|
12878
12891
|
observations
|
|
12879
12892
|
};
|
|
12880
12893
|
}
|
|
12881
|
-
function row$
|
|
12894
|
+
function row$9(check, result) {
|
|
12882
12895
|
const { id, title } = check;
|
|
12883
12896
|
if ("skip" in result) return {
|
|
12884
12897
|
id,
|
|
@@ -12968,7 +12981,7 @@ function describeExpiry(expiresAt, now) {
|
|
|
12968
12981
|
*
|
|
12969
12982
|
* What a token may do is not checked: GitHub does not return a fine-grained token's permissions.
|
|
12970
12983
|
*/
|
|
12971
|
-
function row$
|
|
12984
|
+
function row$8(id, status, detail) {
|
|
12972
12985
|
return {
|
|
12973
12986
|
id: `verify:${id}`,
|
|
12974
12987
|
title: `verify ${id}`,
|
|
@@ -12996,12 +13009,12 @@ async function verifyRows(input) {
|
|
|
12996
13009
|
try {
|
|
12997
13010
|
module = await importer(pkg);
|
|
12998
13011
|
} catch (err) {
|
|
12999
|
-
rows.push(row$
|
|
13012
|
+
rows.push(row$8(pkg, "skip", `cannot load the plugin: ${errorMessage(err)}`));
|
|
13000
13013
|
continue;
|
|
13001
13014
|
}
|
|
13002
13015
|
for (const token of module.tokens ?? []) rows.push(await checkToken(token, module, env, readToken, now()));
|
|
13003
13016
|
}
|
|
13004
|
-
if (rows.length === 0) rows.push(row$
|
|
13017
|
+
if (rows.length === 0) rows.push(row$8("tokens", "skip", "no configured plugin lists the tokens it takes"));
|
|
13005
13018
|
return rows;
|
|
13006
13019
|
}
|
|
13007
13020
|
/**
|
|
@@ -13014,30 +13027,30 @@ async function loadCredentials(input) {
|
|
|
13014
13027
|
try {
|
|
13015
13028
|
await input.loader.load();
|
|
13016
13029
|
} catch (err) {
|
|
13017
|
-
return [row$
|
|
13030
|
+
return [row$8("credentials", "skip", `could not load the credentials providers: ${errorMessage(err)}`)];
|
|
13018
13031
|
}
|
|
13019
|
-
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$
|
|
13032
|
+
return input.loader.loadFailures().filter((failure) => failure.key === "credentials").map((failure) => row$8(`credentials ${failure.provider}`, "fail", `could not be read: ${errorMessage(failure.error)}`));
|
|
13020
13033
|
}
|
|
13021
13034
|
async function checkToken(token, module, env, readToken, now) {
|
|
13022
13035
|
const { keyringKey, envName, vendorEnvName } = token;
|
|
13023
13036
|
const fromEnv = env.get(envName) ? envName : vendorEnvName && env.get(vendorEnvName) ? vendorEnvName : void 0;
|
|
13024
13037
|
const stored = fromEnv ? void 0 : findCredential(...vendorEnvName ? [envName, vendorEnvName] : [envName]);
|
|
13025
13038
|
const value = fromEnv ? env.get(fromEnv) : stored?.value ?? readToken(keyringKey);
|
|
13026
|
-
if (!value) return row$
|
|
13039
|
+
if (!value) return row$8(keyringKey, "skip", `not set (${vendorEnvName ? `${envName} / ${vendorEnvName}` : envName}, or \`holocron new token ${keyringKey}\`)`);
|
|
13027
13040
|
const verify = token.verify ?? (token.verifiable === false ? void 0 : module.verifyToken);
|
|
13028
|
-
if (!verify) return row$
|
|
13041
|
+
if (!verify) return row$8(keyringKey, "skip", "set, but its plugin cannot verify it");
|
|
13029
13042
|
const from = fromEnv ?? stored?.source ?? "keyring";
|
|
13030
13043
|
try {
|
|
13031
13044
|
const verified = await verify(value);
|
|
13032
|
-
if (!verified.ok) return row$
|
|
13045
|
+
if (!verified.ok) return row$8(keyringKey, "fail", `rejected (${from}): ${verified.message}`);
|
|
13033
13046
|
const expiry = verified.expiresAt ? describeExpiry(verified.expiresAt, now) : void 0;
|
|
13034
|
-
if (!expiry) return row$
|
|
13047
|
+
if (!expiry) return row$8(keyringKey, "ok", `${verified.subject} (${from})`);
|
|
13035
13048
|
return expiry.soon ? {
|
|
13036
|
-
...row$
|
|
13049
|
+
...row$8(keyringKey, "fail", `${verified.subject} (${from}), ${expiry.text}`),
|
|
13037
13050
|
problems: [`${expiry.text}: renew it`]
|
|
13038
|
-
} : row$
|
|
13051
|
+
} : row$8(keyringKey, "ok", `${verified.subject} (${from}), ${expiry.text}`);
|
|
13039
13052
|
} catch (err) {
|
|
13040
|
-
return row$
|
|
13053
|
+
return row$8(keyringKey, "fail", `could not be verified (${from}): ${errorMessage(err)}`);
|
|
13041
13054
|
}
|
|
13042
13055
|
}
|
|
13043
13056
|
// src/commands/doctor-secrets/doctor-secrets.ts
|
|
@@ -13764,7 +13777,7 @@ function summariseProbeRows(id, title, rows) {
|
|
|
13764
13777
|
* provider with no `token` probe, no declared layer, or one that cannot be read is a skip with the reason.
|
|
13765
13778
|
*/
|
|
13766
13779
|
const PROBE = "token";
|
|
13767
|
-
const row$
|
|
13780
|
+
const row$7 = (id, title, status, detail, problems = []) => ({
|
|
13768
13781
|
id,
|
|
13769
13782
|
title,
|
|
13770
13783
|
status,
|
|
@@ -13789,12 +13802,12 @@ async function runDoctorTokens(input) {
|
|
|
13789
13802
|
try {
|
|
13790
13803
|
tokens = await providerTokens(provider);
|
|
13791
13804
|
} catch (err) {
|
|
13792
|
-
rows.push(row$
|
|
13805
|
+
rows.push(row$7(`tokens:${provider}`, provider, "skip", `could not read its tokens: ${describeError(err)}`));
|
|
13793
13806
|
continue;
|
|
13794
13807
|
}
|
|
13795
13808
|
const expectations = tokenExpectations(tokens);
|
|
13796
|
-
if (expectations.length === 0) rows.push(row$
|
|
13797
|
-
else if (!usableProbe(probes.get(provider))) rows.push(row$
|
|
13809
|
+
if (expectations.length === 0) rows.push(row$7(`tokens:${provider}`, provider, "skip", "info: declares no token layers, nothing to check"));
|
|
13810
|
+
else if (!usableProbe(probes.get(provider))) rows.push(row$7(`tokens:${provider}`, provider, "skip", `info: has no \`${PROBE}\` probe loaded, so its tokens are not checked`));
|
|
13798
13811
|
else declared.push({
|
|
13799
13812
|
provider,
|
|
13800
13813
|
tokens,
|
|
@@ -13856,14 +13869,14 @@ async function checkLayer(c) {
|
|
|
13856
13869
|
tokens
|
|
13857
13870
|
});
|
|
13858
13871
|
} catch (err) {
|
|
13859
|
-
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$
|
|
13860
|
-
return c.wanted.map((e) => row$
|
|
13872
|
+
if (err instanceof HoldsNoTokenError) return c.wanted.map((e) => row$7(id(e), title(e), "fail", "not held in this layer", [err.message]));
|
|
13873
|
+
return c.wanted.map((e) => row$7(id(e), title(e), "skip", `could not read the Environment: ${describeError(err)}`));
|
|
13861
13874
|
}
|
|
13862
13875
|
const rows = [];
|
|
13863
13876
|
for (const e of c.wanted) {
|
|
13864
13877
|
const token = held.held.find((h) => h.envName === e.envName);
|
|
13865
13878
|
if (!token) {
|
|
13866
|
-
rows.push(row$
|
|
13879
|
+
rows.push(row$7(id(e), title(e), "fail", `not held in ${held.environment}`, [`${e.envName} is declared for ${c.layer}`]));
|
|
13867
13880
|
continue;
|
|
13868
13881
|
}
|
|
13869
13882
|
rows.push(summariseProbeRows(id(e), title(e), await probeToken(c, e, token.token, held.plain)));
|
|
@@ -14789,7 +14802,7 @@ const within = (path, folder) => {
|
|
|
14789
14802
|
};
|
|
14790
14803
|
/**
|
|
14791
14804
|
* The folder one provider's export is written to: `<out>/<provider>`, where `out` is `--out`, else `.export` beside the
|
|
14792
|
-
* first of `files` (`
|
|
14805
|
+
* first of `files` (`api/.export/postman`, git-ignored; the caller passes one folder's files at a time). The folder is refused when it is, or contains, a
|
|
14793
14806
|
* source file's folder: an export never writes where the source files are, so it cannot overwrite the one source.
|
|
14794
14807
|
* A folder below the source folder is fine.
|
|
14795
14808
|
*/
|
|
@@ -14828,7 +14841,7 @@ function resolveExportDir(input) {
|
|
|
14828
14841
|
* listed under the provider's row and does not fail the run. It writes files, so it asks first unless `--dry-run` (the
|
|
14829
14842
|
* files are converted and listed, nothing is written) or `--yes` (without a terminal it refuses instead).
|
|
14830
14843
|
*/
|
|
14831
|
-
const row$
|
|
14844
|
+
const row$6 = (id, status, detail, problems = []) => ({
|
|
14832
14845
|
id,
|
|
14833
14846
|
title: id,
|
|
14834
14847
|
status,
|
|
@@ -14836,7 +14849,7 @@ const row$5 = (id, status, detail, problems = []) => ({
|
|
|
14836
14849
|
problems
|
|
14837
14850
|
});
|
|
14838
14851
|
/** A provider option that is a list of file names; anything else reads as none. */
|
|
14839
|
-
const fileList = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
14852
|
+
const fileList$1 = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
14840
14853
|
/** The collection files grouped by the folder they sit in, in the order the folders first appear. */
|
|
14841
14854
|
function groupByFolder(files) {
|
|
14842
14855
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -14870,9 +14883,9 @@ async function runRequestsExport(input) {
|
|
|
14870
14883
|
print("");
|
|
14871
14884
|
const entry = input.loaded.resolved.providers.tooling;
|
|
14872
14885
|
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
14873
|
-
if (tuples.length === 0) return finish([row$
|
|
14886
|
+
if (tuples.length === 0) return finish([row$6("tooling", "fail", "the config has no `tooling` provider to export for")]);
|
|
14874
14887
|
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
14875
|
-
if (chosen.length === 0) return finish([row$
|
|
14888
|
+
if (chosen.length === 0) return finish([row$6(input.to, "fail", `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`)]);
|
|
14876
14889
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
14877
14890
|
const loader = input.loader ?? new PluginLoader({
|
|
14878
14891
|
...input.loaded.resolved,
|
|
@@ -14892,17 +14905,17 @@ async function runRequestsExport(input) {
|
|
|
14892
14905
|
const tool = loaded.find((t) => t.providerName === id);
|
|
14893
14906
|
if (!tool) {
|
|
14894
14907
|
const failure = loader.loadFailures().find((f) => f.key === "tooling" && f.provider === id);
|
|
14895
|
-
rows.push(row$
|
|
14908
|
+
rows.push(row$6(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
|
|
14896
14909
|
continue;
|
|
14897
14910
|
}
|
|
14898
14911
|
if (!tool.export) {
|
|
14899
|
-
rows.push(row$
|
|
14912
|
+
rows.push(row$6(id, "skip", "has no export: it reads the repo's files as they are"));
|
|
14900
14913
|
continue;
|
|
14901
14914
|
}
|
|
14902
|
-
const collectionFiles = fileList(tuple.options.collectionFiles);
|
|
14903
|
-
const envFiles = fileList(tuple.options.envFiles);
|
|
14915
|
+
const collectionFiles = fileList$1(tuple.options.collectionFiles);
|
|
14916
|
+
const envFiles = fileList$1(tuple.options.envFiles);
|
|
14904
14917
|
if (collectionFiles.length === 0) {
|
|
14905
|
-
rows.push(row$
|
|
14918
|
+
rows.push(row$6(id, "skip", "names no `collectionFiles`, so there is nothing to export"));
|
|
14906
14919
|
continue;
|
|
14907
14920
|
}
|
|
14908
14921
|
const groups = input.out === void 0 ? groupByFolder(collectionFiles) : [collectionFiles];
|
|
@@ -14916,7 +14929,7 @@ async function runRequestsExport(input) {
|
|
|
14916
14929
|
...input.out !== void 0 ? { out: input.out } : {}
|
|
14917
14930
|
});
|
|
14918
14931
|
if (!dir.ok) {
|
|
14919
|
-
rows.push(row$
|
|
14932
|
+
rows.push(row$6(label, "fail", dir.message));
|
|
14920
14933
|
continue;
|
|
14921
14934
|
}
|
|
14922
14935
|
targets.push({
|
|
@@ -14955,9 +14968,9 @@ async function runRequestsExport(input) {
|
|
|
14955
14968
|
const where = relative(repoRoot, outDir);
|
|
14956
14969
|
const files = result.files.length > 0 ? ` (${result.files.join(", ")})` : "";
|
|
14957
14970
|
paths.push(...result.files.map((file) => resolve(outDir, file)));
|
|
14958
|
-
rows.push(row$
|
|
14971
|
+
rows.push(row$6(label, "ok", `${dryRun ? "would write" : "wrote"} ${result.files.length} file(s) to ${where}${files}`, result.issues.map((issue) => `issue in ${issue.file}: ${issue.message}`)));
|
|
14959
14972
|
} catch (err) {
|
|
14960
|
-
rows.push(row$
|
|
14973
|
+
rows.push(row$6(label, "fail", describeError(err)));
|
|
14961
14974
|
}
|
|
14962
14975
|
const report = finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
14963
14976
|
if (paths.length > 0) {
|
|
@@ -15056,7 +15069,7 @@ function coverageConfigFiles(input) {
|
|
|
15056
15069
|
};
|
|
15057
15070
|
}
|
|
15058
15071
|
// ../../.holocron/org.md
|
|
15059
|
-
var org_default = "<!-- editorconfig-checker-disable-file -->\n\n# theholocron — agent operating contract\n\nOrg-level agent conventions for all `theholocron` repositories. The canonical\ncopy is `.holocron/org.md` in `theholocron/holocron`. `holocron sync` writes\nit into each repo's `AGENTS.md` between generated markers, so no repo needs a\nsibling checkout to read it; holocron itself imports it with `@.holocron/org.md`.\nEdit it in holocron, then run `holocron sync`.\n\n## Repo map\n\nEach concern lives in exactly one repo:\n\n| Concern | Repo |\n| ----------------------------------------------------------------- | ----------------------------------------- |\n| Shareable tool config (ESLint, Prettier, TSConfig, Vitest, …) | `theholocron/holocron` (`configs/`) |\n| HTTP clients and API wrappers | `theholocron/holocron` (`clients/`) |\n| Infrastructure automation, CI orchestration, repo lifecycle | `theholocron/holocron` |\n| Org-level CI workflows, composite actions, community health files | `theholocron/.github` |\n| Internal member docs and private org config | `theholocron/.github-private` (this repo) |\n| Shared agent skills registry | `theholocron/holocron` (`skills/`) |\n\nIf you find yourself copy-pasting a tool config across repos, it belongs in\nthe `configs/` folder of `theholocron/holocron`. If you find yourself writing a new\nautomation command, it belongs in `holocron` too. Generic helpers (`utils/`) and\nobservability (`observability/`) live in that monorepo as well.\n\n### `holocron.config` format\n\n- Repos **with** a `package.json` → `holocron.config.ts` with `defineConfig`\n from `@theholocron/cli`. The CLI must be resolvable at runtime for the TS\n format to work.\n- Repos **without** a `package.json` (e.g. `.github`, `.github-private`) →\n `holocron.config.json`.\n\n## Workflow\n\n- **Always open a PR — never push directly to the default branch.** Even for\n small fixes: create a branch, push it, open a PR. This lets CI run, keeps\n history reviewable, and respects branch protection. The only exception is\n bootstrapping a brand-new repo before protection is set up.\n- **Conventional Commits.** `feat:` / `fix:` / `chore:` / `docs:` / `ci:` /\n `test:` / `refactor:` / `perf:` — semantic-release uses these for versioning\n and changelogs. Repos without a release step use the subset relevant to them.\n- **Always `git commit -s`** (DCO). The `Signed-off-by:` trailer is required\n on every commit. `-s` generates it automatically from `git config user.name`\n and `user.email`.\n- **Always rebase, never merge `main`.** Use `git rebase origin/main` to keep a\n branch current. `git merge main` creates an unsigned merge commit and drags bot\n commits into the PR history — both trigger DCO check failures.\n- **No Claude attribution** in commits, PRs, issues, or docs. No\n `Co-Authored-By` trailer. The author is the user.\n- **One PR = one focused change.** Squash-merge; the PR title becomes the\n squashed commit subject that semantic-release reads.\n- **File issues for non-trivial work** and reference them in commits/PRs\n (`Closes #N` / `Refs #N`). Skip for typo fixes.\n- **Spec process: Issue before spec.** Before writing a spec file, file an issue\n first, in the tracker the config's `issues` provider names (GitHub when the\n config sets no `issues` provider). The issue is the durable tracking artifact.\n The spec's frontmatter `issue:` field must reference it. Order: Issue → Spec →\n PR → Review → merge.\n- **Reference the issue in that tracker's syntax** in commits and the PR: `Closes #N`\n / `Refs #N` for GitHub, the issue key (`Closes ENG-42` / `Refs ENG-42`) for Linear.\n\n## Before starting any coding task\n\n1. Verify you are on a feature branch, not `main`. If on `main`, create a branch\n first. Never commit directly to `main`. If on an existing feature branch, run\n `git fetch origin && git rebase origin/main` to ensure it has the latest from\n `main` — never start work on a stale branch.\n2. Any PR that adds new behavior must include tests and documentation in the same\n PR. Do not open docs-only or test-only follow-up PRs — tests and docs ship with\n the feature. This applies to new packages, capabilities, commands, APIs, and\n any observable behavior change.\n3. If adding a new client or plugin package, update the docs-theme registry in\n the same PR or a cleanly scoped immediate follow-up.\n4. One PR per logical change. Do not bundle unrelated fixes with a feature.\n\n## After completing any coding task\n\n1. Confirm you are still on the intended feature branch.\n2. Confirm all checklist items in any invoked skill are complete.\n3. Confirm CI is green before requesting review.\n\n## CI workflows\n\nAll reusable workflow implementations and composite actions **live as source in\n`theholocron/holocron` — `packages/astromech/src/templates/reusable/`** and are\ngenerated + pushed to `theholocron/.github` by `holocron sync github`.\n**`theholocron/.github` and `.github-private` are pure sync targets** — never\nhand-edit their `.github/workflows/*`, `.github/actions/*` or\n`workflow-templates/*`; edit the source in `holocron` and merge.\n\nEvery other repo (`configs`, `clients`, `holocron`, `.github-private`) gets\n**thin callers** — lightweight `.github/workflows/` files that delegate to\n`.github` via `uses: theholocron/.github/.github/workflows/<name>.yml@main` and\n`secrets: inherit`. Thin callers are generated from the manifest by\n`astromech.thinCallers()` (`holocron sync` / `holocron setup`).\n\n### Sync\n\nThe `sync-workflow-templates` workflow in `theholocron/holocron` keeps thin\ncallers up to date. It runs automatically on push to `main` when\n`packages/cli/src/templates/**` or `packages/astromech/src/templates/**` change.\nChanges to other parts of the sync machinery (e.g. `sync-github.ts`) require a\nmanual dispatch:\n\n```sh\ngh workflow run sync-workflow-templates.yml --repo theholocron/holocron --ref main\n```\n\n### Per-repo task list\n\nEach secondary repo controls which tasks (and their CI workflows) it\nreceives — and can supply per-task `with:` overrides — via the `tasks`\narray in its `holocron.config.ts` (or `holocron.config.json`).\n`@theholocron/astromech` reads it as the single source for `holocron run`\n/ `holocron run ci` / the generated workflow thin callers:\n\n```typescript\ntasks: [\"lint\", { name: \"release\", with: { \"run-build\": false } }];\n```\n\nOnly add a task if the corresponding capability exists in the repo:\n\n| Task | Requires |\n| ------------- | ------------------------------------------------- |\n| `test` | vitest suite with `--coverage` |\n| `typecheck` | TypeScript (`pnpm typecheck` script) |\n| `audit` | a bundle build step (`pnpm build` script) |\n| `sync-github` | `packages/cli/src/templates/**` — `holocron` only |\n\n### Release workflow — npm prefix and registry-url\n\n**Never run `npm config set prefix <path>` in a release workflow.** It writes\n`prefix=<path>` to `~/.npmrc`, which pnpm reads for npm configuration. With a\nnon-default prefix set, pnpm cannot locate the registry auth it needs to perform\nthe GitHub OIDC token exchange and fails with `ENEEDAUTH` — even when Trusted\nPublishers are correctly configured on npmjs.com.\n\nNode.js from `hostedtoolcache` already provides a user-writable npm prefix on\nPATH. Run `npm install -g <pkg>` directly.\n\n**Never cache `~/.npm-global` or any npm global directory in release workflows.**\nA stale cache restores old auth config that poisons the OIDC exchange.\n\n**Never set `registry-url` in the shared `setup-node` composite action.** It\ncauses `actions/setup-node` to write `//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}`\nto a temp `.npmrc` and set `NPM_CONFIG_USERCONFIG` pointing at it. pnpm then\nreads that file, fails env-var substitution when the token is empty, and loses\nauth entirely.\n\nThe reference implementation is `theholocron/holocron`'s own release workflow —\nno prefix step, no cache, no `registry-url`.\n\n### Discarding a bad sync PR\n\n**Delete the branch, don't only close the PR.** A closed-but-existing branch\nblocks future PR creation — GitHub returns 422 \"A pull request already exists\"\nand the sync silently skips opening a new one.\n\n```sh\ngh pr close <n> --repo <owner>/<repo> --delete-branch\n```\n\n## Code standards\n\n### Package manager\n\n**pnpm only.** Never use `npm` or `yarn`. Run workspace-wide tasks through\nTurbo (`pnpm test`, `pnpm build`, etc.); run single-package tasks with\n`pnpm --filter <name> <script>`.\n\n### TypeScript\n\n**No `any`.** Use `unknown` for values of genuinely unknown shape and narrow\nwith type guards. Use generics instead of `any` in function signatures.\n`as never` and `as unknown as T` are acceptable for internal casts where the\ntype system can't follow; `any` is not.\n\n### Node.js version\n\n`engines.node` must be set in every `package.json`. To update the Node.js\nversion across a repo run `holocron upgrade node <to>` from any repo that has\nthe CLI installed — it patches `engines.node`, `@types/node`, `.nvmrc`,\n`.node-version`, and `.github/workflows/*.yml` automatically.\n\n### `.alexrc.json`\n\n**Generated by `holocron setup` — do not edit manually.** The canonical\nallow-list lives in `ALEX_CONFIG` in\n`theholocron/holocron · packages/cli/src/inclusive-language/config.ts`. To\nallow a new term across all repos: edit that constant, open a PR in\n`holocron`, merge, then re-run `holocron setup` in each consuming repo.\n\n### Running `holocron setup`\n\nInstall `@theholocron/cli` and `@theholocron/holocron-plugin-github` under\n`catalogs.holocron` in `pnpm-workspace.yaml`:\n\n```yaml\ncatalogs:\n holocron:\n \"@theholocron/cli\": <version>\n \"@theholocron/holocron-plugin-github\": <version>\n```\n\nThen run:\n\n```sh\nGITHUB_TOKEN=$(gh auth token) \\\nHOLOCRON_ORG_TOKEN=$(security find-generic-password -s \"com.theholocron.cli\" -a \"github.org\" -w) \\\npnpm exec holocron setup --token $(security find-generic-password -s \"com.theholocron.cli\" -a \"github.admin\" -w)\n```\n\nAll tokens are stored in the macOS keychain under service `com.theholocron.cli`. See `docs/tokens.md` in the `holocron` repo for the full token matrix and required scopes.\n\nBump both catalog entries together when upgrading — they publish in lockstep.\n\n### README structure\n\nEvery repo README follows this layout. Use `holocron sync readme` to regenerate the Installation + Usage block automatically.\n\n```markdown\n# Package Name\n\n<!-- holocron:description -->\n\nOne-line description (synced from holocron.config.ts description field).\n<!-- /holocron:description -->\n\n<!-- holocron:installation -->\n\n## Installation\n\n...generated from package.json bin / exports...\n\n## Usage\n\n...generated from package.json bin / exports...\n<!-- /holocron:installation -->\n\n## What's Included ← template repos only; omit for libraries\n\n...feature table...\n\n## Development\n\npnpm scripts table or code block\n\n## Releases\n\nAutomated via semantic-release. Link to CHANGELOG.md.\n\n## Documentation\n\nLink to docs site.\n```\n\n**Rules:**\n\n- Never write \"Getting Started\" — use separate \"Installation\" and \"Usage\" headings.\n- The `<!-- holocron:description -->` and `<!-- holocron:installation -->` marker blocks must stay in sync with the config/package; run `holocron sync readme` after changing `description` in `holocron.config.ts` or `bin` in `package.json`.\n- The \"What's Included\" section belongs only in template repos (cli-template, node-template, react-template, etc.) where it describes what the template ships. Library and app repos omit it.\n\n---\n\n## This repo (`.github-private`)\n\n> **Local path:** `~/Code/theholocron/github-private/`\n> **GitHub repo:** `theholocron/.github-private`\n\nInternal member documentation and private org-level configuration for the\n`theholocron` org. Content here is only visible to org members.\n\nConventional Commit types used here: `docs:` for content changes, `ci:` for\nworkflow changes, `chore:` for maintenance.\n\nNo test suite (documentation repo). `pnpm lint` runs `yamllint` on workflow\nfiles. Branch protection on `main` requires DCO and passing CI checks.\n";
|
|
15072
|
+
var org_default = "<!-- editorconfig-checker-disable-file -->\n\n# theholocron — agent operating contract\n\nOrg-level agent conventions for all `theholocron` repositories. The canonical\ncopy is `.holocron/org.md` in `theholocron/holocron`. `holocron sync` writes\nit into each repo's `AGENTS.md` between generated markers, so no repo needs a\nsibling checkout to read it; holocron itself imports it with `@.holocron/org.md`.\nEdit it in holocron, then run `holocron sync`.\n\n## Repo map\n\nEach concern lives in exactly one repo:\n\n| Concern | Repo |\n| ----------------------------------------------------------------- | ----------------------------------------- |\n| Shareable tool config (ESLint, Prettier, TSConfig, Vitest, …) | `theholocron/holocron` (`configs/`) |\n| HTTP clients and API wrappers | `theholocron/holocron` (`clients/`) |\n| Infrastructure automation, CI orchestration, repo lifecycle | `theholocron/holocron` |\n| Org-level CI workflows, composite actions, community health files | `theholocron/.github` |\n| Internal member docs and private org config | `theholocron/.github-private` (this repo) |\n| Shared agent skills registry | `theholocron/holocron` (`skills/`) |\n\nIf you find yourself copy-pasting a tool config across repos, it belongs in\nthe `configs/` folder of `theholocron/holocron`. If you find yourself writing a new\nautomation command, it belongs in `holocron` too. Generic helpers (`utils/`) and\nobservability (`observability/`) live in that monorepo as well.\n\n### `holocron.config` format\n\n- Repos **with** a `package.json` → `holocron.config.ts` with `defineConfig`\n from `@theholocron/cli`. The CLI must be resolvable at runtime for the TS\n format to work.\n- Repos **without** a `package.json` (e.g. `.github`, `.github-private`) →\n `holocron.config.json`.\n\n## Workflow\n\n- **Always open a PR — never push directly to the default branch.** Even for\n small fixes: create a branch, push it, open a PR. This lets CI run, keeps\n history reviewable, and respects branch protection. The only exception is\n bootstrapping a brand-new repo before protection is set up.\n- **Conventional Commits.** `feat:` / `fix:` / `chore:` / `docs:` / `ci:` /\n `test:` / `refactor:` / `perf:` — semantic-release uses these for versioning\n and changelogs. Repos without a release step use the subset relevant to them.\n- **Always `git commit -s`** (DCO). The `Signed-off-by:` trailer is required\n on every commit. `-s` generates it automatically from `git config user.name`\n and `user.email`.\n- **Always rebase, never merge `main`.** Use `git rebase origin/main` to keep a\n branch current. `git merge main` creates an unsigned merge commit and drags bot\n commits into the PR history — both trigger DCO check failures.\n- **No Claude attribution** in commits, PRs, issues, or docs. No\n `Co-Authored-By` trailer. The author is the user.\n- **One PR = one focused change.** Squash-merge; the PR title becomes the\n squashed commit subject that semantic-release reads.\n- **File issues for non-trivial work** and reference them in commits/PRs\n (`Closes #N` / `Refs #N`). Skip for typo fixes.\n- **Spec process: Issue before spec.** Before writing a spec file, file an issue\n first, in the tracker the config's `issues` provider names (GitHub when the\n config sets no `issues` provider). The issue is the durable tracking artifact.\n The spec's frontmatter `issue:` field must reference it. Order: Issue → Spec →\n PR → Review → merge.\n- **Reference the issue in that tracker's syntax** in commits and the PR: `Closes #N`\n / `Refs #N` for GitHub, the issue key (`Closes ENG-42` / `Refs ENG-42`) for Linear.\n\n## Before starting any coding task\n\n1. Verify you are on a feature branch, not `main`. If on `main`, create a branch\n first. Never commit directly to `main`. If on an existing feature branch, run\n `git fetch origin && git rebase origin/main` to ensure it has the latest from\n `main` — never start work on a stale branch.\n2. Any PR that adds new behavior must include tests and documentation in the same\n PR. Do not open docs-only or test-only follow-up PRs — tests and docs ship with\n the feature. This applies to new packages, capabilities, commands, APIs, and\n any observable behavior change.\n3. If adding a new client or plugin package, update the docs-theme registry in\n the same PR or a cleanly scoped immediate follow-up.\n4. One PR per logical change. Do not bundle unrelated fixes with a feature.\n\n## After completing any coding task\n\n1. Confirm you are still on the intended feature branch.\n2. Confirm all checklist items in any invoked skill are complete.\n3. Confirm CI is green before requesting review.\n\n## CI workflows\n\nAll reusable workflow implementations and composite actions **live as source in\n`theholocron/holocron` — `packages/astromech/src/templates/reusable/`** and are\ngenerated + pushed to `theholocron/.github` by `holocron sync github`.\n**`theholocron/.github` and `.github-private` are pure sync targets** — never\nhand-edit their `.github/workflows/*`, `.github/actions/*` or\n`workflow-templates/*`; edit the source in `holocron` and merge.\n\nEvery other repo (`configs`, `clients`, `holocron`, `.github-private`) gets\n**thin callers** — lightweight `.github/workflows/` files that delegate to\n`.github` via `uses: theholocron/.github/.github/workflows/<name>.yml@main` and\n`secrets: inherit`. Thin callers are generated from the manifest by\n`astromech.thinCallers()` (`holocron sync` / `holocron setup`).\n\n### Sync\n\nThe `sync-workflow-templates` workflow in `theholocron/holocron` keeps thin\ncallers up to date. It runs automatically on push to `main` when\n`packages/cli/src/templates/**` or `packages/astromech/src/templates/**` change.\nChanges to other parts of the sync machinery (e.g. `sync-github.ts`) require a\nmanual dispatch:\n\n```sh\ngh workflow run sync-workflow-templates.yml --repo theholocron/holocron --ref main\n```\n\n### Per-repo task list\n\nEach secondary repo controls which tasks (and their CI workflows) it\nreceives — and can supply per-task `with:` overrides — via the `tasks`\narray in its `holocron.config.ts` (or `holocron.config.json`).\n`@theholocron/astromech` reads it as the single source for `holocron run`\n/ `holocron run ci` / the generated workflow thin callers:\n\n```typescript\ntasks: [\"lint\", { name: \"release\", with: { \"run-build\": false } }];\n```\n\nOnly add a task if the corresponding capability exists in the repo:\n\n| Task | Requires |\n| ------------- | ------------------------------------------------- |\n| `test` | vitest suite with `--coverage` |\n| `typecheck` | TypeScript (`pnpm typecheck` script) |\n| `audit` | a bundle build step (`pnpm build` script) |\n| `sync-github` | `packages/cli/src/templates/**` — `holocron` only |\n\n### Release workflow — npm prefix and registry-url\n\n**Never run `npm config set prefix <path>` in a release workflow.** It writes\n`prefix=<path>` to `~/.npmrc`, which pnpm reads for npm configuration. With a\nnon-default prefix set, pnpm cannot locate the registry auth it needs to perform\nthe GitHub OIDC token exchange and fails with `ENEEDAUTH` — even when Trusted\nPublishers are correctly configured on npmjs.com.\n\nNode.js from `hostedtoolcache` already provides a user-writable npm prefix on\nPATH. Run `npm install -g <pkg>` directly.\n\n**Never cache `~/.npm-global` or any npm global directory in release workflows.**\nA stale cache restores old auth config that poisons the OIDC exchange.\n\n**Never set `registry-url` in the shared `setup-node` composite action.** It\ncauses `actions/setup-node` to write `//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}`\nto a temp `.npmrc` and set `NPM_CONFIG_USERCONFIG` pointing at it. pnpm then\nreads that file, fails env-var substitution when the token is empty, and loses\nauth entirely.\n\nThe reference implementation is `theholocron/holocron`'s own release workflow —\nno prefix step, no cache, no `registry-url`.\n\n### Discarding a bad sync PR\n\n**Delete the branch, don't only close the PR.** A closed-but-existing branch\nblocks future PR creation — GitHub returns 422 \"A pull request already exists\"\nand the sync silently skips opening a new one.\n\n```sh\ngh pr close <n> --repo <owner>/<repo> --delete-branch\n```\n\n## Code standards\n\n### Package manager\n\n**pnpm only.** Never use `npm` or `yarn`. Run workspace-wide tasks through\nTurbo (`pnpm test`, `pnpm build`, etc.); run single-package tasks with\n`pnpm --filter <name> <script>`.\n\n### TypeScript\n\n**No `any`.** Use `unknown` for values of genuinely unknown shape and narrow\nwith type guards. Use generics instead of `any` in function signatures.\n`as never` and `as unknown as T` are acceptable for internal casts where the\ntype system can't follow; `any` is not.\n\n### Node.js version\n\n`engines.node` must be set in every `package.json`. To update the Node.js\nversion across a repo run `holocron upgrade node <to>` from any repo that has\nthe CLI installed — it patches `engines.node`, `@types/node`, `.nvmrc`,\n`.node-version`, and `.github/workflows/*.yml` automatically.\n\n### Inclusive language (`alex`)\n\n`holocron setup` no longer writes `.alexrc.json` or `.alexignore` (#831). The\ncheck is Sentinel's `lint:language / Run alex`, which reads the org's own\nallow-list, `alexrc.json` in `theholocron/holocron · cli/astromech/src/lint/alex-config/`\n(`ALEX_CONFIG`). To allow a new term across all repos: edit that file, open a PR\nin `holocron`, merge; Sentinel uses it after its next deploy. A repo that still\nhas the two files from an earlier setup can delete them; nothing reads them.\n\n### Running `holocron setup`\n\nInstall `@theholocron/cli` and `@theholocron/holocron-plugin-github` under\n`catalogs.holocron` in `pnpm-workspace.yaml`:\n\n```yaml\ncatalogs:\n holocron:\n \"@theholocron/cli\": <version>\n \"@theholocron/holocron-plugin-github\": <version>\n```\n\nThen run:\n\n```sh\nGITHUB_TOKEN=$(gh auth token) \\\nHOLOCRON_ORG_TOKEN=$(security find-generic-password -s \"com.theholocron.cli\" -a \"github.org\" -w) \\\npnpm exec holocron setup --token $(security find-generic-password -s \"com.theholocron.cli\" -a \"github.admin\" -w)\n```\n\nAll tokens are stored in the macOS keychain under service `com.theholocron.cli`. See `docs/tokens.md` in the `holocron` repo for the full token matrix and required scopes.\n\nBump both catalog entries together when upgrading — they publish in lockstep.\n\n### README structure\n\nEvery repo README follows this layout. Use `holocron sync readme` to regenerate the Installation + Usage block automatically.\n\n```markdown\n# Package Name\n\n<!-- holocron:description -->\n\nOne-line description (synced from holocron.config.ts description field).\n<!-- /holocron:description -->\n\n<!-- holocron:installation -->\n\n## Installation\n\n...generated from package.json bin / exports...\n\n## Usage\n\n...generated from package.json bin / exports...\n<!-- /holocron:installation -->\n\n## What's Included ← template repos only; omit for libraries\n\n...feature table...\n\n## Development\n\npnpm scripts table or code block\n\n## Releases\n\nAutomated via semantic-release. Link to CHANGELOG.md.\n\n## Documentation\n\nLink to docs site.\n```\n\n**Rules:**\n\n- Never write \"Getting Started\" — use separate \"Installation\" and \"Usage\" headings.\n- The `<!-- holocron:description -->` and `<!-- holocron:installation -->` marker blocks must stay in sync with the config/package; run `holocron sync readme` after changing `description` in `holocron.config.ts` or `bin` in `package.json`.\n- The \"What's Included\" section belongs only in template repos (cli-template, node-template, react-template, etc.) where it describes what the template ships. Library and app repos omit it.\n\n---\n\n## This repo (`.github-private`)\n\n> **Local path:** `~/Code/theholocron/github-private/`\n> **GitHub repo:** `theholocron/.github-private`\n\nInternal member documentation and private org-level configuration for the\n`theholocron` org. Content here is only visible to org members.\n\nConventional Commit types used here: `docs:` for content changes, `ci:` for\nworkflow changes, `chore:` for maintenance.\n\nNo test suite (documentation repo). `pnpm lint` runs `yamllint` on workflow\nfiles. Branch protection on `main` requires DCO and passing CI checks.\n";
|
|
15060
15073
|
// src/commands/repo-files/generate-agent-files.ts
|
|
15061
15074
|
const ORG_BLOCK_BEGIN = "<!-- BEGIN holocron org agent instructions (generated by `holocron sync` from theholocron/holocron .agents/org.md; do not edit) -->";
|
|
15062
15075
|
const ORG_BLOCK_END = "<!-- END holocron org agent instructions -->";
|
|
@@ -15264,7 +15277,7 @@ function coverageConfigEntries(input, taskNames) {
|
|
|
15264
15277
|
return Object.entries(files).map(([path, content]) => !hasTests && !existsSync(join(input.repoRoot, path)) ? skip(`write ${path}`, "no test workflow configured") : file(path, content));
|
|
15265
15278
|
}
|
|
15266
15279
|
/**
|
|
15267
|
-
* The config files that are not workflows: the labeler
|
|
15280
|
+
* The config files that are not workflows: the labeler and Dependabot configs, the lint and editor configs, the
|
|
15268
15281
|
* git hooks and the coverage provider's config (`codecov.yml`), in the order `setup` writes them.
|
|
15269
15282
|
*/
|
|
15270
15283
|
function generateConfigFiles(input) {
|
|
@@ -15275,8 +15288,8 @@ function generateConfigFiles(input) {
|
|
|
15275
15288
|
if (config.repo?.protection !== "none") entries.push(file(".github/dependabot.yml", createDependabot({
|
|
15276
15289
|
ignore: ownCatalogPackages(input.repoRoot),
|
|
15277
15290
|
sources: hostsReusables(input.repoRoot) ? HOSTED_SOURCES : []
|
|
15278
|
-
}))
|
|
15279
|
-
entries.push(file(".
|
|
15291
|
+
})));
|
|
15292
|
+
entries.push(file(".yamllint.yml", createYamllint()), file(".yamlignore", createYamlignore()), file(".editorconfig", createEditorconfig()), file(".editorconfig-checker.json", createEditorconfigChecker()), file("devmoji.config.cjs", createDevmoji()), file(".husky/prepare-commit-msg", createPrepareCommitMsg()), file(".husky/commit-msg", createCommitMsg(config.holocronScript)));
|
|
15280
15293
|
if (hooksEnabled(input)) entries.push(file(".husky/pre-push", createPrePush(config.holocronScript), "runs `holocron run ci` before push — bypass with `git push --no-verify`"), file(".husky/pre-commit", createPreCommit(), "runs GitLeaks (staged-only) + lint-staged before commit"));
|
|
15281
15294
|
else for (const hook of [".husky/pre-push", ".husky/pre-commit"]) entries.push({
|
|
15282
15295
|
kind: "skip",
|
|
@@ -18458,7 +18471,7 @@ function specName(title, name) {
|
|
|
18458
18471
|
*/
|
|
18459
18472
|
/** How many lines of the spec a dry run shows. */
|
|
18460
18473
|
const PREVIEW_LINES$1 = 12;
|
|
18461
|
-
const row$
|
|
18474
|
+
const row$5 = (id, status, detail) => ({
|
|
18462
18475
|
id,
|
|
18463
18476
|
title: id,
|
|
18464
18477
|
status,
|
|
@@ -18488,7 +18501,7 @@ async function runIdeasPromote(input) {
|
|
|
18488
18501
|
print(style.header(`Holocron new spec${dryRun ? " (dry-run)" : ""}`));
|
|
18489
18502
|
print("");
|
|
18490
18503
|
const entry = input.loaded.resolved.providers.issues;
|
|
18491
|
-
if (!entry) return finish([row$
|
|
18504
|
+
if (!entry) return finish([row$5(input.issue, "fail", "the config has no `issues` provider to read the issue with")]);
|
|
18492
18505
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
18493
18506
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
18494
18507
|
const loader = input.loader ?? new PluginLoader({
|
|
@@ -18503,18 +18516,18 @@ async function runIdeasPromote(input) {
|
|
|
18503
18516
|
assertPluginsResolvable(loader, "new spec");
|
|
18504
18517
|
if (!loader.has("issues")) {
|
|
18505
18518
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
18506
|
-
return finish([row$
|
|
18519
|
+
return finish([row$5(input.issue, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
18507
18520
|
}
|
|
18508
18521
|
let issue;
|
|
18509
18522
|
try {
|
|
18510
18523
|
issue = await loader.get("issues").get(input.issue);
|
|
18511
18524
|
} catch (err) {
|
|
18512
|
-
return finish([row$
|
|
18525
|
+
return finish([row$5(input.issue, "fail", `could not read the issue: ${describeError(err)}`)]);
|
|
18513
18526
|
}
|
|
18514
18527
|
const name = specName(issue.summary, input.name);
|
|
18515
|
-
if (!name) return finish([row$
|
|
18528
|
+
if (!name) return finish([row$5(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`)]);
|
|
18516
18529
|
const relative = join(".notes", `${name}.spec.md`);
|
|
18517
|
-
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$
|
|
18530
|
+
if (io.exists(join(input.context.repoRoot, relative))) return finish([row$5(relative, "fail", "the spec already exists; it is never overwritten")], relative);
|
|
18518
18531
|
const { org, name: repoName } = input.loaded.resolved;
|
|
18519
18532
|
const ref = githubRef(issue.url) ?? (issue.key.startsWith("#") ? `${org}/${repoName}${issue.key}` : issue.key);
|
|
18520
18533
|
const { content, fromIdea } = buildSpec({
|
|
@@ -18527,7 +18540,7 @@ async function runIdeasPromote(input) {
|
|
|
18527
18540
|
print(` ${relative}`);
|
|
18528
18541
|
for (const line of content.split("\n").slice(0, PREVIEW_LINES$1)) print(` ${style.skip(line)}`);
|
|
18529
18542
|
print("");
|
|
18530
|
-
return finish([row$
|
|
18543
|
+
return finish([row$5(relative, "skip", `would write the spec ${origin}`)], relative);
|
|
18531
18544
|
}
|
|
18532
18545
|
if (!input.yes) {
|
|
18533
18546
|
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`);
|
|
@@ -18546,9 +18559,9 @@ async function runIdeasPromote(input) {
|
|
|
18546
18559
|
try {
|
|
18547
18560
|
io.write(join(input.context.repoRoot, relative), content);
|
|
18548
18561
|
} catch (err) {
|
|
18549
|
-
return finish([row$
|
|
18562
|
+
return finish([row$5(relative, "fail", `could not write the spec: ${describeError(err)}`)], relative);
|
|
18550
18563
|
}
|
|
18551
|
-
return finish([row$
|
|
18564
|
+
return finish([row$5(relative, "ok", `wrote the spec ${origin}`)], relative);
|
|
18552
18565
|
}
|
|
18553
18566
|
// src/commands/ideas-promote/ideas-promote.command.ts
|
|
18554
18567
|
const ideasPromoteCommand = {
|
|
@@ -18594,7 +18607,7 @@ const ideasPromoteCommand = {
|
|
|
18594
18607
|
*/
|
|
18595
18608
|
/** How many lines of the body a dry run shows. */
|
|
18596
18609
|
const PREVIEW_LINES = 8;
|
|
18597
|
-
const row$
|
|
18610
|
+
const row$4 = (id, status, detail) => ({
|
|
18598
18611
|
id,
|
|
18599
18612
|
title: id,
|
|
18600
18613
|
status,
|
|
@@ -18618,9 +18631,9 @@ async function runIssueCreate(input) {
|
|
|
18618
18631
|
print(style.header(`Holocron new issue${dryRun ? " (dry-run)" : ""}`));
|
|
18619
18632
|
print("");
|
|
18620
18633
|
const title = input.title.trim();
|
|
18621
|
-
if (!title) return finish([row$
|
|
18634
|
+
if (!title) return finish([row$4("title", "fail", "the title is empty")]);
|
|
18622
18635
|
const entry = input.loaded.resolved.providers.issues;
|
|
18623
|
-
if (!entry) return finish([row$
|
|
18636
|
+
if (!entry) return finish([row$4(title, "fail", "the config has no `issues` provider to file the issue with")]);
|
|
18624
18637
|
const credentials = input.loaded.resolved.providers.credentials;
|
|
18625
18638
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
18626
18639
|
const loader = input.loader ?? new PluginLoader({
|
|
@@ -18635,7 +18648,7 @@ async function runIssueCreate(input) {
|
|
|
18635
18648
|
assertPluginsResolvable(loader, "new issue");
|
|
18636
18649
|
if (!loader.has("issues")) {
|
|
18637
18650
|
const failure = loader.loadFailures().find((f) => f.key === "issues");
|
|
18638
|
-
return finish([row$
|
|
18651
|
+
return finish([row$4(title, "fail", `the \`issues\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
18639
18652
|
}
|
|
18640
18653
|
const labels = [...new Set((input.labels ?? []).map((l) => l.trim()).filter(Boolean))];
|
|
18641
18654
|
const body = input.body?.trim() ? input.body : void 0;
|
|
@@ -18646,7 +18659,7 @@ async function runIssueCreate(input) {
|
|
|
18646
18659
|
print(` ${title}`);
|
|
18647
18660
|
for (const line of (body ?? "").split("\n").slice(0, PREVIEW_LINES)) print(` ${style.skip(line)}`);
|
|
18648
18661
|
print("");
|
|
18649
|
-
return finish([row$
|
|
18662
|
+
return finish([row$4(title, "skip", `would file the issue${summary}`)]);
|
|
18650
18663
|
}
|
|
18651
18664
|
if (!input.yes) {
|
|
18652
18665
|
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");
|
|
@@ -18668,9 +18681,9 @@ async function runIssueCreate(input) {
|
|
|
18668
18681
|
...labels.length > 0 ? { labels } : {},
|
|
18669
18682
|
...milestone ? { milestone } : {}
|
|
18670
18683
|
});
|
|
18671
|
-
return finish([row$
|
|
18684
|
+
return finish([row$4(title, "ok", `filed ${key}`)], key);
|
|
18672
18685
|
} catch (err) {
|
|
18673
|
-
return finish([row$
|
|
18686
|
+
return finish([row$4(title, "fail", `could not file the issue: ${describeError(err)}`)]);
|
|
18674
18687
|
}
|
|
18675
18688
|
}
|
|
18676
18689
|
// src/commands/issue-create/issue-create.command.ts
|
|
@@ -25503,7 +25516,7 @@ async function convergeCreatedIssue(issues, marker, created) {
|
|
|
25503
25516
|
*/
|
|
25504
25517
|
/** The state that files a note when the config names none. */
|
|
25505
25518
|
const DEFAULT_FILING_STATE = "in-progress";
|
|
25506
|
-
const row$
|
|
25519
|
+
const row$3 = (id, status, detail) => ({
|
|
25507
25520
|
id,
|
|
25508
25521
|
title: id,
|
|
25509
25522
|
status,
|
|
@@ -25535,7 +25548,7 @@ async function runIdeasSync(input) {
|
|
|
25535
25548
|
print(style.header(`Holocron sync ideas${dryRun ? " (dry-run)" : ""}`));
|
|
25536
25549
|
print("");
|
|
25537
25550
|
const entry = resolveIdeasProvider(input.loaded.resolved, input.env);
|
|
25538
|
-
if (!entry) return finish([row$
|
|
25551
|
+
if (!entry) return finish([row$3("ideas", "fail", "no `ideas` provider: set `providers.ideas` (`[\"obsidian\", { dir }]`) in holocron.config or HOLOCRON_IDEAS_DIR")]);
|
|
25539
25552
|
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
25540
25553
|
const reader = input.ideasLoader ?? new PluginLoader({
|
|
25541
25554
|
...input.loaded.resolved,
|
|
@@ -25546,25 +25559,25 @@ async function runIdeasSync(input) {
|
|
|
25546
25559
|
assertPluginsResolvable(reader, "sync ideas");
|
|
25547
25560
|
if (!reader.has("ideas")) {
|
|
25548
25561
|
const failure = reader.loadFailures().find((f) => f.key === "ideas");
|
|
25549
|
-
return finish([row$
|
|
25562
|
+
return finish([row$3("ideas", "fail", `the \`ideas\` provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`)]);
|
|
25550
25563
|
}
|
|
25551
25564
|
const ideas = reader.get("ideas");
|
|
25552
25565
|
let records;
|
|
25553
25566
|
try {
|
|
25554
25567
|
records = await ideas.list();
|
|
25555
25568
|
} catch (err) {
|
|
25556
|
-
return finish([row$
|
|
25569
|
+
return finish([row$3("ideas", "fail", describeError(err))]);
|
|
25557
25570
|
}
|
|
25558
25571
|
const fileState = input.loaded.resolved.ideas?.states?.file ?? DEFAULT_FILING_STATE;
|
|
25559
25572
|
const rows = [];
|
|
25560
25573
|
const ready = [];
|
|
25561
|
-
for (const idea of records) if (idea.error !== void 0) rows.push(row$
|
|
25574
|
+
for (const idea of records) if (idea.error !== void 0) rows.push(row$3(idea.key, "fail", idea.error));
|
|
25562
25575
|
else if (idea.status !== fileState || idea.issue !== void 0) notReady++;
|
|
25563
|
-
else if (idea.attachments.length > 0) rows.push(row$
|
|
25576
|
+
else if (idea.attachments.length > 0) rows.push(row$3(idea.key, "skip", `has embedded files an issue cannot carry (${idea.attachments.join(", ")}); not filed`));
|
|
25564
25577
|
else ready.push(idea);
|
|
25565
25578
|
if (ready.length === 0) return finish(rows);
|
|
25566
25579
|
if (dryRun) {
|
|
25567
|
-
for (const idea of ready) rows.push(row$
|
|
25580
|
+
for (const idea of ready) rows.push(row$3(idea.key, "skip", `would file "${idea.title}"`));
|
|
25568
25581
|
return finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
25569
25582
|
}
|
|
25570
25583
|
if (!input.yes) {
|
|
@@ -25588,7 +25601,7 @@ async function runIdeasSync(input) {
|
|
|
25588
25601
|
for (const idea of ready) {
|
|
25589
25602
|
const path = idea.key;
|
|
25590
25603
|
if (!issues) {
|
|
25591
|
-
rows.push(row$
|
|
25604
|
+
rows.push(row$3(path, "fail", "the config has no `issues` provider to file it with"));
|
|
25592
25605
|
continue;
|
|
25593
25606
|
}
|
|
25594
25607
|
let existing;
|
|
@@ -25598,7 +25611,7 @@ async function runIdeasSync(input) {
|
|
|
25598
25611
|
limit: 100
|
|
25599
25612
|
})).filter((issue) => issue.body?.includes(marker(path))));
|
|
25600
25613
|
} catch (err) {
|
|
25601
|
-
rows.push(row$
|
|
25614
|
+
rows.push(row$3(path, "fail", `could not check for an existing issue, so none was created: ${describeError(err)}`));
|
|
25602
25615
|
continue;
|
|
25603
25616
|
}
|
|
25604
25617
|
let key;
|
|
@@ -25613,7 +25626,7 @@ async function runIdeasSync(input) {
|
|
|
25613
25626
|
body: issueBody(idea)
|
|
25614
25627
|
}));
|
|
25615
25628
|
} catch (err) {
|
|
25616
|
-
rows.push(row$
|
|
25629
|
+
rows.push(row$3(path, "fail", `could not create the issue: ${describeError(err)}`));
|
|
25617
25630
|
continue;
|
|
25618
25631
|
}
|
|
25619
25632
|
({key, detail, warning} = await convergeCreatedIssue(issues, marker(path), created));
|
|
@@ -25621,12 +25634,12 @@ async function runIdeasSync(input) {
|
|
|
25621
25634
|
try {
|
|
25622
25635
|
await ideas.markFiled(path, key);
|
|
25623
25636
|
rows.push({
|
|
25624
|
-
...row$
|
|
25637
|
+
...row$3(path, "ok", detail),
|
|
25625
25638
|
problems: warning ? ["a duplicate issue for this idea may be open: close the extra one by hand"] : []
|
|
25626
25639
|
});
|
|
25627
25640
|
} catch (err) {
|
|
25628
25641
|
rows.push({
|
|
25629
|
-
...row$
|
|
25642
|
+
...row$3(path, "fail", `issue ${key} was created but \`issue:\` was not written: ${describeError(err)}`),
|
|
25630
25643
|
problems: [`add \`issue: ${key}\` to the note by hand`]
|
|
25631
25644
|
});
|
|
25632
25645
|
}
|
|
@@ -25784,8 +25797,8 @@ function restorePem(value) {
|
|
|
25784
25797
|
* `secrets` entirely — still synced to `deployment` if configured.
|
|
25785
25798
|
* Needed for a vault holding a mix of deploy-only secrets and one
|
|
25786
25799
|
* CI-consumed, org-wide secret (holocron#781's Sentinel case: 4
|
|
25787
|
-
* Vercel-only keys + one org-scoped Axiom ingest token
|
|
25788
|
-
* `theholocron/.github`
|
|
25800
|
+
* Vercel-only keys + one org-scoped Axiom ingest token that
|
|
25801
|
+
* a workflow in `theholocron/.github` also read).
|
|
25789
25802
|
* - With no `--github-secret`, the routes come from `repo.secrets.sync`: every
|
|
25790
25803
|
* entry for this environment gives `secrets` its own keys and scope, one
|
|
25791
25804
|
* step per scope, so one environment can fill organization and repository
|
|
@@ -27611,6 +27624,210 @@ const syncReadmeCommand = {
|
|
|
27611
27624
|
}
|
|
27612
27625
|
}
|
|
27613
27626
|
};
|
|
27627
|
+
// src/commands/sync-requests/run-sync-requests/run-sync-requests.ts
|
|
27628
|
+
/**
|
|
27629
|
+
* `holocron sync requests` — keeps each `tooling` provider's own workspace and the repo's request files in step, both ways.
|
|
27630
|
+
*
|
|
27631
|
+
* For each `tooling` provider the config names (or only `--to`) that has the optional `Tooling.workspace`, the command
|
|
27632
|
+
* reads the provider's `collectionFiles` / `envFiles` options and asks it first, as a dry run, how its files compare:
|
|
27633
|
+
* each is `new`, `changed`, `unchanged`, `removed` or `conflict`. The provider owns the folder, the layout and the
|
|
27634
|
+
* record of the last sync (Bruno's is `.bruno/` at the repo root), so this command knows no tool's name or path. It
|
|
27635
|
+
* decides which side to write from that record; a `conflict` is a pair whose two sides both changed, which fails the
|
|
27636
|
+
* provider's row and writes nothing for it unless `--prefer source|workspace` settles it. With `--check` it stops after
|
|
27637
|
+
* the comparison and fails when any file is not `unchanged`; with `--dry-run` it prints the same and stops; otherwise
|
|
27638
|
+
* it asks first (unless `--yes`; without a terminal it refuses instead) and has the provider write. Nothing is asked
|
|
27639
|
+
* when everything is in sync. A provider with no `workspace`, or an entry with no `collectionFiles`, is a skipped row.
|
|
27640
|
+
* What the conversion could not carry across is listed under the provider's row and does not fail the run.
|
|
27641
|
+
*/
|
|
27642
|
+
const row$2 = (id, status, detail, problems = []) => ({
|
|
27643
|
+
id,
|
|
27644
|
+
title: id,
|
|
27645
|
+
status,
|
|
27646
|
+
detail,
|
|
27647
|
+
problems
|
|
27648
|
+
});
|
|
27649
|
+
/** A provider option that is a list of file names; anything else reads as none. */
|
|
27650
|
+
const fileList = (value) => Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
|
|
27651
|
+
/** `2 new, 1 changed, 4 unchanged`: the states that occur, in a fixed order. */
|
|
27652
|
+
function tally(result) {
|
|
27653
|
+
return [
|
|
27654
|
+
"new",
|
|
27655
|
+
"changed",
|
|
27656
|
+
"removed",
|
|
27657
|
+
"conflict",
|
|
27658
|
+
"unchanged"
|
|
27659
|
+
].map((state) => [state, result.files.filter((file) => file.state === state).length]).filter(([, count]) => count > 0).map(([state, count]) => `${count} ${state}`).join(", ");
|
|
27660
|
+
}
|
|
27661
|
+
/** The files that are not `unchanged`. */
|
|
27662
|
+
const outOfDate = (result) => result.files.filter((file) => file.state !== "unchanged");
|
|
27663
|
+
/** The files of a pair that both sides changed. */
|
|
27664
|
+
const conflicts = (result) => result.files.filter((file) => file.state === "conflict");
|
|
27665
|
+
async function runSyncRequests(input) {
|
|
27666
|
+
/* v8 ignore next -- the console is only used outside tests, which inject `print` */
|
|
27667
|
+
const print = input.print ?? ((line) => console.log(line));
|
|
27668
|
+
const dryRun = Boolean(input.context.dryRun);
|
|
27669
|
+
const check = Boolean(input.check);
|
|
27670
|
+
const preferred = input.prefer ? { prefer: input.prefer } : {};
|
|
27671
|
+
const { repoRoot } = input.context;
|
|
27672
|
+
const finish = (rows) => {
|
|
27673
|
+
printCheckRows(rows, print);
|
|
27674
|
+
const summary = summariseChecks(rows);
|
|
27675
|
+
printCheckSummary(summary, print);
|
|
27676
|
+
return {
|
|
27677
|
+
status: summary.fail > 0 ? "fail" : "ok",
|
|
27678
|
+
rows
|
|
27679
|
+
};
|
|
27680
|
+
};
|
|
27681
|
+
print(style.header(`Holocron sync requests${check ? " (check)" : dryRun ? " (dry-run)" : ""}`));
|
|
27682
|
+
print("");
|
|
27683
|
+
const entry = input.loaded.resolved.providers.tooling;
|
|
27684
|
+
const tuples = entry?.cardinality === "many" ? entry.tuples : [];
|
|
27685
|
+
if (tuples.length === 0) return finish([row$2("tooling", "fail", "the config has no `tooling` provider to sync for")]);
|
|
27686
|
+
const chosen = input.to === void 0 ? tuples : tuples.filter((t) => t.provider === input.to);
|
|
27687
|
+
if (chosen.length === 0) return finish([row$2(input.to, "fail", `not a \`tooling\` provider of this config (${tuples.map((t) => t.provider).join(", ")})`)]);
|
|
27688
|
+
/* v8 ignore start -- the real loader is only built outside tests, which always inject one */
|
|
27689
|
+
const loader = input.loader ?? new PluginLoader({
|
|
27690
|
+
...input.loaded.resolved,
|
|
27691
|
+
providers: { tooling: {
|
|
27692
|
+
cardinality: "many",
|
|
27693
|
+
tuples: chosen
|
|
27694
|
+
} }
|
|
27695
|
+
}, input.context);
|
|
27696
|
+
/* v8 ignore stop */
|
|
27697
|
+
await loader.load();
|
|
27698
|
+
assertPluginsResolvable(loader, "sync requests");
|
|
27699
|
+
const loaded = loader.has("tooling") ? loader.get("tooling") : [];
|
|
27700
|
+
const rows = [];
|
|
27701
|
+
const targets = [];
|
|
27702
|
+
for (const tuple of chosen) {
|
|
27703
|
+
const id = tuple.provider;
|
|
27704
|
+
const tool = loaded.find((t) => t.providerName === id);
|
|
27705
|
+
if (!tool) {
|
|
27706
|
+
const failure = loader.loadFailures().find((f) => f.key === "tooling" && f.provider === id);
|
|
27707
|
+
rows.push(row$2(id, "fail", `the provider is not available${failure ? ` (${describeError(failure.error)})` : ""}`));
|
|
27708
|
+
continue;
|
|
27709
|
+
}
|
|
27710
|
+
if (!tool.workspace) {
|
|
27711
|
+
rows.push(row$2(id, "skip", "has no workspace of its own to keep in step"));
|
|
27712
|
+
continue;
|
|
27713
|
+
}
|
|
27714
|
+
const collectionFiles = fileList(tuple.options.collectionFiles);
|
|
27715
|
+
if (collectionFiles.length === 0) {
|
|
27716
|
+
rows.push(row$2(id, "skip", "names no `collectionFiles`, so there is nothing to sync"));
|
|
27717
|
+
continue;
|
|
27718
|
+
}
|
|
27719
|
+
targets.push({
|
|
27720
|
+
provider: id,
|
|
27721
|
+
tool,
|
|
27722
|
+
collectionFiles,
|
|
27723
|
+
envFiles: fileList(tuple.options.envFiles)
|
|
27724
|
+
});
|
|
27725
|
+
}
|
|
27726
|
+
if (targets.length === 0) return finish(rows);
|
|
27727
|
+
const plans = /* @__PURE__ */ new Map();
|
|
27728
|
+
for (const { tool, provider, collectionFiles, envFiles } of targets) try {
|
|
27729
|
+
plans.set(provider, await tool.workspace({
|
|
27730
|
+
collectionFiles,
|
|
27731
|
+
envFiles,
|
|
27732
|
+
repoRoot,
|
|
27733
|
+
dryRun: true,
|
|
27734
|
+
...preferred
|
|
27735
|
+
}));
|
|
27736
|
+
} catch (err) {
|
|
27737
|
+
rows.push(row$2(provider, "fail", describeError(err)));
|
|
27738
|
+
}
|
|
27739
|
+
const writable = (plan) => conflicts(plan).length === 0;
|
|
27740
|
+
const pending = [...plans.values()].reduce((sum, plan) => sum + (writable(plan) ? outOfDate(plan).length : 0), 0);
|
|
27741
|
+
const planned = targets.filter((target) => plans.has(target.provider));
|
|
27742
|
+
const toWrite = planned.filter((target) => writable(plans.get(target.provider)));
|
|
27743
|
+
const write = !dryRun && !check && pending > 0;
|
|
27744
|
+
if (write && !input.yes) {
|
|
27745
|
+
if (!(input.interactive ?? Boolean(process.stdin.isTTY))) throw new NonInteractiveError(`\`sync requests\` writes ${pending} file(s); pass --yes to run it without asking, or --dry-run to preview`);
|
|
27746
|
+
if (!await (input.confirm ?? ((message) => confirm({
|
|
27747
|
+
message,
|
|
27748
|
+
default: false
|
|
27749
|
+
})))(`Write ${pending} file(s) for ${toWrite.map((t) => t.provider).join(", ")}?`)) {
|
|
27750
|
+
print(` ${style.skip("cancelled; nothing was written")}`);
|
|
27751
|
+
return {
|
|
27752
|
+
status: "cancelled",
|
|
27753
|
+
rows: []
|
|
27754
|
+
};
|
|
27755
|
+
}
|
|
27756
|
+
}
|
|
27757
|
+
const listed = [];
|
|
27758
|
+
for (const { tool, provider, collectionFiles, envFiles } of planned) {
|
|
27759
|
+
let result = plans.get(provider);
|
|
27760
|
+
if (write && writable(result) && outOfDate(result).length > 0) try {
|
|
27761
|
+
result = await tool.workspace({
|
|
27762
|
+
collectionFiles,
|
|
27763
|
+
envFiles,
|
|
27764
|
+
repoRoot,
|
|
27765
|
+
...preferred
|
|
27766
|
+
});
|
|
27767
|
+
} catch (err) {
|
|
27768
|
+
rows.push(row$2(provider, "fail", describeError(err)));
|
|
27769
|
+
continue;
|
|
27770
|
+
}
|
|
27771
|
+
const issues = result.issues.map((issue) => `issue in ${issue.file}: ${issue.message}`);
|
|
27772
|
+
const stale = outOfDate(result);
|
|
27773
|
+
const clashes = conflicts(result);
|
|
27774
|
+
if (clashes.length > 0) {
|
|
27775
|
+
const notes = clashes.map((file) => `${file.path}: ${file.note ?? "both sides changed"}`);
|
|
27776
|
+
rows.push(row$2(provider, "fail", `${clashes.length} conflict(s), so nothing was written (${tally(result)})`, [...notes, ...issues]));
|
|
27777
|
+
} else if (check && stale.length > 0) rows.push(row$2(provider, "fail", `${stale.length} file(s) out of date (${tally(result)}); run \`holocron sync requests\``, issues));
|
|
27778
|
+
else if (stale.length === 0) rows.push(row$2(provider, "ok", `in sync (${tally(result)})`, issues));
|
|
27779
|
+
else {
|
|
27780
|
+
const verb = write ? "wrote" : "would write";
|
|
27781
|
+
rows.push(row$2(provider, "ok", `${verb} ${stale.length} file(s) (${tally(result)})`, issues));
|
|
27782
|
+
}
|
|
27783
|
+
if (clashes.length === 0) listed.push(...stale.map((file) => `${file.state.padEnd(7)} ${file.path}`));
|
|
27784
|
+
}
|
|
27785
|
+
const report = finish(rows.sort((a, b) => a.id.localeCompare(b.id)));
|
|
27786
|
+
if (listed.length > 0) {
|
|
27787
|
+
print("");
|
|
27788
|
+
print(write ? "Wrote:" : check ? "Out of date:" : "Would write:");
|
|
27789
|
+
for (const line of listed) print(` ${line}`);
|
|
27790
|
+
}
|
|
27791
|
+
return report;
|
|
27792
|
+
}
|
|
27793
|
+
// src/commands/sync-requests/sync-requests.command.ts
|
|
27794
|
+
const syncRequestsCommand = {
|
|
27795
|
+
command: "requests",
|
|
27796
|
+
describe: "Keep each tooling provider's workspace and the repo's request files in step, both ways",
|
|
27797
|
+
builder: (y) => y.option("to", {
|
|
27798
|
+
type: "string",
|
|
27799
|
+
describe: "Sync only for this tooling provider (default: every one with a workspace)"
|
|
27800
|
+
}).option("check", {
|
|
27801
|
+
type: "boolean",
|
|
27802
|
+
describe: "Write nothing and exit non-zero when any file is out of date (for CI)"
|
|
27803
|
+
}).option("prefer", {
|
|
27804
|
+
type: "string",
|
|
27805
|
+
choices: ["source", "workspace"],
|
|
27806
|
+
describe: "Settle a pair whose request file and workspace both changed since the last sync: `source` regenerates the workspace from the request files, `workspace` the request files from the workspace"
|
|
27807
|
+
}).option("yes", {
|
|
27808
|
+
type: "boolean",
|
|
27809
|
+
describe: "Write without asking (required without a terminal)"
|
|
27810
|
+
}),
|
|
27811
|
+
handler: async (argv) => {
|
|
27812
|
+
const tokens = tokenContext(argv.token);
|
|
27813
|
+
if (!tokens) return;
|
|
27814
|
+
const loaded = await loadConfig(argv.cwd);
|
|
27815
|
+
applyResolvedConfig(argv, loaded.resolved);
|
|
27816
|
+
if ((await runSyncRequests({
|
|
27817
|
+
loaded,
|
|
27818
|
+
context: {
|
|
27819
|
+
repoRoot: argv.cwd,
|
|
27820
|
+
dryRun: argv.dryRun,
|
|
27821
|
+
...tokens,
|
|
27822
|
+
org: resolveOrg(argv, loaded.resolved)
|
|
27823
|
+
},
|
|
27824
|
+
...argv.to ? { to: argv.to } : {},
|
|
27825
|
+
...argv.check ? { check: true } : {},
|
|
27826
|
+
...argv.prefer ? { prefer: argv.prefer } : {},
|
|
27827
|
+
...argv.yes ? { yes: true } : {}
|
|
27828
|
+
})).status === "fail") process.exitCode = 1;
|
|
27829
|
+
}
|
|
27830
|
+
};
|
|
27614
27831
|
// src/commands/sync-tooling/run-sync-tooling/run-sync-tooling.ts
|
|
27615
27832
|
/**
|
|
27616
27833
|
* `holocron sync tooling` — runs each `tooling` provider's `sync()` and nothing else.
|
|
@@ -28571,7 +28788,7 @@ const syncArgs = (y) => y.positional("steps", {
|
|
|
28571
28788
|
const syncCommand = {
|
|
28572
28789
|
command: "sync [steps..]",
|
|
28573
28790
|
describe: "Sync state from config to the provider and local files (labels, properties, teams, topics, keywords, description, homepage, readme, workflows, scripts, wiki)",
|
|
28574
|
-
builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(syncToolingCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
|
|
28791
|
+
builder: (y) => syncArgs(y).command(syncGithubCommand).command(syncIssuesCommand).command(syncReadmeCommand).command(ideasSyncCommand).command(syncToolingCommand).command(syncRequestsCommand).command(specsSyncCommand).command(secretsSyncCommand).command(notificationsSyncRolesCommand),
|
|
28575
28792
|
handler: async (argv) => {
|
|
28576
28793
|
const tokens = tokenContext(argv.token);
|
|
28577
28794
|
if (!tokens) return;
|