@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,144 +1,76 @@
1
- import { spawn_out } from '@fuzdev/fuz_util/process.ts';
2
1
  import { styleText as st } from 'node:util';
3
- import { default_git_operations, default_npm_operations, default_build_operations, default_changeset_operations, } from './operations_defaults.js';
2
+ import { default_npm_operations, default_build_operations } from './operations_defaults.js';
4
3
  /**
5
- * Validates all requirements before publishing can proceed.
4
+ * Validates the publish-time requirements beyond repo git state:
5
+ * - every package the plan publishes builds (fail-fast to prevent broken state)
6
+ * - npm authentication
7
+ * - npm registry connectivity
6
8
  *
7
- * Performs comprehensive pre-flight validation:
8
- * - Clean workspaces (100% clean required - no uncommitted changes)
9
- * - Correct branch (usually main)
10
- * - Changesets present (unless `skip_changesets`=true)
11
- * - Builds successful (fail-fast to prevent broken state)
12
- * - Git remote reachability
13
- * - NPM authentication with username
14
- * - NPM registry connectivity
9
+ * What publishes is the plan's to decide, so preflight reads no changesets: it
10
+ * builds each package in `version_changes`. Git state — each repo on its
11
+ * registry branch, clean, idle, in sync with origin or ahead of it, and no live
12
+ * session in its checkout — is the readiness gate's, which `gitops_publish
13
+ * --wetrun` runs before the plan's confirmation prompt (`repo_readiness.ts`), so
14
+ * preflight reads no git.
15
15
  *
16
16
  * Build validation runs BEFORE any publishing to prevent the scenario where
17
17
  * version is bumped but build fails, leaving repo in broken state.
18
18
  *
19
- * @returns result with `ok`=false if any errors, plus warnings and detailed status
19
+ * @returns result with `ok`=false if any errors, plus warnings
20
20
  */
