@fuzdev/fuz_gitops 0.78.0 → 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 (196) hide show
  1. package/README.md +91 -17
  2. package/dist/ModulesDetail.svelte +22 -27
  3. package/dist/ModulesDetail.svelte.d.ts.map +1 -1
  4. package/dist/ModulesNav.svelte +8 -5
  5. package/dist/ModulesNav.svelte.d.ts.map +1 -1
  6. package/dist/ModulesPage.svelte +3 -5
  7. package/dist/ModulesPage.svelte.d.ts.map +1 -1
  8. package/dist/PageFooter.svelte +2 -2
  9. package/dist/PageHeader.svelte +6 -6
  10. package/dist/PageHeader.svelte.d.ts +0 -3
  11. package/dist/PageHeader.svelte.d.ts.map +1 -1
  12. package/dist/PullRequestsDetail.svelte +29 -20
  13. package/dist/PullRequestsDetail.svelte.d.ts.map +1 -1
  14. package/dist/PullRequestsPage.svelte +4 -6
  15. package/dist/PullRequestsPage.svelte.d.ts.map +1 -1
  16. package/dist/ReposTable.svelte +43 -55
  17. package/dist/ReposTable.svelte.d.ts.map +1 -1
  18. package/dist/ReposTree.svelte +9 -21
  19. package/dist/ReposTree.svelte.d.ts.map +1 -1
  20. package/dist/ReposTreeNav.svelte +9 -12
  21. package/dist/ReposTreeNav.svelte.d.ts.map +1 -1
  22. package/dist/TablePage.svelte +3 -5
  23. package/dist/TablePage.svelte.d.ts.map +1 -1
  24. package/dist/TreeItemPage.svelte +3 -5
  25. package/dist/TreeItemPage.svelte.d.ts.map +1 -1
  26. package/dist/TreePage.svelte +3 -5
  27. package/dist/TreePage.svelte.d.ts.map +1 -1
  28. package/dist/changeset_generator.d.ts.map +1 -1
  29. package/dist/changeset_generator.js +2 -2
  30. package/dist/changeset_reader.d.ts.map +1 -1
  31. package/dist/changeset_reader.js +3 -3
  32. package/dist/ci_reconcile.d.ts +6 -10
  33. package/dist/ci_reconcile.d.ts.map +1 -1
  34. package/dist/ci_reconcile.js +6 -8
  35. package/dist/dependency_graph.d.ts +26 -49
  36. package/dist/dependency_graph.d.ts.map +1 -1
  37. package/dist/dependency_graph.js +40 -83
  38. package/dist/dependency_updater.d.ts +1 -1
  39. package/dist/dependency_updater.d.ts.map +1 -1
  40. package/dist/dependency_updater.js +14 -9
  41. package/dist/fetch_repo_data.d.ts +34 -8
  42. package/dist/fetch_repo_data.d.ts.map +1 -1
  43. package/dist/fetch_repo_data.js +44 -22
  44. package/dist/fs_fetch_value_cache.d.ts +1 -1
  45. package/dist/fs_fetch_value_cache.d.ts.map +1 -1
  46. package/dist/fs_fetch_value_cache.js +3 -3
  47. package/dist/git_operations.d.ts +6 -49
  48. package/dist/git_operations.d.ts.map +1 -1
  49. package/dist/git_operations.js +13 -126
  50. package/dist/github.d.ts +17 -2
  51. package/dist/github.d.ts.map +1 -1
  52. package/dist/github.js +17 -8
  53. package/dist/github_helpers.d.ts.map +1 -1
  54. package/dist/github_helpers.js +3 -11
  55. package/dist/gitops_analyze.task.d.ts +24 -2
  56. package/dist/gitops_analyze.task.d.ts.map +1 -1
  57. package/dist/gitops_analyze.task.js +47 -34
  58. package/dist/gitops_config.d.ts +34 -79
  59. package/dist/gitops_config.d.ts.map +1 -1
  60. package/dist/gitops_config.js +76 -53
  61. package/dist/gitops_constants.d.ts +6 -4
  62. package/dist/gitops_constants.d.ts.map +1 -1
  63. package/dist/gitops_constants.js +6 -4
  64. package/dist/gitops_plan.task.d.ts +29 -3
  65. package/dist/gitops_plan.task.d.ts.map +1 -1
  66. package/dist/gitops_plan.task.js +83 -61
  67. package/dist/gitops_publish.task.d.ts +62 -2
  68. package/dist/gitops_publish.task.d.ts.map +1 -1
  69. package/dist/gitops_publish.task.js +193 -105
  70. package/dist/gitops_run.task.d.ts +74 -0
  71. package/dist/gitops_run.task.d.ts.map +1 -1
  72. package/dist/gitops_run.task.js +176 -162
  73. package/dist/gitops_sync.task.d.ts +65 -3
  74. package/dist/gitops_sync.task.d.ts.map +1 -1
  75. package/dist/gitops_sync.task.js +163 -37
  76. package/dist/gitops_task_helpers.d.ts +86 -59
  77. package/dist/gitops_task_helpers.d.ts.map +1 -1
  78. package/dist/gitops_task_helpers.js +120 -79
  79. package/dist/gitops_validate.task.d.ts +1 -2
  80. package/dist/gitops_validate.task.d.ts.map +1 -1
  81. package/dist/gitops_validate.task.js +25 -32
  82. package/dist/graph_validation.d.ts +16 -27
  83. package/dist/graph_validation.d.ts.map +1 -1
  84. package/dist/graph_validation.js +24 -65
  85. package/dist/local_repo.d.ts +50 -62
  86. package/dist/local_repo.d.ts.map +1 -1
  87. package/dist/local_repo.js +83 -196
  88. package/dist/log_helpers.d.ts +8 -8
  89. package/dist/log_helpers.d.ts.map +1 -1
  90. package/dist/multi_repo_publisher.d.ts +10 -0
  91. package/dist/multi_repo_publisher.d.ts.map +1 -1
  92. package/dist/multi_repo_publisher.js +125 -61
  93. package/dist/npm_registry.d.ts +23 -19
  94. package/dist/npm_registry.d.ts.map +1 -1
  95. package/dist/npm_registry.js +21 -48
  96. package/dist/operations.d.ts +75 -180
  97. package/dist/operations.d.ts.map +1 -1
  98. package/dist/operations.js +15 -7
  99. package/dist/operations_defaults.d.ts +17 -2
  100. package/dist/operations_defaults.d.ts.map +1 -1
  101. package/dist/operations_defaults.js +111 -128
  102. package/dist/output_helpers.d.ts +36 -0
  103. package/dist/output_helpers.d.ts.map +1 -1
  104. package/dist/output_helpers.js +37 -3
  105. package/dist/preflight_checks.d.ts +20 -27
  106. package/dist/preflight_checks.d.ts.map +1 -1
  107. package/dist/preflight_checks.js +37 -126
  108. package/dist/publish_gate.d.ts.map +1 -1
  109. package/dist/publish_steps.d.ts +2 -4
  110. package/dist/publish_steps.d.ts.map +1 -1
  111. package/dist/publish_steps.js +4 -8
  112. package/dist/publishing_event.d.ts +2 -8
  113. package/dist/publishing_event.d.ts.map +1 -1
  114. package/dist/publishing_event.js +20 -17
  115. package/dist/publishing_event_handler.d.ts +10 -8
  116. package/dist/publishing_event_handler.d.ts.map +1 -1
  117. package/dist/publishing_event_handler.js +19 -17
  118. package/dist/publishing_plan.d.ts +16 -1
  119. package/dist/publishing_plan.d.ts.map +1 -1
  120. package/dist/publishing_plan.js +332 -254
  121. package/dist/publishing_plan_helpers.d.ts.map +1 -1
  122. package/dist/publishing_plan_helpers.js +3 -3
  123. package/dist/publishing_plan_logging.d.ts +1 -1
  124. package/dist/publishing_plan_logging.d.ts.map +1 -1
  125. package/dist/publishing_plan_logging.js +22 -15
  126. package/dist/repo.svelte.d.ts +7 -0
  127. package/dist/repo.svelte.d.ts.map +1 -1
  128. package/dist/repo.svelte.js +3 -0
  129. package/dist/repo_readiness.d.ts +210 -0
  130. package/dist/repo_readiness.d.ts.map +1 -0
  131. package/dist/repo_readiness.js +516 -0
  132. package/dist/repos_status.d.ts +3340 -0
  133. package/dist/repos_status.d.ts.map +1 -0
  134. package/dist/repos_status.js +555 -0
  135. package/dist/repos_status_load.d.ts +65 -0
  136. package/dist/repos_status_load.d.ts.map +1 -0
  137. package/dist/repos_status_load.js +131 -0
  138. package/dist/version_utils.js +1 -1
  139. package/package.json +15 -34
  140. package/src/lib/cargo_toml.ts +3 -3
  141. package/src/lib/changeset_generator.ts +19 -19
  142. package/src/lib/changeset_reader.ts +18 -18
  143. package/src/lib/ci_reconcile.ts +12 -16
  144. package/src/lib/dependency_graph.ts +61 -113
  145. package/src/lib/dependency_updater.ts +36 -30
  146. package/src/lib/fetch_repo_data.ts +71 -34
  147. package/src/lib/fs_fetch_value_cache.ts +15 -11
  148. package/src/lib/git_operations.ts +22 -194
  149. package/src/lib/github.ts +33 -21
  150. package/src/lib/github_helpers.ts +9 -16
  151. package/src/lib/gitops_analyze.task.ts +104 -66
  152. package/src/lib/gitops_config.ts +90 -139
  153. package/src/lib/gitops_constants.ts +6 -4
  154. package/src/lib/gitops_plan.task.ts +128 -76
  155. package/src/lib/gitops_publish.task.ts +280 -144
  156. package/src/lib/gitops_run.task.ts +265 -193
  157. package/src/lib/gitops_sync.task.ts +236 -52
  158. package/src/lib/gitops_task_helpers.ts +170 -114
  159. package/src/lib/gitops_validate.task.ts +44 -54
  160. package/src/lib/graph_validation.ts +28 -89
  161. package/src/lib/local_repo.ts +128 -335
  162. package/src/lib/log_helpers.ts +18 -28
  163. package/src/lib/multi_repo_publisher.ts +192 -110
  164. package/src/lib/npm_registry.ts +42 -67
  165. package/src/lib/operations.ts +99 -160
  166. package/src/lib/operations_defaults.ts +157 -201
  167. package/src/lib/output_helpers.ts +58 -6
  168. package/src/lib/preflight_checks.ts +52 -188
  169. package/src/lib/publish_gate.ts +7 -9
  170. package/src/lib/publish_steps.ts +27 -25
  171. package/src/lib/publishing_event.ts +26 -23
  172. package/src/lib/publishing_event_handler.ts +24 -22
  173. package/src/lib/publishing_plan.ts +474 -310
  174. package/src/lib/publishing_plan_helpers.ts +16 -12
  175. package/src/lib/publishing_plan_logging.ts +53 -44
  176. package/src/lib/repo.svelte.ts +16 -8
  177. package/src/lib/repo_readiness.ts +647 -0
  178. package/src/lib/repos_status.ts +671 -0
  179. package/src/lib/repos_status_load.ts +173 -0
  180. package/src/lib/version_utils.ts +3 -3
  181. package/dist/config_reconcile.d.ts +0 -46
  182. package/dist/config_reconcile.d.ts.map +0 -1
  183. package/dist/config_reconcile.js +0 -60
  184. package/dist/paths.d.ts +0 -7
  185. package/dist/paths.d.ts.map +0 -1
  186. package/dist/paths.js +0 -6
  187. package/dist/repo_ops.d.ts +0 -59
  188. package/dist/repo_ops.d.ts.map +0 -1
  189. package/dist/repo_ops.js +0 -170
  190. package/dist/resolved_gitops_config.d.ts +0 -9
  191. package/dist/resolved_gitops_config.d.ts.map +0 -1
  192. package/dist/resolved_gitops_config.js +0 -12
  193. package/src/lib/config_reconcile.ts +0 -94
  194. package/src/lib/paths.ts +0 -6
  195. package/src/lib/repo_ops.ts +0 -216
  196. package/src/lib/resolved_gitops_config.ts +0 -27
