@theholocron/cli 5.0.0-alpha.571 → 5.0.0-alpha.573

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 CHANGED
@@ -265,14 +265,15 @@ and nothing else carries a copy. `.holocron/org.md` (the agent contract the CLI
265
265
 
266
266
  Additional `repo` fields recognised by `holocron setup`:
267
267
 
268
- | Field | Type | Description |
269
- | ----------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
270
- | `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`. |
271
- | `repo.topics` | `string[]` | GitHub topics set on the repository. |
272
- | `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron setup`. For `"strict"`, the required status checks are derived from the task manifest — see below. |
273
- | `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard. |
274
- | `repo.variables` | `{ repo?, org?, sync?, prune? }` | GitHub Actions variables created and updated by `holocron setup`. Undeclared ones are left alone unless `prune` is on. `sync: [{ environment, keys, scope?, visibility? }]` names the vault environment `holocron sync secrets` fills Actions variables from (a separate environment from the secrets one; names only, a blank value is skipped, `doctor secrets` expects the names). A name given as a literal and in `sync`, or `prune` with `sync`, is a config error. |
275
- | `repo.secrets` | `{ repo?, org?, environments?, sync? }` | Names of the secrets that must exist, checked (never written) by `holocron doctor secrets`. Names only. The notification layout's secrets and a Chromatic project token are expected without being listed. `sync: [{ environment, keys?, scope?, repos? }]` declares the vault environments `sync secrets` fills from (it follows these entries, one step per scope, unless `--github-secret` is given; the `local` and `dev` layers are never synced (a `ConfigError`, and an entry naming them does not load); an environment with no entry and no `--github-secret` is a `ConfigError` before the vault is read, #2104; a blank value is skipped); the doctor expects their keys (every key the `vault` provider lists when `keys` is omitted, names only) at the `scope` (`repo`, `env=<name>`, `org=<name>`). An `org=` scope requires `repos`, the repositories that can read the secrets (visibility `selected`, never `all`); without it the config does not load. `doctor secrets` flags a secret readable by more repositories than its entry lists, and a name held at both repository and organization level. |
268
+ | Field | Type | Description |
269
+ | ----------------- | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
270
+ | `repo.teams` | `Array<string \| { slug, permission }>` | GitHub teams granted repo access. String shorthand defaults to `push` (Write). `holocron setup` also writes `.github/CODEOWNERS` for teams with `push`/`maintain`/`admin`. |
271
+ | `repo.topics` | `string[]` | GitHub topics set on the repository. |
272
+ | `repo.protection` | `"balanced" \| "strict" \| "none"` | Branch-protection preset applied by `holocron setup`. For `"strict"`, the required status checks are derived from the task manifest — see below. |
273
+ | `repo.properties` | `RepoProperties` | Org-level custom property values synced to the GitHub dashboard. |
274
+ | `repo.variables` | `{ repo?, org?, sync?, prune? }` | GitHub Actions variables created and updated by `holocron setup`. Undeclared ones are left alone unless `prune` is on. `sync: [{ environment, keys, scope?, visibility? }]` names the vault environment `holocron sync secrets` fills Actions variables from (a separate environment from the secrets one; names only, a blank value is skipped, `doctor secrets` expects the names). A name given as a literal and in `sync`, or `prune` with `sync`, is a config error. |
275
+ | `repo.secrets` | `{ repo?, org?, environments?, sync? }` | Names of the secrets that must exist, checked (never written) by `holocron doctor secrets`. Names only. The notification layout's secrets and a Chromatic project token are expected without being listed. `sync: [{ environment, keys?, scope?, repos? }]` declares the vault environments `sync secrets` fills from (it follows these entries, one step per scope, unless `--github-secret` is given; the `local` and `dev` layers are never synced (a `ConfigError`, and an entry naming them does not load); an environment with no entry and no `--github-secret` is a `ConfigError` before the vault is read, #2104; a blank value is skipped); the doctor expects their keys (every key the `vault` provider lists when `keys` is omitted, names only) at the `scope` (`repo`, `env=<name>`, `org=<name>`). An `org=` scope requires `repos`, the repositories that can read the secrets (visibility `selected`, never `all`); without it the config does not load. `doctor secrets` flags a secret readable by more repositories than its entry lists, and a name held at both repository and organization level. |
276
+ | `repo.views` | `Record<string, { name, filter, description?, icon?, color?, visibility? }>` | Saved views of the Issues page. GitHub has no API for them: `setup` and `doctor repo` print the settings, a link that opens each search and its match count. See the docs. |
276
277
 
277
278
  ### Custom properties synced to GitHub
278
279
 
package/dist/cli.mjs CHANGED
@@ -3148,6 +3148,41 @@ function validateRepoLabels(labels) {
3148
3148
  if (!Array.isArray(repos)) throw new ConfigError$1("`repo.labels.repos` is a list of `owner/name` repositories");
3149
3149
  for (const repo of repos) if (typeof repo !== "string" || !REPOSITORY.test(repo)) throw new ConfigError$1(`\`repo.labels.repos\` has ${JSON.stringify(repo)}, which is not an \`owner/name\` repository`);
