@fuzdev/fuz_gitops 0.77.0 → 0.78.1

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 (162) hide show
  1. package/README.md +25 -5
  2. package/dist/ModulesDetail.svelte +14 -12
  3. package/dist/ModulesDetail.svelte.d.ts.map +1 -1
  4. package/dist/ModulesNav.svelte +6 -6
  5. package/dist/ModulesNav.svelte.d.ts.map +1 -1
  6. package/dist/ModulesPage.svelte +2 -2
  7. package/dist/ModulesPage.svelte.d.ts.map +1 -1
  8. package/dist/PageFooter.svelte +2 -2
  9. package/dist/PageHeader.svelte +5 -5
  10. package/dist/PageHeader.svelte.d.ts +1 -1
  11. package/dist/PageHeader.svelte.d.ts.map +1 -1
  12. package/dist/PullRequestsDetail.svelte +25 -17
  13. package/dist/PullRequestsDetail.svelte.d.ts.map +1 -1
  14. package/dist/PullRequestsPage.svelte +3 -3
  15. package/dist/PullRequestsPage.svelte.d.ts.map +1 -1
  16. package/dist/ReposTable.svelte +24 -15
  17. package/dist/ReposTable.svelte.d.ts.map +1 -1
  18. package/dist/ReposTree.svelte +8 -6
  19. package/dist/ReposTree.svelte.d.ts.map +1 -1
  20. package/dist/ReposTreeNav.svelte +10 -11
  21. package/dist/ReposTreeNav.svelte.d.ts.map +1 -1
  22. package/dist/TablePage.svelte +2 -2
  23. package/dist/TablePage.svelte.d.ts.map +1 -1
  24. package/dist/TreeItemPage.svelte +2 -2
  25. package/dist/TreeItemPage.svelte.d.ts.map +1 -1
  26. package/dist/TreePage.svelte +2 -2
  27. package/dist/TreePage.svelte.d.ts.map +1 -1
  28. package/dist/cargo_toml.d.ts +33 -0
  29. package/dist/cargo_toml.d.ts.map +1 -0
  30. package/dist/cargo_toml.js +74 -0
  31. package/dist/changeset_generator.d.ts +1 -1
  32. package/dist/changeset_generator.d.ts.map +1 -1
  33. package/dist/changeset_generator.js +2 -2
  34. package/dist/changeset_reader.d.ts +1 -1
  35. package/dist/changeset_reader.d.ts.map +1 -1
  36. package/dist/changeset_reader.js +3 -3
  37. package/dist/config_reconcile.d.ts.map +1 -1
  38. package/dist/config_reconcile.js +6 -2
  39. package/dist/dependency_graph.d.ts +2 -2
  40. package/dist/dependency_graph.d.ts.map +1 -1
  41. package/dist/dependency_graph.js +9 -9
  42. package/dist/dependency_updater.d.ts +1 -1
  43. package/dist/dependency_updater.d.ts.map +1 -1
  44. package/dist/dependency_updater.js +8 -8
  45. package/dist/fetch_repo_data.d.ts +2 -2
  46. package/dist/fetch_repo_data.d.ts.map +1 -1
  47. package/dist/fetch_repo_data.js +4 -4
  48. package/dist/fs_fetch_value_cache.d.ts +1 -1
  49. package/dist/fs_fetch_value_cache.d.ts.map +1 -1
  50. package/dist/fs_fetch_value_cache.js +5 -5
  51. package/dist/git_operations.d.ts +1 -1
  52. package/dist/git_operations.d.ts.map +1 -1
  53. package/dist/git_operations.js +2 -2
  54. package/dist/github.d.ts +2 -2
  55. package/dist/github.d.ts.map +1 -1
  56. package/dist/github.js +7 -7
  57. package/dist/github_helpers.d.ts.map +1 -1
  58. package/dist/github_helpers.js +1 -1
  59. package/dist/gitops_analyze.task.d.ts.map +1 -1
  60. package/dist/gitops_analyze.task.js +21 -14
  61. package/dist/gitops_config.d.ts +2 -2
  62. package/dist/gitops_config.d.ts.map +1 -1
  63. package/dist/gitops_config.js +5 -5
  64. package/dist/gitops_plan.task.d.ts.map +1 -1
  65. package/dist/gitops_plan.task.js +8 -8
  66. package/dist/gitops_publish.task.d.ts.map +1 -1
  67. package/dist/gitops_publish.task.js +15 -12
  68. package/dist/gitops_run.task.d.ts.map +1 -1
  69. package/dist/gitops_run.task.js +10 -10
  70. package/dist/gitops_sync.task.d.ts.map +1 -1
  71. package/dist/gitops_sync.task.js +15 -13
  72. package/dist/gitops_task_helpers.d.ts +1 -1
  73. package/dist/gitops_task_helpers.d.ts.map +1 -1
  74. package/dist/gitops_task_helpers.js +4 -4
  75. package/dist/gitops_validate.task.d.ts.map +1 -1
  76. package/dist/gitops_validate.task.js +14 -14
  77. package/dist/graph_validation.d.ts +2 -2
  78. package/dist/graph_validation.d.ts.map +1 -1
  79. package/dist/graph_validation.js +5 -3
  80. package/dist/local_repo.d.ts +21 -7
  81. package/dist/local_repo.d.ts.map +1 -1
  82. package/dist/local_repo.js +64 -16
  83. package/dist/log_helpers.d.ts +1 -1
  84. package/dist/log_helpers.d.ts.map +1 -1
  85. package/dist/multi_repo_publisher.d.ts +3 -3
  86. package/dist/multi_repo_publisher.d.ts.map +1 -1
  87. package/dist/multi_repo_publisher.js +24 -20
  88. package/dist/npm_registry.d.ts +1 -1
  89. package/dist/npm_registry.d.ts.map +1 -1
  90. package/dist/npm_registry.js +4 -4
  91. package/dist/operations.d.ts +4 -4
  92. package/dist/operations.d.ts.map +1 -1
  93. package/dist/operations_defaults.d.ts.map +1 -1
  94. package/dist/operations_defaults.js +16 -16
  95. package/dist/output_helpers.d.ts +1 -1
  96. package/dist/output_helpers.d.ts.map +1 -1
  97. package/dist/preflight_checks.d.ts +2 -2
  98. package/dist/preflight_checks.d.ts.map +1 -1
  99. package/dist/preflight_checks.js +5 -5
  100. package/dist/publish_gate.d.ts.map +1 -1
  101. package/dist/publish_steps.d.ts.map +1 -1
  102. package/dist/publish_steps.js +4 -4
  103. package/dist/publishing_event.d.ts.map +1 -1
  104. package/dist/publishing_event.js +16 -14
  105. package/dist/publishing_event_handler.d.ts.map +1 -1
  106. package/dist/publishing_event_handler.js +6 -6
  107. package/dist/publishing_plan.d.ts +3 -3
  108. package/dist/publishing_plan.d.ts.map +1 -1
  109. package/dist/publishing_plan.js +25 -15
  110. package/dist/publishing_plan_helpers.d.ts.map +1 -1
  111. package/dist/publishing_plan_helpers.js +3 -3
  112. package/dist/publishing_plan_logging.d.ts +1 -1
  113. package/dist/publishing_plan_logging.d.ts.map +1 -1
  114. package/dist/publishing_plan_logging.js +2 -2
  115. package/dist/repo.svelte.d.ts +5 -5
  116. package/dist/repo.svelte.d.ts.map +1 -1
  117. package/dist/repo.svelte.js +2 -2
  118. package/dist/repo_ops.js +2 -2
  119. package/dist/resolved_gitops_config.d.ts.map +1 -1
  120. package/dist/resolved_gitops_config.js +1 -1
  121. package/dist/version_utils.js +1 -1
  122. package/package.json +16 -15
  123. package/src/lib/cargo_toml.ts +82 -0
  124. package/src/lib/changeset_generator.ts +20 -20
  125. package/src/lib/changeset_reader.ts +18 -18
  126. package/src/lib/ci_reconcile.ts +5 -5
  127. package/src/lib/config_reconcile.ts +8 -4
  128. package/src/lib/dependency_graph.ts +28 -28
  129. package/src/lib/dependency_updater.ts +30 -30
  130. package/src/lib/fetch_repo_data.ts +11 -11
  131. package/src/lib/fs_fetch_value_cache.ts +14 -10
  132. package/src/lib/git_operations.ts +31 -31
  133. package/src/lib/github.ts +19 -19
  134. package/src/lib/github_helpers.ts +6 -6
  135. package/src/lib/gitops_analyze.task.ts +56 -48
  136. package/src/lib/gitops_config.ts +14 -14
  137. package/src/lib/gitops_plan.task.ts +32 -32
  138. package/src/lib/gitops_publish.task.ts +52 -49
  139. package/src/lib/gitops_run.task.ts +29 -29
  140. package/src/lib/gitops_sync.task.ts +39 -30
  141. package/src/lib/gitops_task_helpers.ts +21 -21
  142. package/src/lib/gitops_validate.task.ts +38 -38
  143. package/src/lib/graph_validation.ts +14 -13
  144. package/src/lib/local_repo.ts +130 -64
  145. package/src/lib/log_helpers.ts +15 -15
  146. package/src/lib/multi_repo_publisher.ts +75 -74
  147. package/src/lib/npm_registry.ts +13 -13
  148. package/src/lib/operations.ts +50 -39
  149. package/src/lib/operations_defaults.ts +108 -106
  150. package/src/lib/output_helpers.ts +4 -4
  151. package/src/lib/preflight_checks.ts +28 -28
  152. package/src/lib/publish_gate.ts +7 -9
  153. package/src/lib/publish_steps.ts +15 -15
  154. package/src/lib/publishing_event.ts +22 -20
  155. package/src/lib/publishing_event_handler.ts +8 -8
  156. package/src/lib/publishing_plan.ts +69 -57
  157. package/src/lib/publishing_plan_helpers.ts +16 -12
  158. package/src/lib/publishing_plan_logging.ts +23 -23
  159. package/src/lib/repo.svelte.ts +8 -8
  160. package/src/lib/repo_ops.ts +12 -12
  161. package/src/lib/resolved_gitops_config.ts +5 -5
  162. package/src/lib/version_utils.ts +3 -3