@@ -1,103 +1,47 @@
1
1
  /**
2
- * Shared dependency graph validation logic used across multiple workflows.
2
+ * Dependency graph validation shared by the publishing plan and the analysis tasks.
3
3
  *
4
- * Consolidates graph building, cycle detection, and publishing order computation
5
- * that was duplicated in three places: `multi_repo_publisher.ts`, `publishing_plan.ts`,
6
- * and `gitops_analyze.task.ts`.
4
+ * Builds the graph, detects cycles by type, and computes the publishing order,
5
+ * reporting cycles and sort failures in the result rather than throwing, so
6
+ * each caller decides how to surface them: the plan turns them into errors,
7
+ * `gitops_analyze` and `gitops_validate` format them.
7
8
  *
8
- * Options pattern supports different behaviors: analyze can tolerate cycles for
9
- * reporting, while publish must throw on production cycles.
10
- *
11
- * See also: `dependency_graph.ts` for core graph data structure and algorithms.
9
+ * See also: `dependency_graph.ts` for the core graph data structure and algorithms.
12
10
  *
13
11
  * @module
14
12
  */
15
13
 
16
- import type {Logger} from '@fuzdev/fuz_util/log.ts';
17
- import {TaskError} from '@fuzdev/gro';
18
- import {styleText as st} from 'node:util';
19
-
20
- import {DependencyGraph, DependencyGraphBuilder} from './dependency_graph.ts';
21
- import {repo_is_npm, type LocalRepo} from './local_repo.ts';
14
+ import { DependencyGraph, type DependencyAnalysis } from './dependency_graph.ts';
15
+ import { repo_is_npm, type LocalRepo } from './local_repo.ts';
22
16
 
