@fuzdev/fuz_gitops 0.78.1 → 0.79.0

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.
Files changed (179) hide show
  1. package/README.md +78 -24
  2. package/dist/ModulesDetail.svelte +15 -22
  3. package/dist/ModulesDetail.svelte.d.ts.map +1 -1
  4. package/dist/ModulesNav.svelte +4 -1
  5. package/dist/ModulesPage.svelte +1 -3
  6. package/dist/ModulesPage.svelte.d.ts.map +1 -1
  7. package/dist/PageHeader.svelte +2 -2
  8. package/dist/PageHeader.svelte.d.ts +0 -3
  9. package/dist/PageHeader.svelte.d.ts.map +1 -1
  10. package/dist/PullRequestsDetail.svelte +10 -9
  11. package/dist/PullRequestsDetail.svelte.d.ts.map +1 -1
  12. package/dist/PullRequestsPage.svelte +1 -3
  13. package/dist/PullRequestsPage.svelte.d.ts.map +1 -1
  14. package/dist/ReposTable.svelte +27 -48
  15. package/dist/ReposTable.svelte.d.ts.map +1 -1
  16. package/dist/ReposTree.svelte +5 -19
  17. package/dist/ReposTree.svelte.d.ts.map +1 -1
  18. package/dist/ReposTreeNav.svelte +5 -7
  19. package/dist/ReposTreeNav.svelte.d.ts.map +1 -1
  20. package/dist/TablePage.svelte +1 -3
  21. package/dist/TablePage.svelte.d.ts.map +1 -1
  22. package/dist/TreeItemPage.svelte +1 -3
  23. package/dist/TreeItemPage.svelte.d.ts.map +1 -1
  24. package/dist/TreePage.svelte +1 -3
  25. package/dist/TreePage.svelte.d.ts.map +1 -1
  26. package/dist/ci_reconcile.d.ts +6 -10
  27. package/dist/ci_reconcile.d.ts.map +1 -1
  28. package/dist/ci_reconcile.js +6 -8
  29. package/dist/dependency_graph.d.ts +26 -49
  30. package/dist/dependency_graph.d.ts.map +1 -1
  31. package/dist/dependency_graph.js +37 -80
  32. package/dist/dependency_updater.d.ts +1 -1
  33. package/dist/dependency_updater.d.ts.map +1 -1
  34. package/dist/dependency_updater.js +6 -1
  35. package/dist/fetch_repo_data.d.ts +34 -8
  36. package/dist/fetch_repo_data.d.ts.map +1 -1
  37. package/dist/fetch_repo_data.js +44 -22
  38. package/dist/fs_fetch_value_cache.d.ts +1 -1
  39. package/dist/fs_fetch_value_cache.js +1 -1
  40. package/dist/git_operations.d.ts +6 -49
  41. package/dist/git_operations.d.ts.map +1 -1
  42. package/dist/git_operations.js +13 -126
  43. package/dist/github.d.ts +17 -2
  44. package/dist/github.d.ts.map +1 -1
  45. package/dist/github.js +15 -6
  46. package/dist/github_helpers.d.ts.map +1 -1
  47. package/dist/github_helpers.js +3 -11
  48. package/dist/gitops_analyze.task.d.ts +24 -2
  49. package/dist/gitops_analyze.task.d.ts.map +1 -1
  50. package/dist/gitops_analyze.task.js +43 -30
  51. package/dist/gitops_config.d.ts +34 -79
  52. package/dist/gitops_config.d.ts.map +1 -1
  53. package/dist/gitops_config.js +76 -53
  54. package/dist/gitops_constants.d.ts +6 -4
  55. package/dist/gitops_constants.d.ts.map +1 -1
  56. package/dist/gitops_constants.js +6 -4
  57. package/dist/gitops_plan.task.d.ts +29 -3
  58. package/dist/gitops_plan.task.d.ts.map +1 -1
  59. package/dist/gitops_plan.task.js +80 -58
  60. package/dist/gitops_publish.task.d.ts +62 -2
  61. package/dist/gitops_publish.task.d.ts.map +1 -1
  62. package/dist/gitops_publish.task.js +187 -102
  63. package/dist/gitops_run.task.d.ts +74 -0
  64. package/dist/gitops_run.task.d.ts.map +1 -1
  65. package/dist/gitops_run.task.js +174 -160
  66. package/dist/gitops_sync.task.d.ts +65 -3
  67. package/dist/gitops_sync.task.d.ts.map +1 -1
  68. package/dist/gitops_sync.task.js +154 -30
  69. package/dist/gitops_task_helpers.d.ts +86 -59
  70. package/dist/gitops_task_helpers.d.ts.map +1 -1
  71. package/dist/gitops_task_helpers.js +120 -79
  72. package/dist/gitops_validate.task.d.ts +1 -2
  73. package/dist/gitops_validate.task.d.ts.map +1 -1
  74. package/dist/gitops_validate.task.js +15 -22
  75. package/dist/graph_validation.d.ts +16 -27
  76. package/dist/graph_validation.d.ts.map +1 -1
  77. package/dist/graph_validation.js +23 -64
  78. package/dist/local_repo.d.ts +50 -62
  79. package/dist/local_repo.d.ts.map +1 -1
  80. package/dist/local_repo.js +80 -193
  81. package/dist/log_helpers.d.ts +8 -8
  82. package/dist/log_helpers.d.ts.map +1 -1
  83. package/dist/multi_repo_publisher.d.ts +10 -0
  84. package/dist/multi_repo_publisher.d.ts.map +1 -1
  85. package/dist/multi_repo_publisher.js +115 -51
  86. package/dist/npm_registry.d.ts +23 -19
  87. package/dist/npm_registry.d.ts.map +1 -1
  88. package/dist/npm_registry.js +20 -47
  89. package/dist/operations.d.ts +75 -180
  90. package/dist/operations.d.ts.map +1 -1
  91. package/dist/operations.js +15 -7
  92. package/dist/operations_defaults.d.ts +17 -2
  93. package/dist/operations_defaults.d.ts.map +1 -1
  94. package/dist/operations_defaults.js +104 -121
  95. package/dist/output_helpers.d.ts +36 -0
  96. package/dist/output_helpers.d.ts.map +1 -1
  97. package/dist/output_helpers.js +37 -3
  98. package/dist/preflight_checks.d.ts +20 -27
  99. package/dist/preflight_checks.d.ts.map +1 -1
  100. package/dist/preflight_checks.js +37 -126
  101. package/dist/publish_steps.d.ts +2 -4
  102. package/dist/publish_steps.d.ts.map +1 -1
  103. package/dist/publish_steps.js +2 -6
  104. package/dist/publishing_event.d.ts +2 -8
  105. package/dist/publishing_event.d.ts.map +1 -1
  106. package/dist/publishing_event.js +5 -4
  107. package/dist/publishing_event_handler.d.ts +10 -8
  108. package/dist/publishing_event_handler.d.ts.map +1 -1
  109. package/dist/publishing_event_handler.js +14 -12
  110. package/dist/publishing_plan.d.ts +16 -1
  111. package/dist/publishing_plan.d.ts.map +1 -1
  112. package/dist/publishing_plan.js +328 -250
  113. package/dist/publishing_plan_logging.d.ts +1 -1
  114. package/dist/publishing_plan_logging.d.ts.map +1 -1
  115. package/dist/publishing_plan_logging.js +21 -14
  116. package/dist/repo.svelte.d.ts +7 -0
  117. package/dist/repo.svelte.d.ts.map +1 -1
  118. package/dist/repo.svelte.js +3 -0
  119. package/dist/repo_readiness.d.ts +210 -0
  120. package/dist/repo_readiness.d.ts.map +1 -0
  121. package/dist/repo_readiness.js +516 -0
  122. package/dist/repos_status.d.ts +3340 -0
  123. package/dist/repos_status.d.ts.map +1 -0
  124. package/dist/repos_status.js +555 -0
  125. package/dist/repos_status_load.d.ts +65 -0
  126. package/dist/repos_status_load.d.ts.map +1 -0
  127. package/dist/repos_status_load.js +131 -0
  128. package/package.json +7 -27
  129. package/src/lib/ci_reconcile.ts +7 -11
  130. package/src/lib/dependency_graph.ts +45 -97
  131. package/src/lib/dependency_updater.ts +7 -1
  132. package/src/lib/fetch_repo_data.ts +66 -29
  133. package/src/lib/fs_fetch_value_cache.ts +1 -1
  134. package/src/lib/git_operations.ts +15 -187
  135. package/src/lib/github.ts +20 -8
  136. package/src/lib/github_helpers.ts +5 -12
  137. package/src/lib/gitops_analyze.task.ts +79 -41
  138. package/src/lib/gitops_config.ts +88 -137
  139. package/src/lib/gitops_constants.ts +6 -4
  140. package/src/lib/gitops_plan.task.ts +113 -61
  141. package/src/lib/gitops_publish.task.ts +255 -122
  142. package/src/lib/gitops_run.task.ts +250 -178
  143. package/src/lib/gitops_sync.task.ts +208 -33
  144. package/src/lib/gitops_task_helpers.ts +166 -110
  145. package/src/lib/gitops_validate.task.ts +17 -27
  146. package/src/lib/graph_validation.ts +25 -86
  147. package/src/lib/local_repo.ts +109 -316
  148. package/src/lib/log_helpers.ts +8 -18
  149. package/src/lib/multi_repo_publisher.ts +138 -53
  150. package/src/lib/npm_registry.ts +37 -62
  151. package/src/lib/operations.ts +78 -150
  152. package/src/lib/operations_defaults.ts +108 -154
  153. package/src/lib/output_helpers.ts +55 -3
  154. package/src/lib/preflight_checks.ts +47 -183
  155. package/src/lib/publish_steps.ts +15 -13
  156. package/src/lib/publishing_event.ts +5 -4
  157. package/src/lib/publishing_event_handler.ts +18 -16
  158. package/src/lib/publishing_plan.ts +451 -287
  159. package/src/lib/publishing_plan_logging.ts +32 -23
  160. package/src/lib/repo.svelte.ts +8 -0
  161. package/src/lib/repo_readiness.ts +647 -0
  162. package/src/lib/repos_status.ts +671 -0
  163. package/src/lib/repos_status_load.ts +173 -0
  164. package/dist/config_reconcile.d.ts +0 -46
  165. package/dist/config_reconcile.d.ts.map +0 -1
  166. package/dist/config_reconcile.js +0 -64
  167. package/dist/paths.d.ts +0 -7
  168. package/dist/paths.d.ts.map +0 -1
  169. package/dist/paths.js +0 -6
  170. package/dist/repo_ops.d.ts +0 -59
  171. package/dist/repo_ops.d.ts.map +0 -1
  172. package/dist/repo_ops.js +0 -170
  173. package/dist/resolved_gitops_config.d.ts +0 -9
  174. package/dist/resolved_gitops_config.d.ts.map +0 -1
  175. package/dist/resolved_gitops_config.js +0 -12
  176. package/src/lib/config_reconcile.ts +0 -98
  177. package/src/lib/paths.ts +0 -6
  178. package/src/lib/repo_ops.ts +0 -216
  179. package/src/lib/resolved_gitops_config.ts +0 -27