3150
3150
  }
3151
+ // src/config/validate-repo-views/validate-repo-views.ts
3152
+ /**
3153
+ * Check `repo.views` (spec `tech-issue-views`, #2733): each view needs a name and a filter (non-empty text), the names
3154
+ * are unique whatever the case, `visibility` is `private` or `public`, and `description`, `icon` and `color` are
3155
+ * non-empty text when given. GitHub does not document its icons and colours, so any text is accepted for them.
3156
+ *
3157
+ * @param views - `repo.views`, if the config has it.
3158
+ * @throws {ConfigError} Naming the path of the first problem found.
3159
+ */
3160
+ function validateRepoViews(views) {
3161
+ if (views === void 0) return;
3162
+ if (typeof views !== "object" || views === null || Array.isArray(views)) throw new ConfigError$1("`repo.views` is a table of views by slug");
3163
+ const names = /* @__PURE__ */ new Map();
3164
+ for (const [slug, view] of Object.entries(views)) {
3165
+ const at = `\`repo.views.${slug}\``;
3166
+ if (slug.trim() === "") throw new ConfigError$1("`repo.views` has a view with an empty slug");
3167
+ if (typeof view !== "object" || view === null) throw new ConfigError$1(`${at} must be an object`);
3168
+ if (typeof view.name !== "string" || view.name.trim() === "") throw new ConfigError$1(`${at} needs a \`name\``);
3169
+ if (typeof view.filter !== "string" || view.filter.trim() === "") throw new ConfigError$1(`${at} needs a \`filter\`, the search text of the view`);
3170
+ const lower = view.name.trim().toLowerCase();
3171
+ const first = names.get(lower);
3172
+ if (first !== void 0) throw new ConfigError$1(`${at}: the name ${JSON.stringify(view.name)} duplicates \`repo.views.${first}\` (names ignore case)`);
3173
+ names.set(lower, slug);
3174
+ for (const key of [
3175
+ "description",
3176
+ "icon",
3177
+ "color"
3178
+ ]) {
3179
+ const value = view[key];
3180
+ if (value !== void 0 && (typeof value !== "string" || value.trim() === "")) throw new ConfigError$1(`${at}.${key} must be non-empty text when given`);
3181
+ }
3182
+ const visibility = view.visibility;
3183
+ if (visibility !== void 0 && visibility !== "private" && visibility !== "public") throw new ConfigError$1(`${at}.visibility is ${JSON.stringify(visibility)}; use "private" or "public"`);
3184
+ }
3185
+ }
3151
3186
  // src/config/validate-required-checks/validate-required-checks.ts