@@ -7,15 +7,15 @@
7
7
  * @module
8
8
  */
9
9
 
10
- import {spawn_out} from '@fuzdev/fuz_util/process.js';
11
- import {readFile, writeFile, mkdir, stat} from 'node:fs/promises';
12
- import {git_checkout, type GitBranch, type GitOrigin} from '@fuzdev/fuz_util/git.js';
13
- import {fs_classify_error} from '@fuzdev/fuz_util/fs.js';
14
- import {EMPTY_OBJECT} from '@fuzdev/fuz_util/object.js';
15
-
16
- import {has_changesets, read_changesets, predict_next_version} from './changeset_reader.js';
17
- import {wait_for_package} from './npm_registry.js';
18
- import {run_preflight_checks} from './preflight_checks.js';
10
+ import { spawn_out } from '@fuzdev/fuz_util/process.ts';
11
+ import { readFile, writeFile, mkdir, stat } from 'node:fs/promises';
12
+ import { git_checkout, type GitBranch, type GitOrigin } from '@fuzdev/fuz_util/git.ts';
13
+ import { fs_classify_error } from '@fuzdev/fuz_util/fs.ts';
14
+ import { EMPTY_OBJECT } from '@fuzdev/fuz_util/object.ts';
15
+
16
+ import { has_changesets, read_changesets, predict_next_version } from './changeset_reader.ts';
17
+ import { wait_for_package } from './npm_registry.ts';
18
+ import { run_preflight_checks } from './preflight_checks.ts';
19
19
  import {
20
20
  git_add,
21
21
  git_commit,
@@ -31,8 +31,8 @@ import {
31
31
  git_current_branch_name_required,
32
32
  git_current_commit_hash_required,
33
33
  git_check_clean_workspace_as_boolean,
34
- git_has_remote,
35
- } from './git_operations.js';
34
+ git_has_remote
35
+ } from './git_operations.ts';
36
36
  import type {
37
37
  ChangesetOperations,
38
38
  GitOperations,
@@ -41,200 +41,202 @@ import type {
41
41
  PreflightOperations,
42
42
  FsOperations,
43
43
  BuildOperations,
44
- GitopsOperations,
45
- } from './operations.js';
44
+ GitopsOperations
45
+ } from './operations.ts';
46
46
 