@@ -6,7 +6,7 @@
6
6
  * @module
7
7
  */
8
8
  import type { Logger } from '@fuzdev/fuz_util/log.ts';
9
- import type { PublishingPlan } from './publishing_plan.js';
9
+ import { type PublishingPlan } from './publishing_plan.js';
10
10
  export interface LogPlanOptions {
11
11
  verbose?: boolean;
12
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"publishing_plan_logging.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publishing_plan_logging.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,KAAK,EACX,cAAc,EAQd,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,cAAc;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AA2GD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,cAAc,EACpB,KAAK,MAAM,EACX,UAAS,cAAmB,KAC1B,IA6IF,CAAC"}
1
+ {"version":3,"file":"publishing_plan_logging.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publishing_plan_logging.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAGtD,OAAO,EAEN,KAAK,cAAc,EAQnB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,cAAc;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AA6GD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC/B,MAAM,cAAc,EACpB,KAAK,MAAM,EACX,UAAS,cAAmB,KAC1B,IAmJF,CAAC"}
@@ -6,6 +6,7 @@
6
6
  * @module
7
7
  */
8
8
  import { styleText as st } from 'node:util';
9
+ import { version_change_kind } from './publishing_plan.js';
9
10
  const SEPARATOR = '────────────────────────────────────────';