3152
3187
  /**
3153
3188
  * Checks `repo.requiredChecks`, the list of status-check contexts a `strict` ruleset requires, when a repo writes it down
@@ -3474,6 +3509,7 @@ function resolveConfig(raw) {
3474
3509
  if (raw.ideas !== void 0) validateIdeas(raw.ideas);
3475
3510
  if (raw.issueTypes !== void 0) validateIssueTypes(raw.issueTypes);
3476
3511
  validateRepoLabels(raw.repo?.labels);
3512
+ validateRepoViews(raw.repo?.views);
3477
3513
  validateRepoEnvironments(raw.repo?.environments);
3478
3514
  validateRequiredChecks(raw.repo?.requiredChecks);
3479
3515
  validateVariablesSync(raw.repo?.variables);
@@ -6890,6 +6926,52 @@ function createFsTemplatesIo(repoRoot) {
6890
6926
  readFile: (path) => readFile(resolve(repoRoot, path), "utf8")
6891
6927
  };
6892
6928
  }
6929
+ // src/commands/project/templates/board-issue-views/board-issue-views.ts
6930
+ /**
6931
+ * The issue-list views of `repo.views` (spec `tech-issue-views`, #2743) that mean the same on a board, written in a
6932
+ * board's filter syntax. Every qualifier is one GitHub documents for a project view (`is:`, `type:`, `assignee:@me`,
6933
+ * `no:<field>`, `field:value`); `no:parent-issue` reads "Parent issue" as a field, which the docs imply but do not
6934
+ * list. Left out on purpose: Backlog (a template already has a view of that name), Blocking (a board has no qualifier
6935
+ * for it) and anything that needs `linked:pr` (not documented for a board). Blocked, Ready to start and In flight use
6936
+ * the status, which is how a board says the same thing. Both built-in templates use the same list, after their own views.
6937
+ */
6938
+ const BOARD_ISSUE_VIEWS = [
6939
+ {
6940
+ name: "Blocked",
6941
+ layout: "table",
6942
+ filter: "is:open status:Blocked"
6943
+ },
6944
+ {
6945
+ name: "Epics",
6946
+ layout: "table",
6947
+ filter: "is:open type:Epic"
6948
+ },
6949
+ {
6950
+ name: "No Epic",
6951
+ layout: "table",
6952
+ filter: "is:open is:issue no:parent-issue -type:Epic"
6953
+ },
6954
+ {
6955
+ name: "Ready to start",
6956
+ layout: "table",
6957
+ filter: "is:open status:Todo -type:Epic"
6958
+ },
6959
+ {
6960
+ name: "In flight",
6961
+ layout: "table",
6962
+ filter: "is:open status:\"In Progress\""
6963
+ },
6964
+ {
6965
+ name: "Mine",
6966
+ layout: "table",
6967
+ filter: "is:open assignee:@me"
6968
+ },
6969
+ {
6970
+ name: "Spikes",
6971
+ layout: "table",
6972
+ filter: "is:open type:Spike"
6973
+ }
6974
+ ];
6893
6975
  // src/commands/project/templates/builtin-templates/builtin-templates.ts
6894
6976
  /** The templates that ship in `@theholocron/cli`, by name. A repo's own template with the same name replaces one. */
6895
6977
  const BUILTIN_TEMPLATES = {
@@ -6958,7 +7040,8 @@ const BUILTIN_TEMPLATES = {
6958
7040
  name: "Done",
6959
7041
  layout: "table",
6960
7042
  filter: "status:Done"
6961
- }
7043
+ },
7044
+ ...BOARD_ISSUE_VIEWS
6962
7045
  ],
6963
7046
  rules: ["Auto-add sub-issues to project"]
6964
7047
  },
@@ -6995,16 +7078,20 @@ const BUILTIN_TEMPLATES = {
6995
7078
  name: "Sprint",
6996
7079
  type: "text"
6997
7080
  }],