47
47
  /** Wrap an async function that returns a value */
48
48
  const wrap_with_value = async <T>(
49
- fn: () => Promise<T>,
50
- ): Promise<{ok: true; value: T} | {ok: false; message: string}> => {
49
+ fn: () => Promise<T>
50
+ ): Promise<{ ok: true; value: T } | { ok: false; message: string }> => {
51
51
  try {
52
52
  const value = await fn();
53
- return {ok: true, value};
53
+ return { ok: true, value };
54
54
  } catch (error) {
55
- return {ok: false, message: String(error)};
55
+ return { ok: false, message: String(error) };
56
56
  }
57
57
  };
58
58
 
59
59
  /** Wrap an async function, ignoring its return value */
60
60
  const wrap_void = async (
61
- fn: () => Promise<unknown>,
62
- ): Promise<{ok: true} | {ok: false; message: string}> => {
61
+ fn: () => Promise<unknown>
62
+ ): Promise<{ ok: true } | { ok: false; message: string }> => {
63
63
  try {
64
64
  await fn();
65
- return {ok: true};
65
+ return { ok: true };
66
66
  } catch (error) {
67
- return {ok: false, message: String(error)};
67
+ return { ok: false, message: String(error) };
68
68
  }
69
69
  };
70
70
 
71
71
  export const default_changeset_operations: ChangesetOperations = {
72
72
  has_changesets: async (options) => {
73
- const {repo} = options;
73
+ const { repo } = options;
74
74
  return wrap_with_value(() => has_changesets(repo));
75
75
  },
76
76
 
77
77
  read_changesets: async (options) => {
78
- const {repo, log} = options;
78
+ const { repo, log } = options;
79
79
  return wrap_with_value(() => read_changesets(repo, log));
80
80
  },
81
81
 
82
82
  predict_next_version: async (options) => {
83
- const {repo, log} = options;
83
+ const { repo, log } = options;
84
84
  try {
85
85
  const result = await predict_next_version(repo, log);
86
86
  if (result === null) {
87
87
  return null;
88
88
  }
89
- return {ok: true, ...result};
89
+ return { ok: true, ...result };
90
90
  } catch (error) {
91
- return {ok: false, message: String(error)};
91
+ return { ok: false, message: String(error) };
92
92
  }
93
- },
93
+ }
94
94
  };
95
95
 