21
- export const run_preflight_checks = async ({ repos, preflight_options = {}, git_ops = default_git_operations, npm_ops = default_npm_operations, build_ops = default_build_operations, changeset_ops = default_changeset_operations, }) => {
22
- const { skip_changesets = false, skip_build_validation = false, required_branch = 'main', check_remote = true, estimate_time = true, log, } = preflight_options;
21
+ export const run_preflight_checks = async ({ repos, version_changes, log, npm_ops = default_npm_operations, build_ops = default_build_operations }) => {
23
22
  const warnings = [];
24
23
  const errors = [];
25
- const repos_with_changesets = new Set();
26
- const repos_without_changesets = new Set();
27
- let npm_username;
28
- let estimated_duration;
29
24
  log?.info(st('cyan', '✅ Running preflight checks...'));
30
- // 1. Check clean workspaces - must be 100% clean before publishing
31
- log?.info(' Checking workspace cleanliness...');
32
- for (const repo of repos) {
33
- const clean_result = await git_ops.check_clean_workspace({ cwd: repo.repo_dir });
34
- if (!clean_result.ok) {
35
- errors.push(`${repo.library.name} failed workspace check: ${clean_result.message}`);
36
- continue;
25
+ // 1. Build every package the plan publishes
26
+ const repo_by_name = new Map(repos.map((r) => [r.library.name, r]));
27
+ const repos_to_build = [];
28
+ for (const change of version_changes) {
29
+ const repo = repo_by_name.get(change.package_name);
30
+ if (repo) {
31
+ repos_to_build.push(repo);
37
32
  }
38
- if (!clean_result.value) {
39
- // Get list of changed files for better error message
40
- const files_result = await git_ops.list_uncommitted_files({ cwd: repo.repo_dir });
41
- if (files_result.ok) {
42
- // No filtering - workspace must be 100% clean
43
- const unexpected_files = files_result.value;
44
- if (unexpected_files.length > 0) {
45
- errors.push(`${repo.library.name} has uncommitted changes in: ${unexpected_files.slice(0, 3).join(', ')}${unexpected_files.length > 3 ? ` and ${unexpected_files.length - 3} more` : ''}`);
46
- }
47
- }
48
- else {
49
- errors.push(`${repo.library.name} has uncommitted changes`);
50
- }
51
- }
52
- }
53
- // 2. Check correct branch
54
- log?.info(` Checking branches (expecting ${required_branch})...`);
55
- for (const repo of repos) {
56
- const branch_result = await git_ops.current_branch_name({ cwd: repo.repo_dir });
57
- if (!branch_result.ok) {
58
- errors.push(`${repo.library.name} failed branch check: ${branch_result.message}`);
59
- continue;
60
- }
61
- if (branch_result.value !== required_branch) {
62
- errors.push(`${repo.library.name} is on branch '${branch_result.value}', expected '${required_branch}'`);
63
- }
64
- }
65
- // 3. Check changesets (unless skipped)
66
- if (!skip_changesets) {
67
- log?.info(' Checking for changesets...');
68
- for (const repo of repos) {
69
- const has_result = await changeset_ops.has_changesets({ repo });
70
- if (!has_result.ok) {
71
- errors.push(`${repo.library.name} failed changeset check: ${has_result.message}`);
72
- continue;
73
- }
74
- if (has_result.value) {
75
- repos_with_changesets.add(repo.library.name);
76
- }
77
- else {
78
- repos_without_changesets.add(repo.library.name);
79
- warnings.push(`${repo.library.name} has no changesets`);
80
- }
81
- }
82
- if (repos_without_changesets.size > 0) {
83
- log?.warn(st('yellow', ` ⚠️ ${repos_without_changesets.size} packages have no changesets`));
33
+ else {
34
+ errors.push(`${change.package_name} is in the plan but not among the repos`);
84
35
  }
85
36
  }
86
- // 4. Validate builds for packages with changesets
87
- if (!skip_build_validation && repos_with_changesets.size > 0) {
88
- log?.info(st('cyan', ` Validating builds for ${repos_with_changesets.size} package(s)...`));
89
- const repos_to_build = repos.filter((repo) => repos_with_changesets.has(repo.library.name));
37
+ if (repos_to_build.length > 0) {
38
+ log?.info(st('cyan', ` Validating builds for ${repos_to_build.length} package(s)...`));
39
+ let build_failures = 0;
90
40
  for (let i = 0; i < repos_to_build.length; i++) {
91
41
  const repo = repos_to_build[i];
92
42
  log?.info(st('dim', ` [${i + 1}/${repos_to_build.length}] Building ${repo.library.name}...`));
93
- const build_result = await build_ops.build_package({ repo, log });
94
- if (!build_result.ok) {
95
- errors.push(`${repo.library.name} failed to build: ${build_result.output || build_result.message || 'unknown error'}`);
43
+ const build_result = await build_ops.build_package({ repo });
44
+ if (build_result.ok) {
45
+ log?.info(st('dim', ` ✓ ${repo.library.name} built successfully`));
96
46
  }
97
47
  else {
98
- log?.info(st('dim', ` ✓ ${repo.library.name} built successfully`));
48
+ build_failures++;
49
+ errors.push(`${repo.library.name} failed to build: ${build_result.output || build_result.message || 'unknown error'}`);
99
50
  }
100
51
  }
101
- if (errors.some((err) => err.includes('failed to build'))) {
52
+ if (build_failures > 0) {
102
53
  log?.error(st('red', ' ❌ Build validation failed - fix build errors before publishing'));
103
54
  }
104
55
  else {
105
56
  log?.info(st('green', ' ✓ All builds validated successfully'));
106
57
  }
107
58
  }
108
- // 5. Check git remote reachability (skip in tests when check_remote is false)
109
- if (check_remote && repos.length > 0) {
110
- log?.info(' Checking git remote connectivity...');
111
- // Only check first repo to avoid slowing down tests with multiple remote checks
112
- const remote_result = await check_git_remote(repos[0].repo_dir);
113
- if (!remote_result.ok) {
114
- warnings.push(`git remote may not be reachable - ${remote_result.message}`);
115
- }
116
- }
117
- // 6. Check npm authentication with username
59
+ // 2. Check npm authentication
118
60
  log?.info(' Checking npm authentication...');
119
61
  const npm_auth_result = await npm_ops.check_auth();
120
- if (!npm_auth_result.ok) {
121
- errors.push(`npm authentication failed: ${npm_auth_result.message || 'not logged in'}`);
62
+ if (npm_auth_result.ok) {
63
+ log?.info(st('dim', ` Logged in as: ${npm_auth_result.username}`));
122
64
  }
123
65
  else {
124
- npm_username = npm_auth_result.username;
125
- log?.info(st('dim', ` Logged in as: ${npm_username}`));
66
+ errors.push(`npm authentication failed: ${npm_auth_result.message || 'not logged in'}`);
126
67
  }
127
- // 7. Check network connectivity (npm registry)
68
+ // 3. Check network connectivity (npm registry)
128
69
  log?.info(' Checking npm registry connectivity...');
129
70
  const registry_result = await npm_ops.check_registry();
130
71
  if (!registry_result.ok) {
131
72
  warnings.push(`npm registry check failed: ${registry_result.message}`);
132
73
  }
133
- // 8. Estimate total publish time
134
- if (estimate_time) {
135
- const packages_to_publish = repos_with_changesets.size;
136
- if (packages_to_publish > 0) {
137
- // Rough estimate: 30s per package + 10s per package for NPM propagation
138
- estimated_duration = packages_to_publish * 40;
139
- log?.info(st('dim', ` Estimated publish time: ~${Math.ceil(estimated_duration / 60)} minutes for ${packages_to_publish} package(s)`));
140
- }
141
- }
142
74
  // Report results
143
75
  const ok = errors.length === 0;
144
76
  if (errors.length > 0) {
@@ -156,26 +88,5 @@ export const run_preflight_checks = async ({ repos, preflight_options = {}, git_
156
88
  if (ok) {
157
89
  log?.info(st('green', '\n✨ All preflight checks passed!'));
158
90
  }
159
- return {
160
- ok,
161
- warnings,
162
- errors,
163
- repos_with_changesets,
164
- repos_without_changesets,
165
- estimated_duration,
166
- npm_username,
167
- };
168
- };
169
- const check_git_remote = async (cwd) => {
170
- try {
171
- // Try to fetch refs from remote without downloading objects
172
- const result = await spawn_out('git', ['ls-remote', '--heads', 'origin'], { cwd });
173
- if (result.stdout || result.stderr) {
174
- return { ok: true };
175
- }
176
- return { ok: false, message: 'No response from git remote' };
177
- }
178
- catch (error) {
179
- return { ok: false, message: String(error) };
180
- }
91
+ return { ok, warnings, errors };
181
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"publish_gate.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publish_gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAEzD,kFAAkF;AAClF,MAAM,MAAM,WAAW,GACpB;IAAC,MAAM,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GACpC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAC,GACnB;IAAC,MAAM,EAAE,SAAS,CAAA;CAAC,CAAC;AAEvB,MAAM,WAAW,kBAAkB;IAClC,4DAA4D;IAC5D,MAAM,EAAE,OAAO,CAAC;IAChB,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,kBAAkB,KAAG,WAMjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC9B,QAAQ,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,EACpC,aAAa,KAAK,GAAG,IAAI,KACvB,OAA6C,CAAC"}
1
+ {"version":3,"file":"publish_gate.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publish_gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,kFAAkF;AAClF,MAAM,MAAM,WAAW,GACtB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAExF,MAAM,WAAW,kBAAkB;IAClC,4DAA4D;IAC5D,MAAM,EAAE,OAAO,CAAC;IAChB,wEAAwE;IACxE,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;CACrC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,kBAAkB,KAAG,WAMjE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC9B,QAAQ,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,EACpC,aAAa,KAAK,GAAG,IAAI,KACvB,OAA6C,CAAC"}
@@ -8,9 +8,7 @@
8
8
  * @module
9
9
  */
10
10
  import type { BumpType } from './version_utils.js';
11
- import type { PublishingPlan } from './publishing_plan.js';
12
- /** How a package's version bump arises in the plan. */
13
- export type PublishStepVia = 'changeset' | 'auto_changeset' | 'escalation';
11
+ import { type PublishingPlan, type VersionChangeKind } from './publishing_plan.js';
14
12
  /** One ordered side-effect a wetrun would perform. */
15
13
  export type PublishStep = {
16
14
  kind: 'publish';
@@ -18,7 +16,7 @@ export type PublishStep = {
18
16
  from: string;
19
17
  to: string;
20
18
  bump: BumpType;
21
- via: PublishStepVia;
19
+ via: VersionChangeKind;
22
20
  } | {
23
21
  kind: 'npm_wait';
24
22
  repo: string;
@@ -1 +1 @@
1
- {"version":3,"file":"publish_steps.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publish_steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAC,cAAc,EAA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G;AACH,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,CAAC,WAAW,CAAC,KAAG,KAAK,CAAC,MAAM,CAkB5E,CAAC"}
@@ -7,12 +7,8 @@
7
7
  *
8
8
  * @module
9
9
  */
10
+ import { version_change_kind } from './publishing_plan.js';
10
11
  import { UnreachableError } from '@fuzdev/fuz_util/error.ts';
11
- const step_via = (change) => change.needs_bump_escalation
12
- ? 'escalation'
13
- : change.has_changesets
14
- ? 'changeset'
15
- : 'auto_changeset';
16
12
  /**
17
13
  * Derives the ordered side-effects a wetrun would perform from a frozen plan.
18
14
  *
@@ -36,7 +32,7 @@ export const derive_publish_steps = (plan, options = {}) => {
36
32
  from: change.from,
37
33
  to: change.to,
38
34
  bump: change.bump_type,
39
- via: step_via(change),
35
+ via: version_change_kind(change)
40
36
  });
41
37
  steps.push({ kind: 'npm_wait', repo, version: change.to });
42
38
  changed.add(repo);
@@ -57,7 +53,7 @@ export const derive_publish_steps = (plan, options = {}) => {
57
53
  dependency: repo,
58
54
  to: change.to,
59
55
  dep_type: update.type === 'peerDependencies' ? 'peer' : 'prod',
60
- creates_changeset: republishes,
56
+ creates_changeset: republishes
61
57
  });
62
58
  changed.add(update.dependent_package);
63
59
  }
@@ -75,7 +71,7 @@ export const derive_publish_steps = (plan, options = {}) => {
75
71
  kind: 'dev_dep_update',
76
72
  repo: update.dependent_package,
77
73
  dependency: update.updated_dependency,
78
- to: dep_change.to,
74
+ to: dep_change.to
79
75
  });
80
76
  changed.add(update.dependent_package);
81
77
  }
@@ -19,12 +19,9 @@ import { z } from 'zod';
19
19
  * failure kind without parsing the message.
20
20
  */
21
21
  export declare const PublishingErrorCode: z.ZodEnum<{
22
- other: "other";
23
- build: "build";
24
22
  publish: "publish";
23
+ not_ready: "not_ready";
25
24
  network: "network";
26
- auth: "auth";
27
- dependency: "dependency";
28
25
  drift: "drift";
29
26
  }>;
30
27
  export type PublishingErrorCode = z.infer<typeof PublishingErrorCode>;
@@ -71,12 +68,9 @@ export declare const PublishingEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
71
68
  name: z.ZodString;
72
69
  error: z.ZodString;
73
70
  code: z.ZodEnum<{
74
- other: "other";
75
- build: "build";
76
71
  publish: "publish";
72
+ not_ready: "not_ready";
77
73
  network: "network";
78
- auth: "auth";
79
- dependency: "dependency";
80
74
  drift: "drift";
81
75
  }>;
82
76
  }, z.core.$strict>, z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"publishing_event.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publishing_event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;EAW9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB;;;;;;kBAM/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BA8D1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAC5B,QAAQ,KAAK,CAAC,eAAe,CAAC,EAC9B,UAAU,MAAM,KACd,oBAwBF,CAAC"}
1
+ {"version":3,"file":"publishing_event.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publishing_event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;EAY9B,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,2FAA2F;AAC3F,eAAO,MAAM,oBAAoB;;;;;;kBAM/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAgE1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAC5B,QAAQ,KAAK,CAAC,eAAe,CAAC,EAC9B,UAAU,MAAM,KACd,oBAwBF,CAAC"}
@@ -19,16 +19,17 @@ import { z } from 'zod';
19
19
  * failure kind without parsing the message.
20
20
  */
21
21
  export const PublishingErrorCode = z.enum([
22
+ // the publish step failed — its cause is in the message, not yet classified further
22
23
  'publish',
24
+ // the published version never appeared on the npm registry within the wait
23
25
  'network',
24
- 'auth',
25
- 'dependency',
26
- 'build',
27
26
  // the real published version diverged from the frozen plan's prediction — an
28
27
  // invariant violation, distinct from an ordinary publish failure (see fail-loud
29
28
  // drift detection in `multi_repo_publisher.ts`)
30
29
  'drift',
31
- 'other',
30
+ // the repo wasn't ready when re-checked right before its `gro publish` (origin moved,
31
+ // a tracked edit, a live session, …) — aborted before any npm side effect
32
+ 'not_ready'
32
33
  ]);
33
34
  /** Tallied outcome of a publishing run, derived from its events via `summarize_events`. */
34
35
  export const PublishingRunSummary = z.strictObject({
@@ -36,7 +37,7 @@ export const PublishingRunSummary = z.strictObject({
36
37
  published: z.number().meta({ description: 'packages published (or, in a dry run, predicted)' }),
37
38
  failed: z.number(),
38
39
  skipped: z.number(),
39
- duration: z.number().meta({ description: 'wall-clock duration in milliseconds' }),
40
+ duration: z.number().meta({ description: 'wall-clock duration in milliseconds' })
40
41
  });
41
42
  /**
42
43
  * A single structured event emitted during a publishing run. Tagged on `event` so the
@@ -45,13 +46,15 @@ export const PublishingRunSummary = z.strictObject({
45
46
  export const PublishingEvent = z.discriminatedUnion('event', [
46
47
  z.strictObject({
47
48
  event: z.literal('run_started'),
48
- wetrun: z.boolean().meta({ description: 'false means every package_completed is a prediction' }),
49
- total: z.number(),
49
+ wetrun: z
50
+ .boolean()
51
+ .meta({ description: 'false means every package_completed is a prediction' }),
52
+ total: z.number()
50
53
  }),
51
54
  z.strictObject({
52
55
  event: z.literal('package_skipped'),
53
56
  name: z.string(),
54
- reason: z.string(),
57
+ reason: z.string()
55
58
  }),
56
59
  z.strictObject({
57
60
  event: z.literal('package_completed'),
@@ -62,18 +65,18 @@ export const PublishingEvent = z.discriminatedUnion('event', [
62
65
  bump_type: z.enum(['major', 'minor', 'patch']),
63
66
  breaking: z.boolean(),
64
67
  commit: z.string().meta({ description: "'simulated' in a dry run, otherwise the commit hash" }),
65
- tag: z.string(),
68
+ tag: z.string()
66
69
  }),
67
70
  z.strictObject({
68
71
  event: z.literal('npm_waited'),
69
72
  name: z.string(),
70
- version: z.string().meta({ description: 'the version waited on after publishing' }),
73
+ version: z.string().meta({ description: 'the version waited on after publishing' })
71
74
  }),
72
75
  z.strictObject({
73
76
  event: z.literal('package_failed'),
74
77
  name: z.string(),
75
78
  error: z.string(),
76
- code: PublishingErrorCode,
79
+ code: PublishingErrorCode
77
80
  }),
78
81
  z.strictObject({
79
82
  event: z.literal('dependency_updated'),
@@ -85,25 +88,25 @@ export const PublishingEvent = z.discriminatedUnion('event', [
85
88
  dep_type: z.enum(['prod', 'peer', 'dev']),
86
89
  // true when the update creates an auto-changeset (a publishable dependent republishes);
87
90
  // false for dev-dep updates and update-only leaves (private dependents never publish).
88
- creates_changeset: z.boolean(),
91
+ creates_changeset: z.boolean()
89
92
  }),
90
93
  z.strictObject({
91
94
  event: z.literal('deploy_started'),
92
- name: z.string(),
95
+ name: z.string()
93
96
  }),
94
97
  z.strictObject({
95
98
  event: z.literal('deploy_completed'),
96
- name: z.string(),
99
+ name: z.string()
97
100
  }),
98
101
  z.strictObject({
99
102
  event: z.literal('deploy_failed'),
100
103
  name: z.string(),
101
- error: z.string(),
104
+ error: z.string()
102
105
  }),
103
106
  z.strictObject({
104
107
  event: z.literal('run_finished'),
105
- summary: PublishingRunSummary,
106
- }),
108
+ summary: PublishingRunSummary
109
+ })
107
110
  ]);
108
111
  /**
109
112
  * Derives a run summary from the captured event list — the single canonical path from
@@ -4,11 +4,13 @@
4
4
  * A `PublishingEventHandler` is anything that can receive a `PublishingEvent`. Handlers
5
5
  * compose: `multi_handler` fans out, `masking_handler` redacts secrets then forwards.
6
6
  * Emission is best-effort and synchronous — an observability sink must never fail or
7
- * slow a run. The default sink is `null_handler` (drops everything).
7
+ * slow a run. The executor always captures events for its result (`capture_handler`)
8
+ * and forwards them to the caller's sink when one is supplied.
8
9
  *
9
10
  * @module
10
11
  */
11
12
  import type { PublishingEvent } from './publishing_event.js';
13
+ import type { WriteStdout } from './output_helpers.js';
12
14
  /** A sink for publishing events. */
13
15
  export interface PublishingEventHandler {
14
16
  emit: (event: PublishingEvent) => void;
@@ -17,24 +19,24 @@ export interface PublishingEventHandler {
17
19
  export interface CapturingEventHandler extends PublishingEventHandler {
18
20
  readonly events: Array<PublishingEvent>;
19
21
  }
20
- /** Drops every event. The default when no handler is supplied. */
21
- export declare const null_handler: () => PublishingEventHandler;
22
22
  /** Collects events in memory. Used to build the run report and in tests. */
23
23
  export declare const capture_handler: () => CapturingEventHandler;
24
24
  /**
25
- * Writes each event as one JSON object per line (JSON-lines) to `process.stdout`.
25
+ * Writes each event as one JSON object per line (JSON-lines) to stdout.
26
26
  * Write failures are swallowed — the stream is observability, not control flow.
27
+ *
28
+ * @param write_line - writes one line and its newline; defaults to `process.stdout`
27
29
  */
28
- export declare const stdout_handler: () => PublishingEventHandler;
30
+ export declare const stdout_handler: (write_line?: WriteStdout) => PublishingEventHandler;
29
31
  /** Fans an event out to every handler in order. */
30
32
  export declare const multi_handler: (handlers: Array<PublishingEventHandler>) => PublishingEventHandler;
31
33
  /**
32
- * Wraps a handler, masking secrets in each event's string fields before forwarding.
34
+ * Wraps a handler, masking secrets in each event's string fields (`mask_secrets`)
35
+ * before forwarding.
33
36
  *
34
37
  * @param inner - the handler to forward masked events to
35
- * @param mask - the masking function, defaults to `mask_secrets`
36
38
  */
37
- export declare const masking_handler: (inner: PublishingEventHandler, mask?: (event: PublishingEvent) => PublishingEvent) => PublishingEventHandler;
39
+ export declare const masking_handler: (inner: PublishingEventHandler) => PublishingEventHandler;
38
40
  /** Redacts known secret shapes from a string. */
39
41
  export declare const redact_secrets: (text: string) => string;
40
42
  /** Returns a copy of the event with secrets redacted from its string-valued fields. */
@@ -1 +1 @@
1
- {"version":3,"file":"publishing_event_handler.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publishing_event_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAE3D,oCAAoC;AACpC,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CACvC;AAED,oEAAoE;AACpE,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB;IACpE,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CACxC;AAED,kEAAkE;AAClE,eAAO,MAAM,YAAY,QAAO,sBAE9B,CAAC;AAEH,4EAA4E;AAC5E,eAAO,MAAM,eAAe,QAAO,qBAQlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,sBAQhC,CAAC;AAEH,mDAAmD;AACnD,eAAO,MAAM,aAAa,GAAI,UAAU,KAAK,CAAC,sBA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eAMrD,CAAC"}
@@ -4,14 +4,14 @@
4
4
  * A `PublishingEventHandler` is anything that can receive a `PublishingEvent`. Handlers
5
5
  * compose: `multi_handler` fans out, `masking_handler` redacts secrets then forwards.
6
6
  * Emission is best-effort and synchronous — an observability sink must never fail or
7
- * slow a run. The default sink is `null_handler` (drops everything).
7
+ * slow a run. The executor always captures events for its result (`capture_handler`)
8
+ * and forwards them to the caller's sink when one is supplied.
8
9
  *
9
10
  * @module
10
11
  */
11
- /** Drops every event. The default when no handler is supplied. */
12
- export const null_handler = () => ({
13
- emit: () => { },
14
- });
12
+ const write_process_stdout_line = (line) => {
13
+ process.stdout.write(line + '\n');
14
+ };
15
15
  /** Collects events in memory. Used to build the run report and in tests. */
16
16
  export const capture_handler = () => {
17
17
  const events = [];
@@ -19,22 +19,24 @@ export const capture_handler = () => {
19
19
  events,
20
20
  emit: (event) => {
21
21
  events.push(event);
22
- },
22
+ }
23
23
  };
24
24
  };
25
25
  /**
26
- * Writes each event as one JSON object per line (JSON-lines) to `process.stdout`.
26
+ * Writes each event as one JSON object per line (JSON-lines) to stdout.
27
27
  * Write failures are swallowed — the stream is observability, not control flow.
28
+ *
29
+ * @param write_line - writes one line and its newline; defaults to `process.stdout`
28
30
  */
29
- export const stdout_handler = () => ({
31
+ export const stdout_handler = (write_line = write_process_stdout_line) => ({
30
32
  emit: (event) => {
31
33
  try {
32
- process.stdout.write(JSON.stringify(event) + '\n');
34
+ write_line(JSON.stringify(event));
33
35
  }
34
36
  catch {
35
37
  // best-effort: a logging sink must never fail a run
36
38
  }
37
- },
39
+ }
38
40
  });
39
41
  /** Fans an event out to every handler in order. */
40
42
  export const multi_handler = (handlers) => ({
@@ -42,18 +44,18 @@ export const multi_handler = (handlers) => ({
42
44
  for (const handler of handlers) {
43
45
  handler.emit(event);
44
46
  }
45
- },
47
+ }
46
48
  });
47
49
  /**
48
- * Wraps a handler, masking secrets in each event's string fields before forwarding.
50
+ * Wraps a handler, masking secrets in each event's string fields (`mask_secrets`)
51
+ * before forwarding.
49
52
  *
50
53
  * @param inner - the handler to forward masked events to
51
- * @param mask - the masking function, defaults to `mask_secrets`
52
54
  */
53
- export const masking_handler = (inner, mask = mask_secrets) => ({
55
+ export const masking_handler = (inner) => ({
54
56
  emit: (event) => {
55
- inner.emit(mask(event));
56
- },
57
+ inner.emit(mask_secrets(event));
58
+ }
57
59
  });
58
60
  // Minimal redaction rules: npm auth tokens (bare or registry-scoped), `SECRET_*`
59
61
  // env-style assignments, and `npm_`-prefixed tokens. Deliberately lean — error
@@ -61,7 +63,7 @@ export const masking_handler = (inner, mask = mask_secrets) => ({
61
63
  const SECRET_RULES = [
62
64
  [/((?:\/\/[^\s:]+:)?_authToken\s*=\s*)\S+/gi, '$1[redacted]'],
63
65
  [/(SECRET_[A-Z0-9_]+\s*[=:]\s*)\S+/g, '$1[redacted]'],
64
- [/(npm_[A-Za-z0-9]{4})[A-Za-z0-9]{12,}/g, '$1[redacted]'],
66
+ [/(npm_[A-Za-z0-9]{4})[A-Za-z0-9]{12,}/g, '$1[redacted]']
65
67
  ];
66
68
  /** Redacts known secret shapes from a string. */
67
69
  export const redact_secrets = (text) => SECRET_RULES.reduce((acc, [pattern, replacement]) => acc.replace(pattern, replacement), text);
@@ -2,7 +2,6 @@ import type { Logger } from '@fuzdev/fuz_util/log.ts';
2
2
  import { type LocalRepo } from './local_repo.js';
3
3
  import { type BumpType } from './version_utils.js';
4
4
  import type { ChangesetOperations } from './operations.js';
5
- export { log_publishing_plan, type LogPlanOptions } from './publishing_plan_logging.js';
6
5
  export interface VersionChange {
7
6
  package_name: string;
8
7
  from: string;
@@ -15,6 +14,19 @@ export interface VersionChange {
15
14
  existing_bump?: BumpType;
16
15
  required_bump?: BumpType;
17
16
  }
17
+ /**
18
+ * How a version change arises in the plan: from the package's own changesets
19
+ * (`explicit`), from its changesets with the bump raised to what a breaking
20
+ * dependency requires (`escalation`), or from a changeset the executor
21
+ * generates for a dependency update (`auto`).
22
+ */
23
+ export type VersionChangeKind = 'explicit' | 'escalation' | 'auto';
24
+ /**
25
+ * Classifies a version change — the one classification the plan's logger,
26
+ * markdown, and side-effect preview share. A change without changesets of its
27
+ * own is `auto` even if its bump was raised.
28
+ */
29
+ export declare const version_change_kind: (change: VersionChange) => VersionChangeKind;
18
30
  export interface DependencyUpdate {
19
31
  dependent_package: string;
20
32
  updated_dependency: string;
@@ -81,7 +93,10 @@ export interface PublishingPlan {
81
93
  dependency_updates: Array<DependencyUpdate>;
82
94
  breaking_cascades: Map<string, Array<string>>;
83
95
  warnings: Array<string>;
96
+ /** Informational sentences, not warnings: excluded non-npm repos, dev dependency cycles. */
84
97
  info: Array<string>;
98
+ /** Package names with no changesets and no version change — nothing to publish. */
99
+ no_changes: Array<string>;
85
100
  errors: Array<string>;
86
101
  verbose_data?: VerboseData;
87
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"publishing_plan.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/publishing_plan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,OAAO,EAAc,KAAK,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACN,KAAK,QAAQ,EAIb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAUzD,OAAO,EAAC,mBAAmB,EAAE,KAAK,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAEtF,MAAM,WAAW,aAAa;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,QAAQ,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,QAAQ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