6998
- views: [{
6999
- name: "Active",
7000
- layout: "table",
7001
- filter: "-status:Done",
7002
- default: true
7003
- }, {
7004
- name: "Done",
7005
- layout: "table",
7006
- filter: "status:Done"
7007
- }]
7081
+ views: [
7082
+ {
7083
+ name: "Active",
7084
+ layout: "table",
7085
+ filter: "-status:Done",
7086
+ default: true
7087
+ },
7088
+ {
7089
+ name: "Done",
7090
+ layout: "table",
7091
+ filter: "status:Done"
7092
+ },
7093
+ ...BOARD_ISSUE_VIEWS
7094
+ ]
7008
7095
  }
7009
7096
  };
7010
7097
  // src/commands/project/templates/resolve-template/resolve-template.ts
@@ -18547,6 +18634,75 @@ function compareRequiredContexts(derived, found) {
18547
18634
  flagExtra: false
18548
18635
  }), ...stale];
18549
18636
  }
18637
+ // src/issue-views/view-link/view-link.ts
18638
+ /**
18639
+ * The link that opens a repository's Issues page with a view's filter typed in, so saving the view is one click and a
18640
+ * paste (spec `tech-issue-views`, #2733).
18641
+ *
18642
+ * @param owner - The repository's owner.
18643
+ * @param name - The repository's name.
18644
+ * @param filter - The view's filter text.
18645
+ * @returns `https://github.com/<owner>/<name>/issues?q=<url-encoded filter>`.
18646
+ */
18647
+ function viewLink(owner, name, filter) {
18648
+ return `https://github.com/${owner}/${name}/issues?q=${encodeURIComponent(filter)}`;
18649
+ }
18650
+ // src/issue-views/view-settings/view-settings.ts
18651
+ /**
18652
+ * The settings to fill in when saving a view by hand, as one line: icon, colour, visibility and description, each only
18653
+ * when the declaration states it (spec `tech-issue-views`, #2733).
18654
+ *
18655
+ * @param view - The declared view.
18656
+ * @returns For example `icon alert, color red, private, "Let's unblock these"`; empty when none is stated.
18657
+ */
18658
+ function viewSettings(view) {
18659
+ const parts = [];
18660
+ if (view.icon) parts.push(`icon ${view.icon}`);
18661
+ if (view.color) parts.push(`color ${view.color}`);
18662
+ if (view.visibility) parts.push(view.visibility);
18663
+ if (view.description) parts.push(JSON.stringify(view.description));
18664
+ return parts.join(", ");
18665
+ }
18666
+ // src/commands/doctor-repo/view-checks.ts
18667
+ /**
18668
+ * One row per declared saved view (`repo.views`, spec `tech-issue-views`, #2733). GitHub has no API to read a saved
18669
+ * view, so the row cannot say whether it exists: it carries the link that opens the search, the number of issues the
18670
+ * filter matches today and a note saying so. The only failure is a filter the search refuses (HTTP 422), which a person
18671
+ * would otherwise find out after saving it.
18672
+ *
18673
+ * @param views - `repo.views`, if the config has it.
18674
+ * @returns The checks, in declaration order; none when no view is declared.
18675
+ */
18676
+ function viewChecks(views) {
18677
+ return Object.entries(views ?? {}).map(([slug, view]) => ({
18678
+ id: `repo-views:${slug}`,
18679
+ title: `view ${view.name} filter works`,
18680
+ needs: "countIssues",
18681
+ async run(source) {
18682
+ const { owner, name } = await source.getRepo();
18683
+ const link = viewLink(owner, name, view.filter);
18684
+ try {
18685
+ const count = await source.countIssues(view.filter);
18686
+ return {
18687
+ problems: [],
18688
+ checked: 1,
18689
+ info: [
18690
+ `${count} issue${count === 1 ? "" : "s"} match today`,
18691
+ link,
18692
+ "GitHub has no API for saved views, so whether this one is saved is not checked"
18693
+ ]
18694
+ };
18695
+ } catch (err) {
18696
+ if (err instanceof ProviderApiError && err.status === 422) return {
18697
+ problems: [`GitHub's search refuses the filter ${JSON.stringify(view.filter)} (422): ${String(err.details)}`],
18698
+ checked: 1,
18699
+ info: [link]
18700
+ };
18701
+ throw err;
18702
+ }
18703
+ }
18704
+ }));
18705
+ }
18550
18706
  // src/commands/doctor-repo/repo-checks.ts