96
96
  export const default_git_operations: GitOperations = {
97
97
  // Core git info
98
98
  current_branch_name: async (options) => {
99
- const {cwd} = options ?? EMPTY_OBJECT;
100
- return wrap_with_value(() => git_current_branch_name_required(cwd ? {cwd} : undefined));
99
+ const { cwd } = options ?? EMPTY_OBJECT;
100
+ return wrap_with_value(() => git_current_branch_name_required(cwd ? { cwd } : undefined));
101
101
  },
102
102
 
103
103
  current_commit_hash: async (options) => {
104
- const {branch, cwd} = options ?? EMPTY_OBJECT;
105
- return wrap_with_value(() => git_current_commit_hash_required(branch, cwd ? {cwd} : undefined));
104
+ const { branch, cwd } = options ?? EMPTY_OBJECT;
105
+ return wrap_with_value(() =>
106
+ git_current_commit_hash_required(branch, cwd ? { cwd } : undefined)
107
+ );
106
108
  },
107
109
 
108
110
  check_clean_workspace: async (options) => {
109
- const {cwd} = options ?? EMPTY_OBJECT;
110
- return wrap_with_value(() => git_check_clean_workspace_as_boolean(cwd ? {cwd} : undefined));
111
+ const { cwd } = options ?? EMPTY_OBJECT;
112
+ return wrap_with_value(() => git_check_clean_workspace_as_boolean(cwd ? { cwd } : undefined));
111
113
  },
112
114
 
113
115
  // Branch operations
114
116
  checkout: async (options) => {
115
- const {branch, cwd} = options;
116
- return wrap_void(() => git_checkout(branch, cwd ? {cwd} : undefined));
117
+ const { branch, cwd } = options;
118
+ return wrap_void(() => git_checkout(branch, cwd ? { cwd } : undefined));
117
119
  },
118
120
 
119
121
  pull: async (options) => {
120
- const {origin, branch, cwd} = options ?? EMPTY_OBJECT;
122
+ const { origin, branch, cwd } = options ?? EMPTY_OBJECT;
121
123
  try {
122
124
  // Omit the branch arg when absent: a trailing `''` makes git pull the remote's
123
125
  // default branch (origin/HEAD) instead of the current branch's upstream.
124
126
  const spawned = await spawn_out(
125
127
  'git',
126
128
  ['pull', origin || 'origin', ...(branch ? [branch] : [])],
127
- cwd ? {cwd} : undefined,
129
+ cwd ? { cwd } : undefined
128
130
  );
129
131
  if (spawned.result.ok) {
130
- return {ok: true};
132
+ return { ok: true };
131
133
  } else {
132
- return {ok: false, message: spawned.stderr || 'Pull failed'};
134
+ return { ok: false, message: spawned.stderr || 'Pull failed' };
133
135
  }
134
136
  } catch (error) {
135
- return {ok: false, message: String(error)};
137
+ return { ok: false, message: String(error) };
136
138
  }
137
139
  },
138
140
 
139
141
  switch_branch: async (options) => {
140
- const {branch, pull, cwd} = options;
141
- return wrap_void(() => git_switch_branch(branch as GitBranch, pull, cwd ? {cwd} : undefined));
142
+ const { branch, pull, cwd } = options;
143
+ return wrap_void(() => git_switch_branch(branch as GitBranch, pull, cwd ? { cwd } : undefined));
142
144
  },
143
145
 
144
146
  has_remote: async (options) => {
145
- const {remote, cwd} = options ?? EMPTY_OBJECT;
146
- return wrap_with_value(() => git_has_remote(remote, cwd ? {cwd} : undefined));
147
+ const { remote, cwd } = options ?? EMPTY_OBJECT;
148
+ return wrap_with_value(() => git_has_remote(remote, cwd ? { cwd } : undefined));
147
149
  },
148
150
 
149
151
  // Staging and committing
150
152
  add: async (options) => {
151
- const {files, cwd} = options;
152
- return wrap_void(() => git_add(files, cwd ? {cwd} : undefined));
153
+ const { files, cwd } = options;
154
+ return wrap_void(() => git_add(files, cwd ? { cwd } : undefined));
153
155
  },
154
156
 
155
157
  commit: async (options) => {
156
- const {message, cwd} = options;
157
- return wrap_void(() => git_commit(message, cwd ? {cwd} : undefined));
158
+ const { message, cwd } = options;
159
+ return wrap_void(() => git_commit(message, cwd ? { cwd } : undefined));
158
160
  },
159
161
 
160
162
  add_and_commit: async (options) => {
161
- const {files, message, cwd} = options;
162
- return wrap_void(() => git_add_and_commit(files, message, cwd ? {cwd} : undefined));
163
+ const { files, message, cwd } = options;
164
+ return wrap_void(() => git_add_and_commit(files, message, cwd ? { cwd } : undefined));
163
165
  },
164
166
 
165
167
  has_changes: async (options) => {
166
- const {cwd} = options ?? EMPTY_OBJECT;
167
- return wrap_with_value(() => git_has_changes(cwd ? {cwd} : undefined));
168
+ const { cwd } = options ?? EMPTY_OBJECT;
169
+ return wrap_with_value(() => git_has_changes(cwd ? { cwd } : undefined));
168
170
  },
169
171
 
170
172
  list_uncommitted_files: async (options) => {
171
- const {cwd} = options ?? EMPTY_OBJECT;
172
- return wrap_with_value(() => git_list_uncommitted_files(cwd ? {cwd} : undefined));
173
+ const { cwd } = options ?? EMPTY_OBJECT;
174
+ return wrap_with_value(() => git_list_uncommitted_files(cwd ? { cwd } : undefined));
173
175
  },
174
176
 
175
177
  // Tagging
176
178
  tag: async (options) => {
177
- const {tag_name, message, cwd} = options;
178
- return wrap_void(() => git_tag(tag_name, message, cwd ? {cwd} : undefined));
179
+ const { tag_name, message, cwd } = options;
180
+ return wrap_void(() => git_tag(tag_name, message, cwd ? { cwd } : undefined));
179
181
  },
180
182
 
181
183
  push_tag: async (options) => {
182
- const {tag_name, origin, cwd} = options;
183
- return wrap_void(() => git_push_tag(tag_name, origin as GitOrigin, cwd ? {cwd} : undefined));
184
+ const { tag_name, origin, cwd } = options;
185
+ return wrap_void(() => git_push_tag(tag_name, origin as GitOrigin, cwd ? { cwd } : undefined));
184
186
  },
185
187
 
186
188
  // Stashing
187
189
  stash: async (options) => {
188
- const {message, cwd} = options ?? EMPTY_OBJECT;
189
- return wrap_void(() => git_stash(message, cwd ? {cwd} : undefined));
190
+ const { message, cwd } = options ?? EMPTY_OBJECT;
191
+ return wrap_void(() => git_stash(message, cwd ? { cwd } : undefined));
190
192
  },
191
193
 
192
194
  stash_pop: async (options) => {
193
- const {cwd} = options ?? EMPTY_OBJECT;
194
- return wrap_void(() => git_stash_pop(cwd ? {cwd} : undefined));
195
+ const { cwd } = options ?? EMPTY_OBJECT;
196
+ return wrap_void(() => git_stash_pop(cwd ? { cwd } : undefined));
195
197
  },
196
198
 
197
199
  // File change detection
198
200
  has_file_changed: async (options) => {
199
- const {from_commit, to_commit, file_path, cwd} = options;
201
+ const { from_commit, to_commit, file_path, cwd } = options;
200
202
  return wrap_with_value(() =>
201
- git_has_file_changed(from_commit, to_commit, file_path, cwd ? {cwd} : undefined),
203
+ git_has_file_changed(from_commit, to_commit, file_path, cwd ? { cwd } : undefined)
202
204
  );
203
- },
205
+ }
204
206
  };