10
11
  /**
11
12
  * Logs a section header with separators.
@@ -45,23 +46,24 @@ const get_updates_for_package = (pkg_name, dependency_updates) => {
45
46
  const log_version_change_with_diffs = (change, index, total, dependency_updates, breaking_cascades, log) => {
46
47
  const breaking_indicator = change.breaking ? st('red', ' BREAKING') : '';
47
48
  const position = st('dim', `[${index + 1}/${total}]`);
49
+ const kind = version_change_kind(change);
48
50
  // Determine scenario label
49
51
  let scenario_label = '';
50
- if (change.needs_bump_escalation) {
52
+ if (kind === 'escalation') {
51
53
  scenario_label = st('yellow', ` [${change.existing_bump} → ${change.required_bump}]`);
52
54
  }
53
- else if (change.will_generate_changeset) {
55
+ else if (kind === 'auto') {
54
56
  scenario_label = st('cyan', ' [auto-changeset]');
55
57
  }
56
58
  // Main version line
57
59
  log.info(`${position} ${change.package_name}: ${change.from} → ${st('green', change.to)} ` +
58
60
  `(${change.bump_type})${scenario_label}${breaking_indicator}`);
59
61
  // Show escalation reason
60
- if (change.needs_bump_escalation) {
62
+ if (kind === 'escalation') {
61
63
  log.info(st('dim', ` changesets specify ${change.existing_bump}, dependencies require ${change.required_bump}`));
62
64
  }
63
65
  // Show trigger reason for auto-changesets
64
- if (change.will_generate_changeset) {
66
+ if (kind === 'auto') {
65
67
  // Find what triggered this
66
68
  const triggers = [];
67
69
  for (const [pkg, affected] of breaking_cascades) {
@@ -93,7 +95,7 @@ const log_version_change_with_diffs = (change, index, total, dependency_updates,
93
95
  * dependency-only updates, warnings, and a summary.
94
96
  */