23
17
  export interface GraphValidationResult {
24
18
  graph: DependencyGraph;
25
19
  publishing_order: Array<string>;
26
20
  production_cycles: Array<Array<string>>;
27
21
  dev_cycles: Array<Array<string>>;
28
- sort_error?: string; // Error message if topological sort failed
22
+ /** Why the topological sort failed, when it did; `publishing_order` is then empty. */
23
+ sort_error?: string;
29
24
  }
30
25
 
31
26
  /**
32
- * Shared utility for building dependency graph, detecting cycles, and computing publishing order.
33
- * This centralizes logic that was duplicated across `multi_repo_publisher`, `publishing_plan`, and `gitops_analyze`.
27
+ * Builds the dependency graph, detects cycles, and computes the publishing order
28
+ * (prod/peer dependencies only, so dev cycles don't block it).
34
29
  *
35
- * @param options.throw_on_prod_cycles - whether to throw an error if production cycles are detected (default: true)
36
- * @param options.log_cycles - whether to log cycle information (default: true)
37
- * @param options.log_order - whether to log publishing order (default: true)
38
- * @returns graph validation result with graph, publishing order, and detected cycles
39
- * @throws {TaskError} if production cycles detected and `throw_on_prod_cycles` is true
30
+ * Never throws on cycles: a production/peer cycle leaves `publishing_order` empty
31
+ * and sets `sort_error`, and the caller reports it.
32
+ *
33
+ * @returns the graph, publishing order, and detected cycles
40
34
  */