205
207
 
206
208
  export const default_process_operations: ProcessOperations = {
207
209
  spawn: async (options) => {
208
- const {cmd, args, cwd} = options;
210
+ const { cmd, args, cwd } = options;
209
211
  try {
210
- const spawned = await spawn_out(cmd, args, cwd ? {cwd} : undefined);
212
+ const spawned = await spawn_out(cmd, args, cwd ? { cwd } : undefined);
211
213
  if (spawned.result.ok) {
212
214
  return {
213
215
  ok: true,
214
216
  stdout: spawned.stdout || undefined,
215
- stderr: spawned.stderr || undefined,
217
+ stderr: spawned.stderr || undefined
216
218
  };
217
219
  } else {
218
220
  return {
219
221
  ok: false,
220
222
  message: 'Command failed',
221
- stderr: spawned.stderr || undefined,
223
+ stderr: spawned.stderr || undefined
222
224
  };
223
225
  }
224
226
  } catch (error) {
225
- return {ok: false, message: String(error)};
227
+ return { ok: false, message: String(error) };
226
228
  }
227
- },
229
+ }
228
230
  };
229
231
 
230
232
  export const default_npm_operations: NpmOperations = {
231
233
  wait_for_package: async (options) => {
232
- const {pkg, version, wait_options, log} = options;
234
+ const { pkg, version, wait_options, log } = options;
233
235
  try {
234
- await wait_for_package(pkg, version, {...wait_options, log});
235
- return {ok: true};
236
+ await wait_for_package(pkg, version, { ...wait_options, log });
237
+ return { ok: true };
236
238
  } catch (error) {
237
- return {ok: false, message: String(error), timeout: true};
239
+ return { ok: false, message: String(error), timeout: true };
238
240
  }
239
241
  },
240
242
 
@@ -244,12 +246,12 @@ export const default_npm_operations: NpmOperations = {
244
246
  if (result.stdout) {
245
247
  const username = result.stdout.trim();
246
248
  if (username) {
247
- return {ok: true, username};
249
+ return { ok: true, username };
248
250
  }
249
251
  }
250
- return {ok: false, message: 'Not logged in to npm'};
252
+ return { ok: false, message: 'Not logged in to npm' };
251
253
  } catch (error) {
252
- return {ok: false, message: String(error)};
254
+ return { ok: false, message: String(error) };
253
255
  }
254
256
  },
255
257
 
@@ -257,63 +259,63 @@ export const default_npm_operations: NpmOperations = {
257
259
  try {
258
260
  const result = await spawn_out('npm', ['ping']);
259
261
  if (result.stdout) {
260
- return {ok: true};
262
+ return { ok: true };
261
263
  }
262
- return {ok: false, message: 'Failed to ping npm registry'};
264
+ return { ok: false, message: 'Failed to ping npm registry' };
263
265
  } catch (error) {
264
- return {ok: false, message: String(error)};
266
+ return { ok: false, message: String(error) };
265
267
  }
266
268
  },