95
97
  export const log_publishing_plan = (plan, log, options = {}) => {
96
- const { publishing_order, version_changes, dependency_updates, breaking_cascades, warnings, info, errors } = plan;
98
+ const { publishing_order, version_changes, dependency_updates, breaking_cascades, warnings, info, no_changes, errors } = plan;
97
99
  // Errors first (blocking issues)
98
100
  if (errors.length > 0) {
99
101
  log.error(st('red', 'Errors:'));
@@ -116,14 +118,14 @@ export const log_publishing_plan = (plan, log, options = {}) => {
116
118
  const idx_b = publishing_order.indexOf(b.package_name);
117
119
  return idx_a - idx_b;
118
120
  });
119
- // Separate into groups for headers
120
- const with_changesets = ordered_changes.filter((vc) => vc.has_changesets && !vc.needs_bump_escalation);
121
- const with_escalation = ordered_changes.filter((vc) => vc.needs_bump_escalation);
122
- const with_auto_changesets = ordered_changes.filter((vc) => vc.will_generate_changeset);
121
+ // Separate into groups for headers; each change lands in exactly one
122
+ const with_changesets = ordered_changes.filter((vc) => version_change_kind(vc) === 'explicit');
123
+ const with_escalation = ordered_changes.filter((vc) => version_change_kind(vc) === 'escalation');
124
+ const with_auto_changesets = ordered_changes.filter((vc) => version_change_kind(vc) === 'auto');
123
125
  // A single running counter across all groups so positions read 1..N with no
124
126
  // gaps. (Numbering per-group index would make the first group skip the numbers
125
127
  // that land in a later group, e.g. jump from `[9/12]` to `[11/12]`.)
126
- const total = with_changesets.length + with_escalation.length + with_auto_changesets.length;
128
+ const total = ordered_changes.length;
127
129
  let position = 0;
128
130
  const log_change_group = (title, color, changes) => {
129
131
  if (changes.length === 0)
@@ -174,14 +176,19 @@ export const log_publishing_plan = (plan, log, options = {}) => {
174
176
  }
175
177
  log.info('');
176
178
  }
177
- // Info (packages with no changes)
178
- if (info.length > 0) {
179
- log.info(st('dim', `No changes: ${info.join(', ')}`));
179
+ // Info sentences, then the packages with nothing to publish
180
+ for (const line of info) {
181
+ log.info(st('dim', line));
182
+ }
183
+ if (no_changes.length > 0) {
184
+ log.info(st('dim', `No changes: ${no_changes.join(', ')}`));
185
+ }
186
+ if (info.length > 0 || no_changes.length > 0) {
180
187
  log.info('');
181
188
  }
182
189
  // Summary
183
190
  const major_count = version_changes.filter((vc) => vc.breaking).length;
184
- const auto_count = version_changes.filter((vc) => vc.will_generate_changeset).length;
191
+ const auto_count = version_changes.filter((vc) => version_change_kind(vc) === 'auto').length;
185
192
  log.info(st('cyan', 'Summary:'));
186
193
  log.info(` ${version_changes.length} packages to publish`);
187
194
  if (auto_count > 0) {
@@ -14,6 +14,11 @@ import { GithubCheckRunsItem, type GithubPullRequest } from './github.js';
14
14
  export interface RepoJson {
15
15
  library_json: LibraryJson;
16
16
  package_json: PackageJson;
17
+ /**
18
+ * The branch the repo's registry entry follows, which `check_runs` was
19
+ * fetched for. `Repo.branch` reads `main` when it's absent.
20
+ */
21
+ branch?: string;
17
22
  check_runs: GithubCheckRunsItem | null;
18
23
  pull_requests: Array<GithubPullRequest> | null;
19
24
  }
@@ -27,6 +32,8 @@ export declare class Repo {
27
32
  readonly library: Library;
28
33
  /** The repo's full `package.json` (with `dependencies`/`devDependencies`). */
29
34
  readonly package_json: PackageJson;
35
+ /** The branch CI status was fetched for and the dashboard links to. */
36
+ readonly branch: string;
30
37
  check_runs: GithubCheckRunsItem | null;
31
38
  pull_requests: Array<GithubPullRequest> | null;
32
39
  get name(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"repo.svelte.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/repo.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8B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,MAAM,CAEjB;IACD,IAAI,SAAS,IAAI,MAAM,CAEtB;IACD,IAAI,QAAQ,IAAI,GAAG,CAElB;IACD,IAAI,YAAY,IAAI,GAAG,GAAG,IAAI,CAE7B;IACD,IAAI,QAAQ,IAAI,GAAG,GAAG,IAAI,CAEzB;IACD,IAAI,QAAQ,IAAI,MAAM,CAErB;IACD,IAAI,OAAO,IAAI,GAAG,GAAG,IAAI,CAExB;IACD,IAAI,aAAa,IAAI,GAAG,GAAG,IAAI,CAE9B;IACD,gGAAgG;IAChG,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,WAAW,IAAI,UAAU,CAE5B;gBAEW,SAAS,EAAE,QAAQ;CAO/B;AAED,MAAM,WAAW,KAAK;IACrB,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;CACnB;AAED,eAAO,MAAM,aAAa;;;;CAA0B,CAAC;AAErD,eAAO,MAAM,WAAW,GAAI,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,MAAM,KAAG,KAMtE,CAAC"}
@@ -11,6 +11,8 @@ export class Repo {
11
11
  library;
12
12
  /** The repo's full `package.json` (with `dependencies`/`devDependencies`). */
13
13
  package_json;
14
+ /** The branch CI status was fetched for and the dashboard links to. */
15
+ branch;
14
16
  check_runs;
15
17
  pull_requests;
16
18
  // Convenience getters delegating to library
@@ -48,6 +50,7 @@ export class Repo {
48
50
  constructor(repo_json) {
49
51
  this.library = new Library(repo_json.library_json);
50
52
  this.package_json = repo_json.package_json;
53
+ this.branch = repo_json.branch ?? 'main';
51
54
  this.check_runs = repo_json.check_runs;
52
55
  this.pull_requests = repo_json.pull_requests;
53
56
  }
@@ -0,0 +1,210 @@
1
+ /**
2
+ * Whether each configured repo sits where the registry puts it, read from the
3
+ * entries `repos status --json` reports: the facts `gitops_publish --wetrun`
4
+ * gates on, the ones `gitops_sync` refuses or warns on, and the at-rest block
5
+ * the read-only diagnostics print.
6
+ *
7
+ * Pure — a report's facts in, problems and their messages out; no git calls.
8
+ * The facts are decided on the Rust side (`at_rest`, `fetch_error`, a
9
+ * checkout's `busy`, `needs_human`); this reads them, never re-derives them.
10
+ *
11
+ * Three readings:
12
+ *
13
+ * - **at rest** (`repo_readiness_at_rest`) — the primary checkout on the
14
+ * branch the entry follows, clean (untracked files count), no operation in
15
+ * progress, and that branch in sync with its origin upstream as of the
16
+ * local remote-tracking refs. What the diagnostics report.
17
+ * - **ready to publish** (`repo_readiness_for_publish`) — at rest, except
18
+ * that the followed branch may be ahead of origin (origin's tip is then an
19
+ * ancestor, so the plan misses nothing and the release push is still a
20
+ * fast-forward), and also fetched without error (so the relation is
21
+ * origin's current word), no other live Claude Code session in the primary
22
+ * checkout (the executor commits there), and nothing the entry leaves to a
23
+ * person (`needs_human`).
24
+ * - **ready to generate** (`repo_readiness_for_gen`) — what `gitops_sync`
25
+ * needs before it writes the dashboard's site data: the primary checkout
26
+ * on its branch, clean, and idle, since the site pairs each repo's local
27
+ * tree with origin's CI. The followed branch's relation to origin and a
28
+ * failed fetch only warn.
29
+ *
30
+ * @module
31
+ */
32
+ import type { Result } from '@fuzdev/fuz_util/result.ts';
33
+ import type { ReposEntryStatus, ReposFetchFailure, ReposHead, ReposInProgressOp, ReposNeedsHuman, ReposRelation, ReposSession, ReposStatusReport, ReposUncommitted } from './repos_status.js';
34
+ /** One way a repo isn't where the registry puts it, or isn't ready to publish. */
35
+ export type RepoReadinessProblem = {
36
+ kind: 'unprobed';
37
+ detail: string;
38
+ } | {
39
+ kind: 'no_branch';
40
+ } | {
41
+ kind: 'off_branch';
42
+ branch: string;
43
+ head: ReposHead;
44
+ } | {
45
+ kind: 'dirty';
46
+ uncommitted: ReposUncommitted;
47
+ } | {
48
+ kind: 'in_progress';
49
+ op: ReposInProgressOp | null;
50
+ } | {
51
+ kind: 'followed';
52
+ branch: string;
53
+ relation: ReposRelation | null;
54
+ } | {
55
+ kind: 'fetch_failed';
56
+ failure: ReposFetchFailure;
57
+ } | {
58
+ kind: 'busy';
59
+ sessions: Array<ReposSession>;
60
+ } | {
61
+ kind: 'needs_human';
62
+ reason: ReposNeedsHuman;
63
+ };
64
+ /** A repo's readiness problems, by registry key; `entry` is `null` when the report lacks it. */
65
+ export interface RepoReadiness {
66
+ key: string;
67
+ entry: ReposEntryStatus | null;
68
+ problems: Array<RepoReadinessProblem>;
69
+ }
70
+ /**
71
+ * The ways an entry's primary checkout isn't at rest where the registry puts
72
+ * it, from its `at_rest` facts: empty when it is.
73
+ *
74
+ * @param entry - the entry as `repos status --json` reported it
75
+ * @returns the problems, in a fixed order: unprobed alone, else branch, dirt, operation, then the followed branch's relation
76
+ */
77
+ export declare const repo_readiness_at_rest: (entry: ReposEntryStatus) => Array<RepoReadinessProblem>;
78
+ /**
79
+ * The ways an entry isn't ready for `gitops_publish --wetrun`: not at rest
80
+ * (`repo_readiness_at_rest`) other than its followed branch being ahead of
81
+ * origin, its fetch failed, another live session works in its primary
82
+ * checkout, or it has a `needs_human` reason. Ahead is ready: origin's tip is
83
+ * an ancestor of the branch, so the plan misses nothing and `gro publish`'s
84
+ * push stays a fast-forward, pushing those commits with the release (see
85
+ * `format_readiness_ahead`). A reason restating
86
+ * an at-rest problem (the primary's operation or detached HEAD) is left out,
87
+ * and a `default_branch_*` reason stands in for the followed-branch problem
88
+ * it explains.
89
+ *
90
+ * @param entry - the entry as `repos status --fetch --json` reported it
91
+ * @returns the problems; empty when the entry is ready
92
+ */
93
+ export declare const repo_readiness_for_publish: (entry: ReposEntryStatus) => Array<RepoReadinessProblem>;
94
+ /** Options for the messages naming what's wrong and the fix. */
95
+ export interface RepoReadinessFormatOptions {
96
+ /** The `repos` invocation fixes name; `repos --registry <path>` when the run passed one. */
97
+ repos_command?: string;
98
+ }
99
+ /**
100
+ * What a readiness problem says is wrong with the repo keyed `key`, and the
101
+ * fix, when there is one to name.
102
+ *
103
+ * @param key - the repo's registry key
104
+ * @param problem - one of the repo's readiness problems
105
+ * @param options - the `repos` invocation fixes name
106
+ * @returns what's wrong, and the fix
107
+ */
108
+ export declare const format_repo_readiness_problem: (key: string, problem: RepoReadinessProblem, options?: RepoReadinessFormatOptions) => {
109
+ what: string;
110
+ fix: string;
111
+ };
112
+ /**
113
+ * Checks a `repos status --fetch --json` report on the repos a real publish
114
+ * reads and writes: every key's entry ready (`repo_readiness_for_publish`),
115
+ * the report fetched, and busy detection available, since a live session it
116
+ * can't vouch for may be working in any checkout.
117
+ *
118
+ * @param options.report - the report, made with `--fetch`
119
+ * @param options.keys - the registry keys that must be ready
120
+ * @returns `ahead`, the ready repos whose followed branch is ahead of origin; and on failure a message naming each repo, what's wrong, and the fix, its `lines`, and every not-ready repo
121
+ */
122
+ export declare const check_publish_readiness: (options: {
123
+ report: ReposStatusReport;
124
+ keys: ReadonlyArray<string>;
125
+ } & RepoReadinessFormatOptions) => Result<{
126
+ ahead: Array<ReadinessAhead>;
127
+ }, {
128
+ message: string;
129
+ lines: Array<string>;
130
+ not_ready: Array<RepoReadiness>;
131
+ ahead: Array<ReadinessAhead>;
132
+ }>;
133
+ /**
134
+ * An entry's problems for `gitops_sync`, split by what they do to the run:
135
+ * `refused` stops it, `warned` is logged. Off its branch, dirty, or mid-operation
136
+ * refuses, since the site would show that working tree's modules beside origin's
137
+ * CI — unless `allow_dirty`, which reads the repo as it sits and warns instead.
138
+ * A checkout that can't be read, or an entry following no branch (only a
139
+ * reference follows none, and the config refuses references), always
140
+ * refuses. The followed branch not in sync
141
+ * with origin (behind, say: CI is origin's tip, the modules the local tree) and
142
+ * a failed fetch (the last fetch's view stands) warn. Busy sessions and
143
+ * `needs_human` reasons don't matter: generating writes nothing in the repo.
144
+ *
145
+ * @param entry - the entry as `repos status --json` reported it
146
+ * @param options.allow_dirty - read a repo off its branch, dirty, or mid-operation as it sits
147
+ * @returns the problems that refuse, and those that warn
148
+ */
149
+ export declare const repo_readiness_for_gen: (entry: ReposEntryStatus, options?: {
150
+ allow_dirty?: boolean;
151
+ }) => {
152
+ refused: Array<RepoReadinessProblem>;
153
+ warned: Array<RepoReadinessProblem>;
154
+ };
155
+ /**
156
+ * Checks a `repos status --json` report on the repos `gitops_sync` generates
157
+ * the site data from (`repo_readiness_for_gen`).
158
+ *
159
+ * @param options.report - the report
160
+ * @param options.keys - the registry keys whose repos the site data reads
161
+ * @param options.allow_dirty - read repos off their branch, dirty, or mid-operation as they sit
162
+ * @param options.now - the current time in unix seconds, for how long ago each repo was fetched (defaults to the clock)
163
+ * @returns `warnings`, a line per problem that doesn't refuse; and on failure also a message naming each refused repo, what's wrong, and the fix, and its `lines`
164
+ */
165
+ export declare const check_gen_readiness: (options: {
166
+ report: ReposStatusReport;
167
+ keys: ReadonlyArray<string>;
168
+ allow_dirty?: boolean;
169
+ now?: number;
170
+ } & RepoReadinessFormatOptions) => Result<{
171
+ warnings: Array<string>;
172
+ }, {
173
+ message: string;
174
+ lines: Array<string>;
175
+ warnings: Array<string>;
176
+ }>;
177
+ /** A ready repo whose followed branch is ahead of origin: commits a publish pushes. */
178
+ export interface ReadinessAhead {
179
+ key: string;
180
+ branch: string;
181
+ commits: number;
182
+ }
183
+ /**
184
+ * Says what happens to a ready repo's commits ahead of origin: its release
185
+ * push carries them when it publishes, else they stay unpushed.
186
+ *
187
+ * @param ahead - the repo, its branch, and how many commits it's ahead
188
+ * @param publishes - whether the plan publishes it
189
+ * @param options - the `repos` invocation the message names
190
+ * @returns the line to log
191
+ */
192
+ export declare const format_readiness_ahead: (ahead: ReadinessAhead, publishes: boolean, options?: RepoReadinessFormatOptions) => string;
193
+ /**
194
+ * The repos not at rest, for the read-only diagnostics' readiness block.
195
+ *
196
+ * @param entries - the entries of the repos a diagnostic reads
197
+ * @returns each entry with at-rest problems, in the order given
198
+ */
199
+ export declare const repos_not_at_rest: (entries: ReadonlyArray<ReposEntryStatus>) => Array<RepoReadiness>;
200
+ /**
201
+ * Formats the diagnostics' readiness block: a header and a line per problem,
202
+ * saying what each repo not at rest is doing instead — or no lines when every
203
+ * repo is at rest. Not a failure: the diagnostics read repos as they sit.
204
+ *
205
+ * @param not_ready - `repos_not_at_rest`'s result
206
+ * @param now - the current time in unix seconds, for how long ago each repo was fetched
207
+ * @returns the block's lines, unindented header first
208
+ */
209
+ export declare const format_readiness_block: (not_ready: ReadonlyArray<RepoReadiness>, now: number) => Array<string>;
210
+ //# sourceMappingURL=repo_readiness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo_readiness.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/repo_readiness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EACX,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAGhB,MAAM,mBAAmB,CAAC;AAE3B,kFAAkF;AAClF,MAAM,MAAM,oBAAoB,GAC7B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,gBAAgB,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,iBAAiB,GAAG,IAAI,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,GACpE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,GACpD;IAA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