@fuzdev/fuz_gitops 0.71.0 → 0.73.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.
- package/README.md +13 -6
- package/dist/changeset_generator.d.ts.map +1 -1
- package/dist/changeset_generator.js +2 -16
- package/dist/changeset_reader.d.ts +1 -1
- package/dist/changeset_reader.d.ts.map +1 -1
- package/dist/dependency_graph.js +1 -1
- package/dist/git_operations.d.ts +5 -0
- package/dist/git_operations.d.ts.map +1 -1
- package/dist/git_operations.js +5 -0
- package/dist/gitops_analyze.task.d.ts +1 -0
- package/dist/gitops_analyze.task.d.ts.map +1 -1
- package/dist/gitops_analyze.task.js +12 -17
- package/dist/gitops_plan.task.d.ts +1 -0
- package/dist/gitops_plan.task.d.ts.map +1 -1
- package/dist/gitops_plan.task.js +9 -2
- package/dist/gitops_publish.task.d.ts +3 -2
- package/dist/gitops_publish.task.d.ts.map +1 -1
- package/dist/gitops_publish.task.js +90 -26
- package/dist/gitops_run.task.d.ts +2 -1
- package/dist/gitops_run.task.d.ts.map +1 -1
- package/dist/gitops_run.task.js +40 -7
- package/dist/gitops_sync.task.d.ts +1 -0
- package/dist/gitops_sync.task.d.ts.map +1 -1
- package/dist/gitops_sync.task.js +16 -2
- package/dist/gitops_task_helpers.d.ts +16 -2
- package/dist/gitops_task_helpers.d.ts.map +1 -1
- package/dist/gitops_task_helpers.js +11 -3
- package/dist/gitops_validate.task.d.ts +1 -0
- package/dist/gitops_validate.task.d.ts.map +1 -1
- package/dist/gitops_validate.task.js +20 -20
- package/dist/graph_validation.d.ts +16 -1
- package/dist/graph_validation.d.ts.map +1 -1
- package/dist/graph_validation.js +15 -0
- package/dist/local_repo.d.ts +22 -10
- package/dist/local_repo.d.ts.map +1 -1
- package/dist/local_repo.js +92 -75
- package/dist/log_helpers.d.ts +0 -5
- package/dist/log_helpers.d.ts.map +1 -1
- package/dist/log_helpers.js +8 -19
- package/dist/multi_repo_publisher.d.ts +29 -2
- package/dist/multi_repo_publisher.d.ts.map +1 -1
- package/dist/multi_repo_publisher.js +307 -233
- package/dist/operations.d.ts +6 -26
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations_defaults.d.ts.map +1 -1
- package/dist/operations_defaults.js +1 -19
- package/dist/output_helpers.d.ts.map +1 -1
- package/dist/output_helpers.js +7 -6
- package/dist/paths.d.ts +0 -4
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -4
- package/dist/publish_gate.d.ts +44 -0
- package/dist/publish_gate.d.ts.map +1 -0
- package/dist/publish_gate.js +32 -0
- package/dist/publish_steps.d.ts +60 -0
- package/dist/publish_steps.d.ts.map +1 -0
- package/dist/publish_steps.js +113 -0
- package/dist/publishing_event.d.ts +123 -0
- package/dist/publishing_event.d.ts.map +1 -0
- package/dist/publishing_event.js +140 -0
- package/dist/publishing_event_handler.d.ts +42 -0
- package/dist/publishing_event_handler.d.ts.map +1 -0
- package/dist/publishing_event_handler.js +75 -0
- package/dist/publishing_plan.d.ts +1 -2
- package/dist/publishing_plan.d.ts.map +1 -1
- package/dist/publishing_plan.js +18 -1
- package/dist/publishing_plan_helpers.d.ts +1 -1
- package/dist/publishing_plan_helpers.d.ts.map +1 -1
- package/dist/publishing_plan_helpers.js +2 -15
- package/dist/publishing_plan_logging.d.ts.map +1 -1
- package/dist/publishing_plan_logging.js +15 -23
- package/dist/repo_ops.d.ts +1 -1
- package/dist/repo_ops.js +1 -1
- package/dist/version_utils.d.ts +17 -3
- package/dist/version_utils.d.ts.map +1 -1
- package/dist/version_utils.js +22 -0
- package/package.json +6 -7
- package/src/lib/changeset_generator.ts +10 -19
- package/src/lib/changeset_reader.ts +1 -2
- package/src/lib/dependency_graph.ts +1 -1
- package/src/lib/git_operations.ts +5 -0
- package/src/lib/gitops_analyze.task.ts +18 -23
- package/src/lib/gitops_plan.task.ts +10 -2
- package/src/lib/gitops_publish.task.ts +100 -25
- package/src/lib/gitops_run.task.ts +39 -7
- package/src/lib/gitops_sync.task.ts +18 -3
- package/src/lib/gitops_task_helpers.ts +20 -3
- package/src/lib/gitops_validate.task.ts +30 -22
- package/src/lib/graph_validation.ts +26 -0
- package/src/lib/local_repo.ts +114 -83
- package/src/lib/log_helpers.ts +8 -26
- package/src/lib/multi_repo_publisher.ts +387 -269
- package/src/lib/operations.ts +6 -22
- package/src/lib/operations_defaults.ts +1 -19
- package/src/lib/output_helpers.ts +7 -6
- package/src/lib/paths.ts +0 -5
- package/src/lib/publish_gate.ts +53 -0
- package/src/lib/publish_steps.ts +149 -0
- package/src/lib/publishing_event.ts +151 -0
- package/src/lib/publishing_event_handler.ts +98 -0
- package/src/lib/publishing_plan.ts +23 -3
- package/src/lib/publishing_plan_helpers.ts +5 -18
- package/src/lib/publishing_plan_logging.ts +19 -39
- package/src/lib/repo_ops.ts +1 -1
- package/src/lib/version_utils.ts +30 -9
- package/dist/npm_install_helpers.d.ts +0 -23
- package/dist/npm_install_helpers.d.ts.map +0 -1
- package/dist/npm_install_helpers.js +0 -60
- package/dist/semver.d.ts +0 -26
- package/dist/semver.d.ts.map +0 -1
- package/dist/semver.js +0 -137
- package/dist/serialization_types.d.ts +0 -59
- package/dist/serialization_types.d.ts.map +0 -1
- package/dist/serialization_types.js +0 -42
- package/src/lib/npm_install_helpers.ts +0 -85
- package/src/lib/semver.ts +0 -170
- package/src/lib/serialization_types.ts +0 -92
package/dist/operations.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ import type { FsError } from '@fuzdev/fuz_util/fs.js';
|
|
|
38
38
|
import type { Logger } from '@fuzdev/fuz_util/log.js';
|
|
39
39
|
import type { LocalRepo } from './local_repo.js';
|
|
40
40
|
import type { ChangesetInfo } from './changeset_reader.js';
|
|
41
|
-
import type { BumpType } from './
|
|
41
|
+
import type { BumpType } from './version_utils.js';
|
|
42
42
|
import type { PreflightOptions, PreflightResult } from './preflight_checks.js';
|
|
43
43
|
import type { WaitOptions } from './npm_registry.js';
|
|
44
44
|
/**
|
|
@@ -188,7 +188,9 @@ export interface GitOperations {
|
|
|
188
188
|
message: string;
|
|
189
189
|
}>>;
|
|
190
190
|
/**
|
|
191
|
-
* Checks
|
|
191
|
+
* Checks whether the working tree has any changes — staged, unstaged, or
|
|
192
|
+
* untracked (`git status --porcelain`). Broader than `list_uncommitted_files`,
|
|
193
|
+
* which reports only tracked working-tree changes relative to HEAD.
|
|
192
194
|
*/
|
|
193
195
|
has_changes: (options?: {
|
|
194
196
|
cwd?: string;
|
|
@@ -198,11 +200,8 @@ export interface GitOperations {
|
|
|
198
200
|
message: string;
|
|
199
201
|
}>>;
|
|
200
202
|
/**
|
|
201
|
-
* Lists uncommitted files in the working tree (`git diff --name-only HEAD`)
|
|
202
|
-
*
|
|
203
|
-
* Renamed from `get_changed_files` in 2026-04 because "changed files" collided
|
|
204
|
-
* with mageguild's `get_changed_files` which diffs two refs. This one reports
|
|
205
|
-
* uncommitted working-tree changes relative to HEAD.
|
|
203
|
+
* Lists uncommitted files in the working tree (`git diff --name-only HEAD`),
|
|
204
|
+
* i.e. working-tree changes relative to HEAD (not a diff between two refs).
|
|
206
205
|
*/
|
|
207
206
|
list_uncommitted_files: (options?: {
|
|
208
207
|
cwd?: string;
|
|
@@ -314,18 +313,6 @@ export interface NpmOperations {
|
|
|
314
313
|
message: string;
|
|
315
314
|
timeout?: boolean;
|
|
316
315
|
}>>;
|
|
317
|
-
/**
|
|
318
|
-
* Checks if a package version is available on NPM.
|
|
319
|
-
*/
|
|
320
|
-
check_package_available: (options: {
|
|
321
|
-
pkg: string;
|
|
322
|
-
version: string;
|
|
323
|
-
log?: Logger;
|
|
324
|
-
}) => Promise<Result<{
|
|
325
|
-
value: boolean;
|
|
326
|
-
}, {
|
|
327
|
-
message: string;
|
|
328
|
-
}>>;
|
|
329
316
|
/**
|
|
330
317
|
* Checks npm authentication status.
|
|
331
318
|
*/
|
|
@@ -349,13 +336,6 @@ export interface NpmOperations {
|
|
|
349
336
|
message: string;
|
|
350
337
|
stderr?: string;
|
|
351
338
|
}>>;
|
|
352
|
-
/**
|
|
353
|
-
* Cleans the npm cache.
|
|
354
|
-
* Uses `npm cache clean --force` to clear stale cache entries.
|
|
355
|
-
*/
|
|
356
|
-
cache_clean: () => Promise<Result<object, {
|
|
357
|
-
message: string;
|
|
358
|
-
}>>;
|
|
359
339
|
}
|
|
360
340
|
/**
|
|
361
341
|
* Preflight validation operations to ensure repos are ready for publishing.
|
package/dist/operations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,oBAAoB,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AS,EAAE,CAAC,OAAO,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAE1F;;OAEG;IACH,KAAK,EAAE,CAAC,OAAO,EAAE;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAE1F;;OAEG;IACH,MAAM,EAAE,CAAC,OAAO,EAAE;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACtD;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,mBAAmB,CAAC;IAC/B,GAAG,EAAE,aAAa,CAAC;IACnB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,GAAG,EAAE,aAAa,CAAC;IACnB,SAAS,EAAE,mBAAmB,CAAC;IAC/B,EAAE,EAAE,YAAY,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;CACvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations_defaults.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations_defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4BH,OAAO,KAAK,EACX,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,MAAM,iBAAiB,CAAC;AA0BzB,eAAO,MAAM,4BAA4B,EAAE,mBAuB1C,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aA0GpC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,iBAsBxC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"operations_defaults.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/operations_defaults.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA4BH,OAAO,KAAK,EACX,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,MAAM,iBAAiB,CAAC;AA0BzB,eAAO,MAAM,4BAA4B,EAAE,mBAuB1C,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aA0GpC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,iBAsBxC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAmDpC,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,mBAI1C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,YAuCnC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAmBtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,gBAQvC,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { git_checkout } from '@fuzdev/fuz_util/git.js';
|
|
|
12
12
|
import { fs_classify_error } from '@fuzdev/fuz_util/fs.js';
|
|
13
13
|
import { EMPTY_OBJECT } from '@fuzdev/fuz_util/object.js';
|
|
14
14
|
import { has_changesets, read_changesets, predict_next_version } from './changeset_reader.js';
|
|
15
|
-
import { wait_for_package
|
|
15
|
+
import { wait_for_package } from './npm_registry.js';
|
|
16
16
|
import { run_preflight_checks } from './preflight_checks.js';
|
|
17
17
|
import { git_add, git_commit, git_add_and_commit, git_tag, git_push_tag, git_has_changes, git_list_uncommitted_files, git_has_file_changed, git_stash, git_stash_pop, git_switch_branch, git_current_branch_name_required, git_current_commit_hash_required, git_check_clean_workspace_as_boolean, git_has_remote, } from './git_operations.js';
|
|
18
18
|
/** Wrap an async function that returns a value */
|
|
@@ -181,10 +181,6 @@ export const default_npm_operations = {
|
|
|
181
181
|
return { ok: false, message: String(error), timeout: true };
|
|
182
182
|
}
|
|
183
183
|
},
|
|
184
|
-
check_package_available: async (options) => {
|
|
185
|
-
const { pkg, version, log } = options;
|
|
186
|
-
return wrap_with_value(() => check_package_available(pkg, version, { log }));
|
|
187
|
-
},
|
|
188
184
|
check_auth: async () => {
|
|
189
185
|
try {
|
|
190
186
|
const result = await spawn_out('npm', ['whoami']);
|
|
@@ -227,20 +223,6 @@ export const default_npm_operations = {
|
|
|
227
223
|
return { ok: false, message: String(error) };
|
|
228
224
|
}
|
|
229
225
|
},
|
|
230
|
-
cache_clean: async () => {
|
|
231
|
-
try {
|
|
232
|
-
const spawned = await spawn_out('npm', ['cache', 'clean', '--force']);
|
|
233
|
-
if (spawned.result.ok) {
|
|
234
|
-
return { ok: true };
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
return { ok: false, message: 'Cache clean failed' };
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
catch (error) {
|
|
241
|
-
return { ok: false, message: String(error) };
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
226
|
};
|
|
245
227
|
export const default_preflight_operations = {
|
|
246
228
|
run_preflight_checks: async (options) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/output_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC;;OAEG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAU,CAAC,EACxC,MAAM,CAAC,EACP,YAAY,gBAAgB,CAAC,CAAC,CAAC,EAC/B,SAAS,aAAa,KACpB,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"output_helpers.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/output_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAGpD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAClC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC;;OAEG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAU,CAAC,EACxC,MAAM,CAAC,EACP,YAAY,gBAAgB,CAAC,CAAC,CAAC,EAC/B,SAAS,aAAa,KACpB,OAAO,CAAC,IAAI,CA8Bd,CAAC"}
|
package/dist/output_helpers.js
CHANGED
|
@@ -24,16 +24,17 @@ export const format_and_output = async (data, formatters, options) => {
|
|
|
24
24
|
}
|
|
25
25
|
// Format data
|
|
26
26
|
const content = format === 'json' ? formatters.json(data) : formatters.markdown(data).join('\n');
|
|
27
|
-
// Output to file or
|
|
27
|
+
// Output to file or stdout
|
|
28
28
|
if (outfile) {
|
|
29
29
|
await writeFile(outfile, content);
|
|
30
30
|
log?.info(`Output written to ${outfile}`);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
// Write raw to stdout in one shot. Routing through `log` would prefix every
|
|
34
|
+
// line with `[taskname]`, corrupting JSON and cluttering markdown — keep the
|
|
35
|
+
// machine-readable formats unprefixed and pipeable (use `--outfile` for output
|
|
36
|
+
// fully free of Gro's own preamble).
|
|
37
|
+
// eslint-disable-next-line no-console
|
|
38
|
+
console.log(content);
|
|
38
39
|
}
|
|
39
40
|
};
|
package/dist/paths.d.ts
CHANGED
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/paths.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/paths.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,OAAO,CAAC"}
|
package/dist/paths.js
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure decision logic for the `gitops_publish` task's interactive gating.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `gitops_publish.task.ts` so the gating table is unit-testable without driving
|
|
5
|
+
* readline or `process.exit`. The task keeps the IO — prompt, exit, logging — at its edge and
|
|
6
|
+
* consults these for every branch.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import type { PublishingResult } from './multi_repo_publisher.js';
|
|
11
|
+
import type { PublishingPlan } from './publishing_plan.js';
|
|
12
|
+
/** What the task should do with a generated plan before executing the cascade. */
|
|
13
|
+
export type PublishGate = {
|
|
14
|
+
action: 'blocked';
|
|
15
|
+
message: string;
|
|
16
|
+
} | {
|
|
17
|
+
action: 'confirm';
|
|
18
|
+
} | {
|
|
19
|
+
action: 'proceed';
|
|
20
|
+
};
|
|
21
|
+
export interface PublishGateOptions {
|
|
22
|
+
/** A real publish (`--wetrun`); a dry run never prompts. */
|
|
23
|
+
wetrun: boolean;
|
|
24
|
+
/** Show the plan and confirm (`plan`); `--no-plan` skips the prompt. */
|
|
25
|
+
show_plan: boolean;
|
|
26
|
+
plan: Pick<PublishingPlan, 'errors'>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Decides whether a publish run must block, prompt for confirmation, or proceed without
|
|
30
|
+
* prompting, from the pre-execution inputs.
|
|
31
|
+
*
|
|
32
|
+
* - `blocked`: a real publish whose plan has errors — fail loud before prompting. The executor
|
|
33
|
+
* enforces this too, so `--no-plan` can't bypass the gate; this branch only avoids prompting
|
|
34
|
+
* for (and printing the "this will publish" banner of) a plan that can't run.
|
|
35
|
+
* - `confirm`: a real publish that shows its plan — the user must confirm interactively.
|
|
36
|
+
* - `proceed`: a dry run, or a `--no-plan` real publish — no prompt.
|
|
37
|
+
*/
|
|
38
|
+
export declare const decide_publish_gate: (options: PublishGateOptions) => PublishGate;
|
|
39
|
+
/**
|
|
40
|
+
* Whether a finished run should exit non-zero: an unsuccessful result, or a fatal error thrown
|
|
41
|
+
* out of the executor.
|
|
42
|
+
*/
|
|
43
|
+
export declare const publish_run_failed: (result: Pick<PublishingResult, "ok">, fatal_error: Error | null) => boolean;
|
|
44
|
+
//# sourceMappingURL=publish_gate.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure decision logic for the `gitops_publish` task's interactive gating.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `gitops_publish.task.ts` so the gating table is unit-testable without driving
|
|
5
|
+
* readline or `process.exit`. The task keeps the IO — prompt, exit, logging — at its edge and
|
|
6
|
+
* consults these for every branch.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Decides whether a publish run must block, prompt for confirmation, or proceed without
|
|
12
|
+
* prompting, from the pre-execution inputs.
|
|
13
|
+
*
|
|
14
|
+
* - `blocked`: a real publish whose plan has errors — fail loud before prompting. The executor
|
|
15
|
+
* enforces this too, so `--no-plan` can't bypass the gate; this branch only avoids prompting
|
|
16
|
+
* for (and printing the "this will publish" banner of) a plan that can't run.
|
|
17
|
+
* - `confirm`: a real publish that shows its plan — the user must confirm interactively.
|
|
18
|
+
* - `proceed`: a dry run, or a `--no-plan` real publish — no prompt.
|
|
19
|
+
*/
|
|
20
|
+
export const decide_publish_gate = (options) => {
|
|
21
|
+
if (!options.wetrun || !options.show_plan)
|
|
22
|
+
return { action: 'proceed' };
|
|
23
|
+
if (options.plan.errors.length > 0) {
|
|
24
|
+
return { action: 'blocked', message: 'Cannot proceed with publishing due to errors' };
|
|
25
|
+
}
|
|
26
|
+
return { action: 'confirm' };
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Whether a finished run should exit non-zero: an unsuccessful result, or a fatal error thrown
|
|
30
|
+
* out of the executor.
|
|
31
|
+
*/
|
|
32
|
+
export const publish_run_failed = (result, fatal_error) => !result.ok || fatal_error !== null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Side-effect preview for a publishing plan.
|
|
3
|
+
*
|
|
4
|
+
* `derive_publish_steps` linearizes a frozen `PublishingPlan` into the ordered side-effects
|
|
5
|
+
* a `--wetrun` would perform, mirroring `execute_publishing_plan`'s pass so the preview and
|
|
6
|
+
* the executor read the same plan data and can't drift. Pure — no side effects.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
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';
|
|
14
|
+
/** One ordered side-effect a wetrun would perform. */
|
|
15
|
+
export type PublishStep = {
|
|
16
|
+
kind: 'publish';
|
|
17
|
+
repo: string;
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
bump: BumpType;
|
|
21
|
+
via: PublishStepVia;
|
|
22
|
+
} | {
|
|
23
|
+
kind: 'npm_wait';
|
|
24
|
+
repo: string;
|
|
25
|
+
version: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'dependency_update';
|
|
28
|
+
dependent: string;
|
|
29
|
+
dependency: string;
|
|
30
|
+
to: string;
|
|
31
|
+
dep_type: 'prod' | 'peer';
|
|
32
|
+
creates_changeset: boolean;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'dev_dep_update';
|
|
35
|
+
repo: string;
|
|
36
|
+
dependency: string;
|
|
37
|
+
to: string;
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'deploy';
|
|
40
|
+
repo: string;
|
|
41
|
+
builds: boolean;
|
|
42
|
+
};
|
|
43
|
+
export interface DerivePublishStepsOptions {
|
|
44
|
+
/** Include the deploy phase (the publisher only deploys with `--deploy`). */
|
|
45
|
+
deploy?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Derives the ordered side-effects a wetrun would perform from a frozen plan.
|
|
49
|
+
*
|
|
50
|
+
* Reads only `publishing_order`, `version_changes`, and `dependency_updates` — the same data
|
|
51
|
+
* `execute_publishing_plan` consumes, in the same order — so the preview reflects the real
|
|
52
|
+
* pass. A dependency is only propagated to its dependents if it actually publishes this run.
|
|
53
|
+
*/
|
|
54
|
+
export declare const derive_publish_steps: (plan: PublishingPlan, options?: DerivePublishStepsOptions) => Array<PublishStep>;
|
|
55
|
+
/**
|
|
56
|
+
* Formats steps as human-readable lines (one per step) for stdout and markdown output.
|
|
57
|
+
* Returns a single placeholder line when there are no side effects.
|
|
58
|
+
*/
|
|
59
|
+
export declare const format_publish_steps: (steps: Array<PublishStep>) => Array<string>;
|
|
60
|
+
//# sourceMappingURL=publish_steps.d.ts.map
|
|
@@ -0,0 +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,EAAgB,MAAM,sBAAsB,CAAC;AAGxE,uDAAuD;AACvD,MA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effect preview for a publishing plan.
|
|
3
|
+
*
|
|
4
|
+
* `derive_publish_steps` linearizes a frozen `PublishingPlan` into the ordered side-effects
|
|
5
|
+
* a `--wetrun` would perform, mirroring `execute_publishing_plan`'s pass so the preview and
|
|
6
|
+
* the executor read the same plan data and can't drift. Pure — no side effects.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { UnreachableError } from '@fuzdev/fuz_util/error.js';
|
|
11
|
+
const step_via = (change) => change.needs_bump_escalation
|
|
12
|
+
? 'escalation'
|
|
13
|
+
: change.has_changesets
|
|
14
|
+
? 'changeset'
|
|
15
|
+
: 'auto_changeset';
|
|
16
|
+
/**
|
|
17
|
+
* Derives the ordered side-effects a wetrun would perform from a frozen plan.
|
|
18
|
+
*
|
|
19
|
+
* Reads only `publishing_order`, `version_changes`, and `dependency_updates` — the same data
|
|
20
|
+
* `execute_publishing_plan` consumes, in the same order — so the preview reflects the real
|
|
21
|
+
* pass. A dependency is only propagated to its dependents if it actually publishes this run.
|
|
22
|
+
*/
|
|
23
|
+
export const derive_publish_steps = (plan, options = {}) => {
|
|
24
|
+
const { deploy = false } = options;
|
|
25
|
+
const changes = new Map(plan.version_changes.map((vc) => [vc.package_name, vc]));
|
|
26
|
+
const steps = [];
|
|
27
|
+
const changed = new Set(); // for the deploy phase: published + their dependents
|
|
28
|
+
// Phase 1: one pass over the topological order, mirroring `execute_publishing_plan`.
|
|
29
|
+
for (const repo of plan.publishing_order) {
|
|
30
|
+
const change = changes.get(repo);
|
|
31
|
+
if (!change)
|
|
32
|
+
continue; // not in the plan = nothing to publish
|
|
33
|
+
steps.push({
|
|
34
|
+
kind: 'publish',
|
|
35
|
+
repo,
|
|
36
|
+
from: change.from,
|
|
37
|
+
to: change.to,
|
|
38
|
+
bump: change.bump_type,
|
|
39
|
+
via: step_via(change),
|
|
40
|
+
});
|
|
41
|
+
steps.push({ kind: 'npm_wait', repo, version: change.to });
|
|
42
|
+
changed.add(repo);
|
|
43
|
+
// Prod/peer dependents are rewritten right after this publishes. A dependent that
|
|
44
|
+
// republishes (has its own plan version change) gets an auto-changeset and republishes in
|
|
45
|
+
// turn (its rewritten deps are installed + healed by its own `gro publish`); a private
|
|
46
|
+
// dependent has no version change, so it's an update-only leaf — range rewritten, no
|
|
47
|
+
// changeset.
|
|
48
|
+
for (const update of plan.dependency_updates) {
|
|
49
|
+
if (update.updated_dependency !== repo)
|
|
50
|
+
continue;
|
|
51
|
+
if (update.type !== 'dependencies' && update.type !== 'peerDependencies')
|
|
52
|
+
continue;
|
|
53
|
+
const republishes = changes.has(update.dependent_package);
|
|
54
|
+
steps.push({
|
|
55
|
+
kind: 'dependency_update',
|
|
56
|
+
dependent: update.dependent_package,
|
|
57
|
+
dependency: repo,
|
|
58
|
+
to: change.to,
|
|
59
|
+
dep_type: update.type === 'peerDependencies' ? 'peer' : 'prod',
|
|
60
|
+
creates_changeset: republishes,
|
|
61
|
+
});
|
|
62
|
+
changed.add(update.dependent_package);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Phase 2: dev-dependency updates for deps that published this run — committed without a
|
|
66
|
+
// changeset (dev-only changes redeploy, they don't republish). No install step: these repos
|
|
67
|
+
// don't run `gro publish`; gro installs + heals their deps when they next build/deploy/sync.
|
|
68
|
+
for (const update of plan.dependency_updates) {
|
|
69
|
+
if (update.type !== 'devDependencies')
|
|
70
|
+
continue;
|
|
71
|
+
const dep_change = changes.get(update.updated_dependency);
|
|
72
|
+
if (!dep_change)
|
|
73
|
+
continue;
|
|
74
|
+
steps.push({
|
|
75
|
+
kind: 'dev_dep_update',
|
|
76
|
+
repo: update.dependent_package,
|
|
77
|
+
dependency: update.updated_dependency,
|
|
78
|
+
to: dep_change.to,
|
|
79
|
+
});
|
|
80
|
+
changed.add(update.dependent_package);
|
|
81
|
+
}
|
|
82
|
+
// Phase 3: deploy every changed repo (only with --deploy). Each builds fresh.
|
|
83
|
+
if (deploy) {
|
|
84
|
+
for (const repo of changed) {
|
|
85
|
+
steps.push({ kind: 'deploy', repo, builds: true });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return steps;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Formats steps as human-readable lines (one per step) for stdout and markdown output.
|
|
92
|
+
* Returns a single placeholder line when there are no side effects.
|
|
93
|
+
*/
|
|
94
|
+
export const format_publish_steps = (steps) => {
|
|
95
|
+
if (steps.length === 0)
|
|
96
|
+
return ['(no side effects — nothing to publish)'];
|
|
97
|
+
return steps.map((step) => {
|
|
98
|
+
switch (step.kind) {
|
|
99
|
+
case 'publish':
|
|
100
|
+
return `publish ${step.repo} ${step.from} → ${step.to} (${step.bump}, ${step.via})`;
|
|
101
|
+
case 'npm_wait':
|
|
102
|
+
return `npm wait ${step.repo}@${step.version}`;
|
|
103
|
+
case 'dependency_update':
|
|
104
|
+
return `update ${step.dependent} ← ${step.dependency}@${step.to} (${step.dep_type}${step.creates_changeset ? ', changeset' : ''})`;
|
|
105
|
+
case 'dev_dep_update':
|
|
106
|
+
return `dev dep ${step.repo} ← ${step.dependency}@${step.to} (no changeset)`;
|
|
107
|
+
case 'deploy':
|
|
108
|
+
return `deploy ${step.repo}${step.builds ? ' (builds)' : ''}`;
|
|
109
|
+
default:
|
|
110
|
+
throw new UnreachableError(step);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured events for multi-repo publishing.
|
|
3
|
+
*
|
|
4
|
+
* Publishing emits a stream of tagged events alongside its human-readable logging,
|
|
5
|
+
* so machine consumers (CI, dashboards) can follow a run step by step. Every run
|
|
6
|
+
* opens with a `run_started` event carrying `wetrun`: when `false`, the run is a dry
|
|
7
|
+
* run and every `package_completed` is a prediction (its `commit` is `'simulated'`)
|
|
8
|
+
* rather than an applied change. A run's `run_finished` summary is derived from the
|
|
9
|
+
* same event list via `summarize_events`, so the stream and the summary never drift.
|
|
10
|
+
*
|
|
11
|
+
* Events are consumed through a `PublishingEventHandler` sink (see
|
|
12
|
+
* `publishing_event_handler.ts`).
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
/**
|
|
18
|
+
* Coarse triage classification for a failed package. Lets consumers branch on
|
|
19
|
+
* failure kind without parsing the message.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PublishingErrorCode: z.ZodEnum<{
|
|
22
|
+
other: "other";
|
|
23
|
+
build: "build";
|
|
24
|
+
publish: "publish";
|
|
25
|
+
network: "network";
|
|
26
|
+
auth: "auth";
|
|
27
|
+
dependency: "dependency";
|
|
28
|
+
drift: "drift";
|
|
29
|
+
}>;
|
|
30
|
+
export type PublishingErrorCode = z.infer<typeof PublishingErrorCode>;
|
|
31
|
+
/** Tallied outcome of a publishing run, derived from its events via `summarize_events`. */
|
|
32
|
+
export declare const PublishingRunSummary: z.ZodObject<{
|
|
33
|
+
total: z.ZodNumber;
|
|
34
|
+
published: z.ZodNumber;
|
|
35
|
+
failed: z.ZodNumber;
|
|
36
|
+
skipped: z.ZodNumber;
|
|
37
|
+
duration: z.ZodNumber;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type PublishingRunSummary = z.infer<typeof PublishingRunSummary>;
|
|
40
|
+
/**
|
|
41
|
+
* A single structured event emitted during a publishing run. Tagged on `event` so the
|
|
42
|
+
* union serializes as one self-describing JSON object per event (JSON-lines on the wire).
|
|
43
|
+
*/
|
|
44
|
+
export declare const PublishingEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
|
+
event: z.ZodLiteral<"run_started">;
|
|
46
|
+
wetrun: z.ZodBoolean;
|
|
47
|
+
total: z.ZodNumber;
|
|
48
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
49
|
+
event: z.ZodLiteral<"package_skipped">;
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
reason: z.ZodString;
|
|
52
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
53
|
+
event: z.ZodLiteral<"package_completed">;
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
old_version: z.ZodString;
|
|
56
|
+
new_version: z.ZodString;
|
|
57
|
+
bump_type: z.ZodEnum<{
|
|
58
|
+
major: "major";
|
|
59
|
+
minor: "minor";
|
|
60
|
+
patch: "patch";
|
|
61
|
+
}>;
|
|
62
|
+
breaking: z.ZodBoolean;
|
|
63
|
+
commit: z.ZodString;
|
|
64
|
+
tag: z.ZodString;
|
|
65
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
66
|
+
event: z.ZodLiteral<"npm_waited">;
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
version: z.ZodString;
|
|
69
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
70
|
+
event: z.ZodLiteral<"package_failed">;
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
error: z.ZodString;
|
|
73
|
+
code: z.ZodEnum<{
|
|
74
|
+
other: "other";
|
|
75
|
+
build: "build";
|
|
76
|
+
publish: "publish";
|
|
77
|
+
network: "network";
|
|
78
|
+
auth: "auth";
|
|
79
|
+
dependency: "dependency";
|
|
80
|
+
drift: "drift";
|
|
81
|
+
}>;
|
|
82
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
83
|
+
event: z.ZodLiteral<"dependency_updated">;
|
|
84
|
+
dependent: z.ZodString;
|
|
85
|
+
dependency: z.ZodString;
|
|
86
|
+
version: z.ZodString;
|
|
87
|
+
dep_type: z.ZodEnum<{
|
|
88
|
+
prod: "prod";
|
|
89
|
+
peer: "peer";
|
|
90
|
+
dev: "dev";
|
|
91
|
+
}>;
|
|
92
|
+
creates_changeset: z.ZodBoolean;
|
|
93
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
94
|
+
event: z.ZodLiteral<"deploy_started">;
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
+
event: z.ZodLiteral<"deploy_completed">;
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
100
|
+
event: z.ZodLiteral<"deploy_failed">;
|
|
101
|
+
name: z.ZodString;
|
|
102
|
+
error: z.ZodString;
|
|
103
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
104
|
+
event: z.ZodLiteral<"run_finished">;
|
|
105
|
+
summary: z.ZodObject<{
|
|
106
|
+
total: z.ZodNumber;
|
|
107
|
+
published: z.ZodNumber;
|
|
108
|
+
failed: z.ZodNumber;
|
|
109
|
+
skipped: z.ZodNumber;
|
|
110
|
+
duration: z.ZodNumber;
|
|
111
|
+
}, z.core.$strict>;
|
|
112
|
+
}, z.core.$strict>], "event">;
|
|
113
|
+
export type PublishingEvent = z.infer<typeof PublishingEvent>;
|
|
114
|
+
/**
|
|
115
|
+
* Derives a run summary from the captured event list — the single canonical path from
|
|
116
|
+
* events to summary, so the `run_finished` summary always agrees with the stream.
|
|
117
|
+
* Call before emitting `run_finished` (which is not itself counted).
|
|
118
|
+
*
|
|
119
|
+
* @param events - the events captured so far this run
|
|
120
|
+
* @param duration - wall-clock duration in milliseconds
|
|
121
|
+
*/
|
|
122
|
+
export declare const summarize_events: (events: Array<PublishingEvent>, duration: number) => PublishingRunSummary;
|
|
123
|
+
//# sourceMappingURL=publishing_event.d.ts.map
|
|
@@ -0,0 +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"}
|