41
- export const validate_dependency_graph = (
42
- repos: Array<LocalRepo>,
43
- options: {
44
- log?: Logger;
45
- throw_on_prod_cycles?: boolean;
46
- log_cycles?: boolean;
47
- log_order?: boolean;
48
- } = {},
49
- ): GraphValidationResult => {
50
- const {log, throw_on_prod_cycles = true, log_cycles = true, log_order = true} = options;
51
-
52
- // Build dependency graph
53
- log?.info('📊 Analyzing dependencies...');
54
- const builder = new DependencyGraphBuilder();
55
- const graph = builder.build_from_repos(repos);
56
-
57
- // Check for cycles
58
- const {production_cycles, dev_cycles} = graph.detect_cycles_by_type();
59
-
60
- // Log production cycles
61
- if (production_cycles.length > 0 && log_cycles) {
62
- log?.error(st('red', '❌ Production/peer dependency cycles detected:'));
63
- for (const cycle of production_cycles) {
64
- log?.error(` ${cycle.join(' → ')}`);
65
- }
66
-
67
- if (throw_on_prod_cycles) {
68
- throw new TaskError(
69
- `Cannot publish with production/peer dependency cycles. ` +
70
- `These must be resolved before publishing.`,
71
- );
72
- }
73
- }
35
+ export const validate_dependency_graph = (repos: Array<LocalRepo>): GraphValidationResult => {
36
+ const graph = new DependencyGraph(repos);
37
+ const { production_cycles, dev_cycles } = graph.detect_cycles_by_type();
74
38
 
75
- // Log dev cycles (informational, not an error)
76
- if (dev_cycles.length > 0 && log_cycles) {
77
- log?.info(st('dim', 'â„šī¸ Dev dependency cycles detected (this is normal):'));
78
- for (const cycle of dev_cycles) {
79
- log?.info(st('dim', ` ${cycle.join(' → ')}`));
80
- }
81
- }
82
-
83
- // Compute publishing order
84
39
  let publishing_order: Array<string>;
85
40
  let sort_error: string | undefined;
86
41
  try {
87
42
  publishing_order = graph.topological_sort(true); // exclude dev deps to break cycles
88
- if (log_order && publishing_order.length > 0) {
89
- log?.info(` Publishing order: ${publishing_order.join(' → ')}`);
90
- }
91
43
  } catch (error) {
92
- // Capture the sort error message for callers to report
93
44
  sort_error = 'Failed to compute publishing order: ' + error;
94
-
95
- // If topological sort fails (due to cycles), return empty array
96
- // Only throw if production cycles exist AND throw_on_prod_cycles is true
97
- if (production_cycles.length > 0 && throw_on_prod_cycles) {
98
- throw new TaskError(sort_error);
99
- }
100
- // Otherwise, return empty publishing order (let caller handle it)
101
45
  publishing_order = [];
102
46
  }
103
47
 
@@ -106,13 +50,10 @@ export const validate_dependency_graph = (
106
50
  publishing_order,
107
51
  production_cycles,
108
52
  dev_cycles,
109
- sort_error,
53
+ sort_error
110
54
  };
111
55
  };
112
56
 
113
- /** Cycles, wildcard deps, and missing peers produced by `DependencyGraphBuilder.analyze`. */
114
- export type DependencyAnalysis = ReturnType<DependencyGraphBuilder['analyze']>;
115
-
116
57
  export interface RepoAnalysis {
117
58
  graph: DependencyGraph;
118
59
  analysis: DependencyAnalysis;
@@ -123,16 +64,14 @@ export interface RepoAnalysis {
123
64
  /**
124
65
  * Builds the dependency graph and runs cycle/wildcard analysis, tolerating cycles
125
66
  * (reports rather than throws). The shared core of `gitops_analyze` and
126
- * `gitops_validate`, which format the result themselves — so this stays silent
127
- * (no `log`) to avoid emitting a redundant "Analyzing dependencies" line.
67
+ * `gitops_validate`, which format the result themselves.
128
68
  */
129
69
  export const analyze_repos = (repos: Array<LocalRepo>): RepoAnalysis => {
130
- // Only npm packages form the dependency graph; non-npm repos (e.g. cargo) are excluded.
131
- const {graph, publishing_order: order} = validate_dependency_graph(repos.filter(repo_is_npm), {
132
- throw_on_prod_cycles: false, // report, don't throw
133
- log_cycles: false, // callers format their own cycle output
134
- log_order: false,
135
- });
136
- const analysis = new DependencyGraphBuilder().analyze(graph);
137
- return {graph, analysis, publishing_order: order.length > 0 ? order : null};
70
+ // only npm packages form the dependency graph; non-npm repos (e.g. cargo) are excluded
71
+ const { graph, publishing_order } = validate_dependency_graph(repos.filter(repo_is_npm));
72
+ return {
73
+ graph,
74
+ analysis: graph.analyze(),
75
+ publishing_order: publishing_order.length > 0 ? publishing_order : null
76
+ };
138
77
  };