267
269
 
268
270
  install: async (options) => {
269
- const {cwd} = options ?? EMPTY_OBJECT;
271
+ const { cwd } = options ?? EMPTY_OBJECT;
270
272
  try {
271
- const spawned = await spawn_out('npm', ['install'], cwd ? {cwd} : undefined);
273
+ const spawned = await spawn_out('npm', ['install'], cwd ? { cwd } : undefined);
272
274
  if (spawned.result.ok) {
273
- return {ok: true};
275
+ return { ok: true };
274
276
  } else {
275
- return {ok: false, message: 'Install failed', stderr: spawned.stderr || undefined};
277
+ return { ok: false, message: 'Install failed', stderr: spawned.stderr || undefined };
276
278
  }
277
279
  } catch (error) {
278
- return {ok: false, message: String(error)};
280
+ return { ok: false, message: String(error) };
279
281
  }
280
- },
282
+ }
281
283
  };
282
284
 
283
285
  export const default_preflight_operations: PreflightOperations = {
284
286
  run_preflight_checks: async (options) => {
285
287
  return run_preflight_checks(options);
286
- },
288
+ }
287
289
  };
288
290
 
289
291
  export const default_fs_operations: FsOperations = {
290
292
  readFile: async (options) => {
291
- const {path, encoding} = options;
293
+ const { path, encoding } = options;
292
294
  try {
293
295
  const value = await readFile(path, encoding);
294
- return {ok: true, value};
296
+ return { ok: true, value };
295
297
  } catch (error) {
296
- return {ok: false, ...fs_classify_error(error)};
298
+ return { ok: false, ...fs_classify_error(error) };
297
299
  }
298
300
  },
299
301
 
300
302
  writeFile: async (options) => {
301
- const {path, content} = options;
303
+ const { path, content } = options;
302
304
  try {
303
305
  await writeFile(path, content);
304
- return {ok: true};
306
+ return { ok: true };
305
307
  } catch (error) {
306
- return {ok: false, ...fs_classify_error(error)};
308
+ return { ok: false, ...fs_classify_error(error) };
307
309
  }
308
310
  },
309
311
 
310
312
  mkdir: async (options) => {
311
- const {path, recursive} = options;
313
+ const { path, recursive } = options;
312
314
  try {
313
- await mkdir(path, {recursive});
314
- return {ok: true};
315
+ await mkdir(path, { recursive });
316
+ return { ok: true };
315
317
  } catch (error) {
316
- return {ok: false, ...fs_classify_error(error)};
318
+ return { ok: false, ...fs_classify_error(error) };
317
319
  }
318
320
  },
319
321
 
@@ -324,28 +326,28 @@ export const default_fs_operations: FsOperations = {
324
326
  } catch {
325
327
  return false;
326
328
  }
327
- },
329
+ }
328
330
  };
329
331
 
330
332
  export const default_build_operations: BuildOperations = {
331
333
  build_package: async (options) => {
332
- const {repo, log} = options;
334
+ const { repo, log } = options;
333
335
  try {
334
336
  log?.info(` Building ${repo.library.name}...`);
335
- const spawned = await spawn_out('gro', ['build'], {cwd: repo.repo_dir});
337
+ const spawned = await spawn_out('gro', ['build'], { cwd: repo.repo_dir });
336
338
  if (spawned.result.ok) {
337
- return {ok: true};
339
+ return { ok: true };
338
340
  } else {
339
341
  return {
340
342
  ok: false,
341
343
  message: 'Build failed',
342
- output: spawned.stderr || spawned.stdout || 'Build failed',
344
+ output: spawned.stderr || spawned.stdout || 'Build failed'
343
345
  };
344
346
  }
345
347
  } catch (error) {
346
- return {ok: false, message: String(error)};
348
+ return { ok: false, message: String(error) };
347
349
  }
348
- },
350
+ }
349
351
  };
350
352
 
