@theholocron/cli 5.0.0-alpha.353 → 5.0.0-alpha.355
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 +6 -3
- package/dist/cli.mjs +46 -10
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-system-CTQ_I-Vm.d.mts → config-system-CTXxGw0f.d.mts} +1 -1
- package/dist/{config-system-DKtlo5Pb.mjs → config-system-u8-jh7xW.mjs} +34 -6
- package/dist/{index-CArtx6o0.d.mts → index-CmdMBl-M.d.mts} +16 -0
- package/dist/index.d.mts +8 -2
- package/dist/index.mjs +2 -2
- package/dist/plugin/capabilities.d.mts +1 -1
- package/dist/presets.d.mts +1 -3
- package/dist/presets.mjs +5 -8
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -244,8 +244,11 @@ repo's `.holocron/repo.ts` holds `teams`, `topics`, `variables` and `secrets`, n
|
|
|
244
244
|
out, so the config can say `deployment: ["vercel", { domain }]` and `monitoring: "checkly"`. The same option set inline
|
|
245
245
|
and in the file is an error that names both (`vercel.teamId is set in providers.deployment and in
|
|
246
246
|
.holocron/org.ts`), with no merge and no precedence. A provider key or an option the area does not know is an error; a
|
|
247
|
-
provider the config does not use is ignored.
|
|
248
|
-
|
|
247
|
+
provider the config does not use is ignored. The org area is shared: a config in a subdirectory (`apps/sentinel`)
|
|
248
|
+
also reads the repository root's `.holocron/org.ts` (the nearest ancestor with a `.git`), and its own
|
|
249
|
+
`.holocron/org.ts` wins for a key set in both, option by option; that is not an error, so an identifier written in the
|
|
250
|
+
root file needs no copy in the app. The other areas (`repo`, `notifications`) describe the repository and are not
|
|
251
|
+
shared. Anything CI needs (`CLOUDFLARE_ACCOUNT_ID`,
|
|
249
252
|
`TURBO_TEAM`, `AXIOM_DATASET`) stays out: it lives in 1Password and syncs to a GitHub variable (`repo.variables.sync`),
|
|
250
253
|
and nothing else carries a copy. `.holocron/org.md` (the agent contract the CLI embeds) is not an area: only
|
|
251
254
|
`.ts`, `.js`, `.mjs`, `.cjs` and `.json` are read.
|
|
@@ -646,7 +649,7 @@ Channels fed by the error tracker add `feeds: { errors: true }` and a layout `re
|
|
|
646
649
|
|
|
647
650
|
`holocron secrets list [--scope repo|environment|organization] [--env <name>] [--json]` prints the names (never the values; GitHub does not return them) of the secrets at each scope, sorted, under a heading per scope. With no `--scope` it lists the repository, plus the organization (`--org`, `HOLOCRON_ORG` or the config's `org`) and the `--env` environment when they are known; `--scope` lists one. A scope that cannot be listed is reported under its heading and the rest are still listed; the exit code is 1 if any failed. `--json` prints `[{ scope, names, error? }]`. It is read-only, so `--dry-run` does not apply. Comparing the names with what the config expects is `doctor secrets`, which also covers the keys of the vault environments declared in `repo.secrets.sync`.
|
|
648
651
|
|
|
649
|
-
A channel with `kind: "forum"` is a forum, with `tags` (each a `name`, an `emoji` and whether it is `moderated`); `setup` adds and corrects the tags but never removes one, and a text channel of the same name must be deleted first, since neither kind can become the other. A forum takes no `webhook` or `feeds`.
|
|
652
|
+
A channel with `kind: "forum"` is a forum, with `tags` (each a `name`, an `emoji` and whether it is `moderated`); `setup` adds and corrects the tags but never removes one, and a text channel of the same name must be deleted first, since neither kind can become the other. A forum takes no `webhook` or `feeds`. `defaultReaction` is the emoji Discord offers on every post (its Get Started step "Set a default reaction for posts"); Discord allows only one, so `starterReactions` lists more (`["👍", "👎", "❓"]` for approve, disapprove, question) that the bot adds to the first message of each post `specs sync` makes. Existing posts are left alone, a reaction the bot cannot add is skipped, and `doctor notifications` checks `defaultReaction`. Unicode emoji only.
|
|
650
653
|
|
|
651
654
|
`holocron specs sync [--channel <forum>] [--files <paths...>] [--pr <number>] [--refresh] [--refresh-origin] [--refresh-titles] [--withdraw] [--notify]` keeps one forum post per ADR and spec in step with the files: it makes the post (titled with the document's own title, tagged with the file's status), writes its address into the file as `discussion.url`, and turns a gatekeeper's retag into an edit of the file's `status:` line in the working tree for a pull request. `--files` syncs only those files and `--pr` names a pull request on their posts, for a pull request that is still open. `--refresh-origin` is a one-off repair: it rewrites the `PR:` line of existing posts to the one the current rule names (the optional `prLine` of `DiscussionPatch`, and of `DiscussionPost`), and nothing else in them. `--refresh-titles` is the same kind of one-off repair for the title: it renames each existing post whose title differs from the current rule's (the optional `title` of `DiscussionPatch`, and of `DiscussionPost`) and changes nothing else; a rate limit stops it cleanly, reports how many documents are left, and the next run continues. The id that opens a post is a link to the file on the default branch (`repo.defaultBranch`, else `HEAD`) once the file is there, and plain text while `--pr` names an open pull request; the normal sync rewrites a post's id line (and only that line) whenever it is not the one the rule gives and no `--pr` is given, which covers a file that moved and a post made while its pull request was open, so it needs no extra request when every post is right and `--refresh` is no longer needed for it. `--refresh` runs the `PR:`, title and id-link repairs in one pass (the id link is the optional `idLine` of `DiscussionPatch`, and of `DiscussionPost`, which changes only the message's first line); `--refresh-origin` and `--refresh-titles` still do only their own. `--withdraw` (with `--files`, on the base branch) tags the posts of a pull request closed unmerged `withdrawn` and closes them; `withdrawn` is a tag only, never a file `status:`, and the next sync puts the file's own status back. It cannot be combined with `--refresh`, `--refresh-origin` or `--refresh-titles`. `--dry-run` previews it. See the [`specs sync` page](https://docs.theholocron.dev/holocron/commands/specs-sync/).
|
|
652
655
|
|
package/dist/cli.mjs
CHANGED
|
@@ -429,6 +429,12 @@ const HOLOCRON_AREAS = [
|
|
|
429
429
|
"repo",
|
|
430
430
|
"org"
|
|
431
431
|
];
|
|
432
|
+
/**
|
|
433
|
+
* The areas a config in a subdirectory also reads from the repository root's `.holocron/` (SPEC-0069): only `org`,
|
|
434
|
+
* because its values are the organization's and every config needs them. `repo` and `notifications` describe the
|
|
435
|
+
* repository itself, so an app's config does not take them from the root.
|
|
436
|
+
*/
|
|
437
|
+
const SHARED_AREAS = ["org"];
|
|
432
438
|
// src/config/load-config/place-notifications/place-notifications.ts
|
|
433
439
|
const isTuple$1 = (entry) => Array.isArray(entry) && entry.length === 2 && typeof entry[0] === "string" && typeof entry[1] === "object" && entry[1] !== null && !Array.isArray(entry[1]);
|
|
434
440
|
const providerName = (entry) => isTuple$1(entry) ? entry[0] : entry;
|
|
@@ -494,15 +500,34 @@ function validate(area) {
|
|
|
494
500
|
}
|
|
495
501
|
return area.value;
|
|
496
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* The org options of an area and, when the repository root has the same area, the root's under them: an option set in
|
|
505
|
+
* both takes the config's own value, option by option (the root's other options stay). Each file is checked on its own.
|
|
506
|
+
*/
|
|
507
|
+
function merge(area) {
|
|
508
|
+
const merged = {};
|
|
509
|
+
for (const layer of area.root ? [area.root, area] : [area]) for (const [provider, options] of Object.entries(validate(layer))) {
|
|
510
|
+
const sourced = merged[provider] ??= {};
|
|
511
|
+
for (const [option, value] of Object.entries(options)) sourced[option] = {
|
|
512
|
+
value,
|
|
513
|
+
path: layer.path
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
return merged;
|
|
517
|
+
}
|
|
497
518
|
/** Fill one entry when it names a provider the area holds; throws when the config already sets one of its options. */
|
|
498
|
-
function fill(entry, org, capability
|
|
519
|
+
function fill(entry, org, capability) {
|
|
499
520
|
const [provider, options] = isTuple(entry) ? entry : [entry, {}];
|
|
500
521
|
const values = org[provider];
|
|
501
522
|
if (values === void 0 || Object.keys(values).length === 0) return entry;
|
|
502
|
-
|
|
523
|
+
const filled = {};
|
|
524
|
+
for (const [option, { value, path }] of Object.entries(values)) {
|
|
525
|
+
if (options[option] !== void 0) throw new ConfigError(`${provider}.${option} is set in providers.${capability} and in ${path}. Set it in one place: remove the inline option or the key from ${path}`);
|
|
526
|
+
filled[option] = value;
|
|
527
|
+
}
|
|
503
528
|
return [provider, {
|
|
504
529
|
...options,
|
|
505
|
-
...
|
|
530
|
+
...filled
|
|
506
531
|
}];
|
|
507
532
|
}
|
|
508
533
|
/**
|
|
@@ -510,12 +535,14 @@ function fill(entry, org, capability, path) {
|
|
|
510
535
|
* `[name, options]` tuple, or either inside a list) that names a provider the file holds gets each option it leaves
|
|
511
536
|
* out. An option set inline and in the file is a `ConfigError` naming both (no merge, no precedence); a provider the
|
|
512
537
|
* config does not use is ignored; a provider or option the file lists but `OrgConfig` does not know is an error.
|
|
538
|
+
* When the area also came from the repository root (`area.root`, a config in a subdirectory), the two files combine
|
|
539
|
+
* option by option and the config's own file wins; that is not an error.
|
|
513
540
|
*/
|
|
514
541
|
function placeOrg(raw, area) {
|
|
515
|
-
const org =
|
|
542
|
+
const org = merge(area);
|
|
516
543
|
if (raw.providers === void 0) return raw;
|
|
517
544
|
const providers = { ...raw.providers };
|
|
518
|
-
for (const [capability, entry] of Object.entries(raw.providers)) providers[capability] = Array.isArray(entry) && !isTuple(entry) ? entry.map((item) => fill(item, org, capability
|
|
545
|
+
for (const [capability, entry] of Object.entries(raw.providers)) providers[capability] = Array.isArray(entry) && !isTuple(entry) ? entry.map((item) => fill(item, org, capability)) : fill(entry, org, capability);
|
|
519
546
|
return {
|
|
520
547
|
...raw,
|
|
521
548
|
providers
|
|
@@ -571,6 +598,7 @@ function placeAreas(areas, raw) {
|
|
|
571
598
|
const system$1 = createConfigSystem({
|
|
572
599
|
name: "holocron",
|
|
573
600
|
areas: HOLOCRON_AREAS,
|
|
601
|
+
shared: SHARED_AREAS,
|
|
574
602
|
place: placeAreas,
|
|
575
603
|
derive: deriveDefaults$1,
|
|
576
604
|
resolve: resolveConfig,
|
|
@@ -4951,7 +4979,8 @@ async function provisionChannel(deps, spec) {
|
|
|
4951
4979
|
...spec.topic ? { topic: spec.topic } : {},
|
|
4952
4980
|
...spec.access ? { access: spec.access } : {},
|
|
4953
4981
|
...spec.kind ? { kind: spec.kind } : {},
|
|
4954
|
-
...spec.tags ? { tags: spec.tags } : {}
|
|
4982
|
+
...spec.tags ? { tags: spec.tags } : {},
|
|
4983
|
+
...spec.defaultReaction ? { defaultReaction: spec.defaultReaction } : {}
|
|
4955
4984
|
});
|
|
4956
4985
|
const changed = channel.created || (channel.updated?.length ?? 0) > 0;
|
|
4957
4986
|
const verb = channel.created ? "created" : changed ? "updated" : "exists ";
|
|
@@ -6066,9 +6095,12 @@ function forumLayoutProblem(layout) {
|
|
|
6066
6095
|
const where = `channel \`${channel.name}\``;
|
|
6067
6096
|
if (channel.kind !== "forum") {
|
|
6068
6097
|
if (channel.tags) return `${where}: \`tags\` belong to a forum -- set \`kind: "forum"\` or remove them`;
|
|
6098
|
+
if (channel.defaultReaction || channel.starterReactions) return `${where}: reactions belong to a forum -- set \`kind: "forum"\` or remove them`;
|
|
6069
6099
|
continue;
|
|
6070
6100
|
}
|
|
6071
6101
|
if (channel.webhook || channel.feeds?.monitoring || channel.feeds?.errors) return `${where}: a forum takes no \`webhook\` or \`feeds\`; its conversations are posts`;
|
|
6102
|
+
if (channel.defaultReaction !== void 0 && channel.defaultReaction.trim() === "") return `${where}: \`defaultReaction\` is empty`;
|
|
6103
|
+
if ((channel.starterReactions ?? []).some((r) => r.trim() === "")) return `${where}: a starter reaction is empty`;
|
|
6072
6104
|
const seen = /* @__PURE__ */ new Set();
|
|
6073
6105
|
for (const tag of channel.tags ?? []) {
|
|
6074
6106
|
const name = tag.name.trim().toLowerCase();
|
|
@@ -6402,6 +6434,7 @@ async function runNotificationsSetup(input$1) {
|
|
|
6402
6434
|
...effectiveAccess(category.access, channel.access) ? { access: effectiveAccess(category.access, channel.access) } : {},
|
|
6403
6435
|
...channel.kind ? { kind: channel.kind } : {},
|
|
6404
6436
|
...channel.tags ? { tags: channel.tags } : {},
|
|
6437
|
+
...channel.defaultReaction ? { defaultReaction: channel.defaultReaction } : {},
|
|
6405
6438
|
...webhook ? { webhook } : {},
|
|
6406
6439
|
...channel.feeds?.monitoring || channel.feeds?.errors ? { feeds: {
|
|
6407
6440
|
...channel.feeds.monitoring ? { monitoring: {
|
|
@@ -7603,10 +7636,13 @@ async function runDoctorNotifications(input) {
|
|
|
7603
7636
|
if (channel.topic && (match.topic ?? "") !== channel.topic) channelProblems.push(`#${shown(channel.name)}: topic is "${shown(match.topic ?? "")}" but the layout says "${shown(channel.topic)}"`);
|
|
7604
7637
|
const isForum = channel.kind === "forum";
|
|
7605
7638
|
if (isForum !== (match.kind === "forum")) channelProblems.push(`#${shown(channel.name)}: is ${isForum ? "a text channel, and the layout says forum" : "a forum, and the layout says text"}; delete it so \`setup\` can make it again`);
|
|
7606
|
-
else if (isForum)
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7639
|
+
else if (isForum) {
|
|
7640
|
+
if (channel.defaultReaction && (match.defaultReaction ?? "") !== channel.defaultReaction) channelProblems.push(`#${shown(channel.name)}: default reaction is ${match.defaultReaction ? `"${shown(match.defaultReaction)}"` : "not set"} but the layout says "${shown(channel.defaultReaction)}"`);
|
|
7641
|
+
for (const tag of channel.tags ?? []) {
|
|
7642
|
+
const have = match.tags?.find((t) => same(t.name, tag.name));
|
|
7643
|
+
if (!have) channelProblems.push(`#${shown(channel.name)}: tag "${shown(tag.name)}" is missing`);
|
|
7644
|
+
else if ((have.emoji ?? "") !== (tag.emoji ?? "") || (have.moderated ?? false) !== (tag.moderated ?? false)) channelProblems.push(`#${shown(channel.name)}: tag "${shown(tag.name)}" differs from the layout (emoji or moderated)`);
|
|
7645
|
+
}
|
|
7610
7646
|
}
|
|
7611
7647
|
}
|
|
7612
7648
|
add("channels", "channels in their category, with topics", channelProblems, declaredChannels.length === 0 ? "none declared" : `${declaredChannels.length} of ${declaredChannels.length} as declared`);
|