18551
18707
  const quote = (value) => JSON.stringify(value);
18552
18708
  const onOff = (value) => value ? "on" : "off";
@@ -18701,6 +18857,7 @@ function repoChecks(config, repoRoot, statusContexts) {
18701
18857
  };
18702
18858
  }
18703
18859
  });
18860
+ checks.push(...viewChecks(repo?.views));
18704
18861
  if (repo?.teams && repo.teams.length > 0) {
18705
18862
  const teams = repo.teams;
18706
18863
  checks.push({
@@ -19405,7 +19562,7 @@ async function expectedTokens(input) {
19405
19562
  }));
19406
19563
  }
19407
19564
  // src/commands/doctor-secrets/matrix-names.ts
19408
- const LAYER = /^.+ - (local|dev|ci|prod)$/;
19565
+ const LAYER = /^.+ - (local|dev|ci|prod|preview)$/;
19409
19566
  /**
19410
19567
  * The layer an Environment name ends in, or `fallback` for a name that is not a layer's.
19411
19568
  *
@@ -24877,6 +25034,29 @@ async function statusPagesStep(monitoring, loader, dryRun) {
24877
25034
  }
24878
25035
  return steps;
24879
25036
  }
25037
+ // src/commands/setup/view-steps/view-steps.ts
25038
+ /**
25039
+ * One informational step per declared saved view (`repo.views`, spec `tech-issue-views`, #2733). GitHub has no API to
25040
+ * make a view, so `setup` writes nothing: each step says the view's name, the settings to fill in and the link that
25041
+ * opens the search, so saving it is one click and a paste. The status is `skip`, never `fail`, whatever the state of
25042
+ * the view, because nothing can be checked.
25043
+ *
25044
+ * @param views - `repo.views`, if the config has it.
25045
+ * @param repo - The repository's owner and name; without it the filter is printed instead of a link.
25046
+ * @returns The steps, in declaration order.
25047
+ */
25048
+ function viewSteps(views, repo) {
25049
+ return Object.values(views ?? {}).map((view) => {
25050
+ const settings = viewSettings(view);
25051
+ const where = repo ? viewLink(repo.owner, repo.name, view.filter) : `filter: ${view.filter}`;
25052
+ return {
25053
+ capability: "source",
25054
+ step: `issue view ${view.name}`,
25055
+ status: "skip",
25056
+ message: `GitHub has no API for saved views; save it by hand${settings ? ` (${settings})` : ""}: ${where}`
25057
+ };
25058
+ });
25059
+ }
24880
25060
  // src/commands/setup/run-setup.ts
24881
25061
  /**
24882
25062
  * `holocron setup` — orchestrates per-capability setup actions across
@@ -25078,6 +25258,20 @@ async function runSetup(input) {
25078
25258
  });
25079
25259
  print(formatStep(steps[steps.length - 1]));
25080
25260
  }
25261
+ if (repo?.views && Object.keys(repo.views).length > 0) {
25262
+ let ref;
25263
+ try {
25264
+ const found = await source.getRepo();
25265
+ ref = {
25266
+ owner: found.owner,
25267
+ name: found.name
25268
+ };
25269
+ } catch {}
25270
+ for (const step of viewSteps(repo.views, ref)) {
25271
+ steps.push(step);
25272
+ print(formatStep(step));
25273
+ }
25274
+ }
25081
25275
  const properties = {};
25082
25276
  if (effectivePreset && effectivePreset !== "none") properties["holocron_branch_protection_level"] = effectivePreset;
25083
25277
  const isMonorepo = await isWorkspaceRoot(input.context.repoRoot);