351
353
  /**
@@ -358,5 +360,5 @@ export const default_gitops_operations: GitopsOperations = {
358
360
  npm: default_npm_operations,
359
361
  preflight: default_preflight_operations,
360
362
  fs: default_fs_operations,
361
- build: default_build_operations,
363
+ build: default_build_operations
362
364
  };
@@ -1,5 +1,5 @@
1
- import type {Logger} from '@fuzdev/fuz_util/log.js';
2
- import {writeFile} from 'node:fs/promises';
1
+ import type { Logger } from '@fuzdev/fuz_util/log.ts';
2
+ import { writeFile } from 'node:fs/promises';
3
3
 
4
4
  export type OutputFormat = 'stdout' | 'json' | 'markdown';
5
5
 
@@ -31,9 +31,9 @@ export interface OutputFormatters<T> {
31
31
  export const format_and_output = async <T>(
32
32
  data: T,
33
33
  formatters: OutputFormatters<T>,
34
- options: OutputOptions,
34
+ options: OutputOptions
35
35
  ): Promise<void> => {
36
- const {format, outfile, log} = options;
36
+ const { format, outfile, log } = options;
37
37
 
38
38
  // Handle stdout format (special case - uses logger directly)
39
39
  if (format === 'stdout') {
@@ -1,21 +1,21 @@
1
- import type {Logger} from '@fuzdev/fuz_util/log.js';
2
- import type {Result} from '@fuzdev/fuz_util/result.js';
3
- import {spawn_out} from '@fuzdev/fuz_util/process.js';
4
- import {styleText as st} from 'node:util';
1
+ import type { Logger } from '@fuzdev/fuz_util/log.ts';
2
+ import type { Result } from '@fuzdev/fuz_util/result.ts';
3
+ import { spawn_out } from '@fuzdev/fuz_util/process.ts';
4
+ import { styleText as st } from 'node:util';
5
5
 
6
- import type {LocalRepo} from './local_repo.js';
6
+ import type { LocalRepo } from './local_repo.ts';
7
7
  import type {
8
8
  GitOperations,
9
9
  NpmOperations,
10
10
  BuildOperations,
11
- ChangesetOperations,
12
- } from './operations.js';
11
+ ChangesetOperations
12
+ } from './operations.ts';
13
13
  import {
14
14
  default_git_operations,
15
15
  default_npm_operations,
16
16
  default_build_operations,
17
- default_changeset_operations,
18
- } from './operations_defaults.js';
17
+ default_changeset_operations
18
+ } from './operations_defaults.ts';
19
19
 
20
20
  export interface PreflightOptions {
21
21
  skip_changesets?: boolean;
@@ -68,7 +68,7 @@ export const run_preflight_checks = async ({
68
68
  git_ops = default_git_operations,
69
69
  npm_ops = default_npm_operations,
70
70
  build_ops = default_build_operations,
71
- changeset_ops = default_changeset_operations,
71
+ changeset_ops = default_changeset_operations
72
72
  }: RunPreflightChecksOptions): Promise<PreflightResult> => {
73
73
  const {
74
74
  skip_changesets = false,
@@ -76,7 +76,7 @@ export const run_preflight_checks = async ({
76
76
  required_branch = 'main',
77
77
  check_remote = true,
78
78
  estimate_time = true,
79
- log,
79
+ log
80
80
  } = preflight_options;
81
81
 
82
82
  const warnings: Array<string> = [];
@@ -91,7 +91,7 @@ export const run_preflight_checks = async ({
91
91
  // 1. Check clean workspaces - must be 100% clean before publishing
92
92
  log?.info(' Checking workspace cleanliness...');
93
93
  for (const repo of repos) {
94
- const clean_result = await git_ops.check_clean_workspace({cwd: repo.repo_dir});
94
+ const clean_result = await git_ops.check_clean_workspace({ cwd: repo.repo_dir });
95
95
  if (!clean_result.ok) {
96
96
  errors.push(`${repo.library.name} failed workspace check: ${clean_result.message}`);
97
97
  continue;
@@ -99,14 +99,14 @@ export const run_preflight_checks = async ({
99
99
 
100
100
  if (!clean_result.value) {
101
101
  // Get list of changed files for better error message
102
- const files_result = await git_ops.list_uncommitted_files({cwd: repo.repo_dir});
102
+ const files_result = await git_ops.list_uncommitted_files({ cwd: repo.repo_dir });
103
103
  if (files_result.ok) {
104
104
  // No filtering - workspace must be 100% clean
105
105
  const unexpected_files = files_result.value;
106
106
 
107
107
  if (unexpected_files.length > 0) {
108
108
  errors.push(
109
- `${repo.library.name} has uncommitted changes in: ${unexpected_files.slice(0, 3).join(', ')}${unexpected_files.length > 3 ? ` and ${unexpected_files.length - 3} more` : ''}`,
109
+ `${repo.library.name} has uncommitted changes in: ${unexpected_files.slice(0, 3).join(', ')}${unexpected_files.length > 3 ? ` and ${unexpected_files.length - 3} more` : ''}`
110
110
  );
111
111
  }
112
112
  } else {
@@ -118,7 +118,7 @@ export const run_preflight_checks = async ({
118
118
  // 2. Check correct branch
119
119
  log?.info(` Checking branches (expecting ${required_branch})...`);
120
120
  for (const repo of repos) {
121
- const branch_result = await git_ops.current_branch_name({cwd: repo.repo_dir});
121
+ const branch_result = await git_ops.current_branch_name({ cwd: repo.repo_dir });
122
122
  if (!branch_result.ok) {
123
123
  errors.push(`${repo.library.name} failed branch check: ${branch_result.message}`);
124
124
  continue;
@@ -126,7 +126,7 @@ export const run_preflight_checks = async ({
126
126
 
127
127
  if (branch_result.value !== required_branch) {
128
128
  errors.push(
129
- `${repo.library.name} is on branch '${branch_result.value}', expected '${required_branch}'`,
129
+ `${repo.library.name} is on branch '${branch_result.value}', expected '${required_branch}'`
130
130
  );
131
131
  }
132
132
  }
@@ -135,7 +135,7 @@ export const run_preflight_checks = async ({
135
135
  if (!skip_changesets) {
136
136
  log?.info(' Checking for changesets...');
137
137
  for (const repo of repos) {
138
- const has_result = await changeset_ops.has_changesets({repo});
138
+ const has_result = await changeset_ops.has_changesets({ repo });
139
139
  if (!has_result.ok) {
140
140
  errors.push(`${repo.library.name} failed changeset check: ${has_result.message}`);
141
141
  continue;
@@ -162,12 +162,12 @@ export const run_preflight_checks = async ({
162
162
  for (let i = 0; i < repos_to_build.length; i++) {
163
163
  const repo = repos_to_build[i]!;
164
164
  log?.info(
165
- st('dim', ` [${i + 1}/${repos_to_build.length}] Building ${repo.library.name}...`),
165
+ st('dim', ` [${i + 1}/${repos_to_build.length}] Building ${repo.library.name}...`)
166
166
  );
167
- const build_result = await build_ops.build_package({repo, log});
167
+ const build_result = await build_ops.build_package({ repo, log });
168
168
  if (!build_result.ok) {
169
169
  errors.push(
170
- `${repo.library.name} failed to build: ${build_result.output || build_result.message || 'unknown error'}`,
170
+ `${repo.library.name} failed to build: ${build_result.output || build_result.message || 'unknown error'}`
171
171
  );
172
172
  } else {
173
173
  log?.info(st('dim', ` ✓ ${repo.library.name} built successfully`));
@@ -217,8 +217,8 @@ export const run_preflight_checks = async ({
217
217
  log?.info(
218
218
  st(
219
219
  'dim',
220
- ` Estimated publish time: ~${Math.ceil(estimated_duration / 60)} minutes for ${packages_to_publish} package(s)`,
221
- ),
220
+ ` Estimated publish time: ~${Math.ceil(estimated_duration / 60)} minutes for ${packages_to_publish} package(s)`
221
+ )
222
222
  );
223
223
  }
224
224
  }
@@ -251,19 +251,19 @@ export const run_preflight_checks = async ({
251
251
  repos_with_changesets,
252
252
  repos_without_changesets,
253
253
  estimated_duration,
254
- npm_username,
254
+ npm_username
255
255
  };
256
256
  };
257
257
 
258
- const check_git_remote = async (cwd: string): Promise<Result<object, {message: string}>> => {
258
+ const check_git_remote = async (cwd: string): Promise<Result<object, { message: string }>> => {
259
259
  try {
260
260
  // Try to fetch refs from remote without downloading objects
261
- const result = await spawn_out('git', ['ls-remote', '--heads', 'origin'], {cwd});
261
+ const result = await spawn_out('git', ['ls-remote', '--heads', 'origin'], { cwd });
262
262
  if (result.stdout || result.stderr) {
263
- return {ok: true};
263
+ return { ok: true };
264
264
  }
265
- return {ok: false, message: 'No response from git remote'};
265
+ return { ok: false, message: 'No response from git remote' };
266
266
  } catch (error) {
267
- return {ok: false, message: String(error)};
267
+ return { ok: false, message: String(error) };
268
268
  }
269
269
  };
@@ -8,14 +8,12 @@
8
8
  * @module
9
9
  */
10
10
 
11
- import type {PublishingResult} from './multi_repo_publisher.js';
12
- import type {PublishingPlan} from './publishing_plan.js';
11
+ import type { PublishingResult } from './multi_repo_publisher.ts';
12
+ import type { PublishingPlan } from './publishing_plan.ts';
13
13
 
14
14
  /** What the task should do with a generated plan before executing the cascade. */
15
15
  export type PublishGate =
16
- | {action: 'blocked'; message: string}
17
- | {action: 'confirm'}
18
- | {action: 'proceed'};
16
+ { action: 'blocked'; message: string } | { action: 'confirm' } | { action: 'proceed' };
19
17
 
20
18
  export interface PublishGateOptions {
21
19
  /** A real publish (`--wetrun`); a dry run never prompts. */
@@ -36,11 +34,11 @@ export interface PublishGateOptions {
36
34
  * - `proceed`: a dry run, or a `--no-plan` real publish — no prompt.
37
35
  */
38
36
  export const decide_publish_gate = (options: PublishGateOptions): PublishGate => {
39
- if (!options.wetrun || !options.show_plan) return {action: 'proceed'};
37
+ if (!options.wetrun || !options.show_plan) return { action: 'proceed' };
40
38
  if (options.plan.errors.length > 0) {
41
- return {action: 'blocked', message: 'Cannot proceed with publishing due to errors'};
39
+ return { action: 'blocked', message: 'Cannot proceed with publishing due to errors' };
42
40
  }
43
- return {action: 'confirm'};
41
+ return { action: 'confirm' };
44
42
  };
45
43
 
46
44
  /**
@@ -49,5 +47,5 @@ export const decide_publish_gate = (options: PublishGateOptions): PublishGate =>
49
47
  */
50
48
  export const publish_run_failed = (
51
49
  result: Pick<PublishingResult, 'ok'>,
52
- fatal_error: Error | null,
50
+ fatal_error: Error | null
53
51
  ): boolean => !result.ok || fatal_error !== null;