@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.
- package/README.md +91 -17
- package/dist/ModulesDetail.svelte +22 -27
- package/dist/ModulesDetail.svelte.d.ts.map +1 -1
- package/dist/ModulesNav.svelte +8 -5
- package/dist/ModulesNav.svelte.d.ts.map +1 -1
- package/dist/ModulesPage.svelte +3 -5
- package/dist/ModulesPage.svelte.d.ts.map +1 -1
- package/dist/PageFooter.svelte +2 -2
- package/dist/PageHeader.svelte +6 -6
- package/dist/PageHeader.svelte.d.ts +0 -3
- package/dist/PageHeader.svelte.d.ts.map +1 -1
- package/dist/PullRequestsDetail.svelte +29 -20
- package/dist/PullRequestsDetail.svelte.d.ts.map +1 -1
- package/dist/PullRequestsPage.svelte +4 -6
- package/dist/PullRequestsPage.svelte.d.ts.map +1 -1
- package/dist/ReposTable.svelte +43 -55
- package/dist/ReposTable.svelte.d.ts.map +1 -1
- package/dist/ReposTree.svelte +9 -21
- package/dist/ReposTree.svelte.d.ts.map +1 -1
- package/dist/ReposTreeNav.svelte +9 -12
- package/dist/ReposTreeNav.svelte.d.ts.map +1 -1
- package/dist/TablePage.svelte +3 -5
- package/dist/TablePage.svelte.d.ts.map +1 -1
- package/dist/TreeItemPage.svelte +3 -5
- package/dist/TreeItemPage.svelte.d.ts.map +1 -1
- package/dist/TreePage.svelte +3 -5
- package/dist/TreePage.svelte.d.ts.map +1 -1
- package/dist/changeset_generator.d.ts.map +1 -1
- package/dist/changeset_generator.js +2 -2
- package/dist/changeset_reader.d.ts.map +1 -1
- package/dist/changeset_reader.js +3 -3
- package/dist/ci_reconcile.d.ts +6 -10
- package/dist/ci_reconcile.d.ts.map +1 -1
- package/dist/ci_reconcile.js +6 -8
- package/dist/dependency_graph.d.ts +26 -49
- package/dist/dependency_graph.d.ts.map +1 -1
- package/dist/dependency_graph.js +40 -83
- package/dist/dependency_updater.d.ts +1 -1
- package/dist/dependency_updater.d.ts.map +1 -1
- package/dist/dependency_updater.js +14 -9
- package/dist/fetch_repo_data.d.ts +34 -8
- package/dist/fetch_repo_data.d.ts.map +1 -1
- package/dist/fetch_repo_data.js +44 -22
- package/dist/fs_fetch_value_cache.d.ts +1 -1
- package/dist/fs_fetch_value_cache.d.ts.map +1 -1
- package/dist/fs_fetch_value_cache.js +3 -3
- package/dist/git_operations.d.ts +6 -49
- package/dist/git_operations.d.ts.map +1 -1
- package/dist/git_operations.js +13 -126
- package/dist/github.d.ts +17 -2
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +17 -8
- package/dist/github_helpers.d.ts.map +1 -1
- package/dist/github_helpers.js +3 -11
- package/dist/gitops_analyze.task.d.ts +24 -2
- package/dist/gitops_analyze.task.d.ts.map +1 -1
- package/dist/gitops_analyze.task.js +47 -34
- package/dist/gitops_config.d.ts +34 -79
- package/dist/gitops_config.d.ts.map +1 -1
- package/dist/gitops_config.js +76 -53
- package/dist/gitops_constants.d.ts +6 -4
- package/dist/gitops_constants.d.ts.map +1 -1
- package/dist/gitops_constants.js +6 -4
- package/dist/gitops_plan.task.d.ts +29 -3
- package/dist/gitops_plan.task.d.ts.map +1 -1
- package/dist/gitops_plan.task.js +83 -61
- package/dist/gitops_publish.task.d.ts +62 -2
- package/dist/gitops_publish.task.d.ts.map +1 -1
- package/dist/gitops_publish.task.js +193 -105
- package/dist/gitops_run.task.d.ts +74 -0
- package/dist/gitops_run.task.d.ts.map +1 -1
- package/dist/gitops_run.task.js +176 -162
- package/dist/gitops_sync.task.d.ts +65 -3
- package/dist/gitops_sync.task.d.ts.map +1 -1
- package/dist/gitops_sync.task.js +163 -37
- package/dist/gitops_task_helpers.d.ts +86 -59
- package/dist/gitops_task_helpers.d.ts.map +1 -1
- package/dist/gitops_task_helpers.js +120 -79
- package/dist/gitops_validate.task.d.ts +1 -2
- package/dist/gitops_validate.task.d.ts.map +1 -1
- package/dist/gitops_validate.task.js +25 -32
- package/dist/graph_validation.d.ts +16 -27
- package/dist/graph_validation.d.ts.map +1 -1
- package/dist/graph_validation.js +24 -65
- package/dist/local_repo.d.ts +50 -62
- package/dist/local_repo.d.ts.map +1 -1
- package/dist/local_repo.js +83 -196
- package/dist/log_helpers.d.ts +8 -8
- package/dist/log_helpers.d.ts.map +1 -1
- package/dist/multi_repo_publisher.d.ts +10 -0
- package/dist/multi_repo_publisher.d.ts.map +1 -1
- package/dist/multi_repo_publisher.js +125 -61
- package/dist/npm_registry.d.ts +23 -19
- package/dist/npm_registry.d.ts.map +1 -1
- package/dist/npm_registry.js +21 -48
- package/dist/operations.d.ts +75 -180
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +15 -7
- package/dist/operations_defaults.d.ts +17 -2
- package/dist/operations_defaults.d.ts.map +1 -1
- package/dist/operations_defaults.js +111 -128
- package/dist/output_helpers.d.ts +36 -0
- package/dist/output_helpers.d.ts.map +1 -1
- package/dist/output_helpers.js +37 -3
- package/dist/preflight_checks.d.ts +20 -27
- package/dist/preflight_checks.d.ts.map +1 -1
- package/dist/preflight_checks.js +37 -126
- package/dist/publish_gate.d.ts.map +1 -1
- package/dist/publish_steps.d.ts +2 -4
- package/dist/publish_steps.d.ts.map +1 -1
- package/dist/publish_steps.js +4 -8
- package/dist/publishing_event.d.ts +2 -8
- package/dist/publishing_event.d.ts.map +1 -1
- package/dist/publishing_event.js +20 -17
- package/dist/publishing_event_handler.d.ts +10 -8
- package/dist/publishing_event_handler.d.ts.map +1 -1
- package/dist/publishing_event_handler.js +19 -17
- package/dist/publishing_plan.d.ts +16 -1
- package/dist/publishing_plan.d.ts.map +1 -1
- package/dist/publishing_plan.js +332 -254
- package/dist/publishing_plan_helpers.d.ts.map +1 -1
- package/dist/publishing_plan_helpers.js +3 -3
- package/dist/publishing_plan_logging.d.ts +1 -1
- package/dist/publishing_plan_logging.d.ts.map +1 -1
- package/dist/publishing_plan_logging.js +22 -15
- package/dist/repo.svelte.d.ts +7 -0
- package/dist/repo.svelte.d.ts.map +1 -1
- package/dist/repo.svelte.js +3 -0
- package/dist/repo_readiness.d.ts +210 -0
- package/dist/repo_readiness.d.ts.map +1 -0
- package/dist/repo_readiness.js +516 -0
- package/dist/repos_status.d.ts +3340 -0
- package/dist/repos_status.d.ts.map +1 -0
- package/dist/repos_status.js +555 -0
- package/dist/repos_status_load.d.ts +65 -0
- package/dist/repos_status_load.d.ts.map +1 -0
- package/dist/repos_status_load.js +131 -0
- package/dist/version_utils.js +1 -1
- package/package.json +15 -34
- package/src/lib/cargo_toml.ts +3 -3
- package/src/lib/changeset_generator.ts +19 -19
- package/src/lib/changeset_reader.ts +18 -18
- package/src/lib/ci_reconcile.ts +12 -16
- package/src/lib/dependency_graph.ts +61 -113
- package/src/lib/dependency_updater.ts +36 -30
- package/src/lib/fetch_repo_data.ts +71 -34
- package/src/lib/fs_fetch_value_cache.ts +15 -11
- package/src/lib/git_operations.ts +22 -194
- package/src/lib/github.ts +33 -21
- package/src/lib/github_helpers.ts +9 -16
- package/src/lib/gitops_analyze.task.ts +104 -66
- package/src/lib/gitops_config.ts +90 -139
- package/src/lib/gitops_constants.ts +6 -4
- package/src/lib/gitops_plan.task.ts +128 -76
- package/src/lib/gitops_publish.task.ts +280 -144
- package/src/lib/gitops_run.task.ts +265 -193
- package/src/lib/gitops_sync.task.ts +236 -52
- package/src/lib/gitops_task_helpers.ts +170 -114
- package/src/lib/gitops_validate.task.ts +44 -54
- package/src/lib/graph_validation.ts +28 -89
- package/src/lib/local_repo.ts +128 -335
- package/src/lib/log_helpers.ts +18 -28
- package/src/lib/multi_repo_publisher.ts +192 -110
- package/src/lib/npm_registry.ts +42 -67
- package/src/lib/operations.ts +99 -160
- package/src/lib/operations_defaults.ts +157 -201
- package/src/lib/output_helpers.ts +58 -6
- package/src/lib/preflight_checks.ts +52 -188
- package/src/lib/publish_gate.ts +7 -9
- package/src/lib/publish_steps.ts +27 -25
- package/src/lib/publishing_event.ts +26 -23
- package/src/lib/publishing_event_handler.ts +24 -22
- package/src/lib/publishing_plan.ts +474 -310
- package/src/lib/publishing_plan_helpers.ts +16 -12
- package/src/lib/publishing_plan_logging.ts +53 -44
- package/src/lib/repo.svelte.ts +16 -8
- package/src/lib/repo_readiness.ts +647 -0
- package/src/lib/repos_status.ts +671 -0
- package/src/lib/repos_status_load.ts +173 -0
- package/src/lib/version_utils.ts +3 -3
- package/dist/config_reconcile.d.ts +0 -46
- package/dist/config_reconcile.d.ts.map +0 -1
- package/dist/config_reconcile.js +0 -60
- package/dist/paths.d.ts +0 -7
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -6
- package/dist/repo_ops.d.ts +0 -59
- package/dist/repo_ops.d.ts.map +0 -1
- package/dist/repo_ops.js +0 -170
- package/dist/resolved_gitops_config.d.ts +0 -9
- package/dist/resolved_gitops_config.d.ts.map +0 -1
- package/dist/resolved_gitops_config.js +0 -12
- package/src/lib/config_reconcile.ts +0 -94
- package/src/lib/paths.ts +0 -6
- package/src/lib/repo_ops.ts +0 -216
- package/src/lib/resolved_gitops_config.ts +0 -27
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads fleet git state from the Rust `repos` binary: runs
|
|
3
|
+
* `repos status <keys…> --json` through the injected `ReposOperations` and
|
|
4
|
+
* parses what it printed with the `repos_status.ts` mirror.
|
|
5
|
+
*
|
|
6
|
+
* Parsing is pure (`parse_repos_status_output`): the format version is read
|
|
7
|
+
* first, so a binary and npm package out of step fail with both versions and
|
|
8
|
+
* the install command rather than a schema error; then the document is parsed
|
|
9
|
+
* strictly as a report or, when it carries `error`, as an error document,
|
|
10
|
+
* whose kind maps to a message saying what to change.
|
|
11
|
+
*
|
|
12
|
+
* @module
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { REPOS_STATUS_FORMAT_VERSION, ReposStatusErrorReport, ReposStatusReport } from './repos_status.js';
|
|
16
|
+
/**
|
|
17
|
+
* How to install the `repos` binary, run in a `fuz_repos` checkout. The npm
|
|
18
|
+
* package doesn't carry the binary, so the two are installed separately.
|
|
19
|
+
*/
|
|
20
|
+
export const REPOS_INSTALL_COMMAND = 'cargo install --path crates/fuz_repos --locked';
|
|
21
|
+
/**
|
|
22
|
+
* The `repos` invocation a suggested fix names: `repos`, or `repos --registry
|
|
23
|
+
* <path>` when the run passed one, the path POSIX-shell-quoted when it needs it.
|
|
24
|
+
*
|
|
25
|
+
* @param registry - the run's `--registry`, if any
|
|
26
|
+
* @returns the command prefix, ready for a subcommand
|
|
27
|
+
*/
|
|
28
|
+
export const to_repos_command = (registry) => registry === undefined ? 'repos' : `repos --registry ${shell_quote(registry)}`;
|
|
29
|
+
const shell_quote = (arg) => /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;
|
|
30
|
+
/**
|
|
31
|
+
* Parses what `repos status --json` printed into its report, or a message
|
|
32
|
+
* saying what went wrong and what to change.
|
|
33
|
+
*
|
|
34
|
+
* @param output - the command's stdout, stderr, and exit code
|
|
35
|
+
* @returns the report, or a message naming the error document's kind and hint, a format version mismatch, or output that isn't a status document; an error document rides along as `error`
|
|
36
|
+
*/
|
|
37
|
+
export const parse_repos_status_output = (output) => {
|
|
38
|
+
const { stdout, stderr, exit_code } = output;
|
|
39
|
+
let json;
|
|
40
|
+
try {
|
|
41
|
+
json = JSON.parse(stdout);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// exit 1 is a fatal I/O error, which may print no JSON
|
|
45
|
+
const detail = stderr.trim() || stdout.trim() || 'no output';
|
|
46
|
+
return {
|
|
47
|
+
ok: false,
|
|
48
|
+
message: `\`repos status --json\` exited ${exit_code} without a JSON document: ${detail}`
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (typeof json !== 'object' || json === null || Array.isArray(json)) {
|
|
52
|
+
return { ok: false, message: '`repos status --json` printed JSON that is not a document' };
|
|
53
|
+
}
|
|
54
|
+
const version = 'version' in json ? json.version : undefined;
|
|
55
|
+
if (version !== REPOS_STATUS_FORMAT_VERSION) {
|
|
56
|
+
const fix = typeof version === 'number' && version > REPOS_STATUS_FORMAT_VERSION
|
|
57
|
+
? "upgrade @fuzdev/fuz_gitops to match the binary, or install the binary from a fuz_repos checkout at this package's version"
|
|
58
|
+
: "install the binary from a fuz_repos checkout at this package's version";
|
|
59
|
+
return {
|
|
60
|
+
ok: false,
|
|
61
|
+
message: `the \`repos\` binary prints status format ${JSON.stringify(version ?? null)}, ` +
|
|
62
|
+
`but this @fuzdev/fuz_gitops parses format ${REPOS_STATUS_FORMAT_VERSION}: ` +
|
|
63
|
+
`${fix} (\`${REPOS_INSTALL_COMMAND}\`) — the npm package and the binary are installed separately`
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if ('error' in json) {
|
|
67
|
+
const parsed = ReposStatusErrorReport.safeParse(json);
|
|
68
|
+
if (!parsed.success) {
|
|
69
|
+
return {
|
|
70
|
+
ok: false,
|
|
71
|
+
message: `\`repos status --json\` printed an error document this package can't parse:\n${z.prettifyError(parsed.error)}`
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
ok: false,
|
|
76
|
+
message: format_repos_status_error(parsed.data.error),
|
|
77
|
+
error: parsed.data.error
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const parsed = ReposStatusReport.safeParse(json);
|
|
81
|
+
if (!parsed.success) {
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
message: `\`repos status --json\` printed a report this package can't parse:\n${z.prettifyError(parsed.error)}`
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
return { ok: true, report: parsed.data };
|
|
88
|
+
};
|
|
89
|
+
const format_repos_status_error = (error) => {
|
|
90
|
+
switch (error.kind) {
|
|
91
|
+
case 'unknown_entry': {
|
|
92
|
+
const suggestions = error.suggestions.length
|
|
93
|
+
? ` — did you mean ${error.suggestions.map((s) => `\`${s}\``).join(', ')}?`
|
|
94
|
+
: '';
|
|
95
|
+
return `the gitops config lists \`${error.name}\`, which the registry (repos.toml) doesn't name${suggestions}`;
|
|
96
|
+
}
|
|
97
|
+
case 'registry_not_found':
|
|
98
|
+
return (`${error.message}: the gitops tasks read repo state from a repos.toml registry — ` +
|
|
99
|
+
`run inside its workspace, or pass \`--registry <path>\``);
|
|
100
|
+
default: {
|
|
101
|
+
const hint = error.hint ? `\n hint: ${error.hint}` : '';
|
|
102
|
+
return `\`repos status\` failed (${error.kind}): ${error.message}${hint}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Runs `repos status <keys…> --json` and parses its report.
|
|
108
|
+
*
|
|
109
|
+
* @param options.keys - the registry keys to report on; must not be empty, since no targets means every entry
|
|
110
|
+
* @param options.registry - a `repos.toml` to use instead of the one found walking up from the cwd
|
|
111
|
+
* @param options.fetch - fetch each entry from origin first (`--fetch`), which writes remote-tracking refs and nothing else
|
|
112
|
+
* @param options.repos_ops - the `repos` runner
|
|
113
|
+
* @returns the report, or a message saying what went wrong and what to change
|
|
114
|
+
*/
|
|
115
|
+
export const load_repos_status = async (options) => {
|
|
116
|
+
const { keys, registry, fetch, repos_ops } = options;
|
|
117
|
+
if (keys.length === 0) {
|
|
118
|
+
// `repos status` with no targets reports every entry
|
|
119
|
+
return { ok: false, message: 'no registry keys to report on' };
|
|
120
|
+
}
|
|
121
|
+
const ran = await repos_ops.status(fetch ? { keys, registry, fetch } : { keys, registry });
|
|
122
|
+
if (!ran.ok) {
|
|
123
|
+
return {
|
|
124
|
+
ok: false,
|
|
125
|
+
message: ran.kind === 'not_found'
|
|
126
|
+
? `the \`repos\` binary was not found on PATH: install it from a fuz_repos checkout with \`${REPOS_INSTALL_COMMAND}\` — the npm package doesn't carry it`
|
|
127
|
+
: `\`repos status\` didn't run: ${ran.message}`
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
return parse_repos_status_output(ran.output);
|
|
131
|
+
};
|
package/dist/version_utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fuzdev/fuz_gitops",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.79.0",
|
|
4
4
|
"description": "a tool for managing many repos",
|
|
5
5
|
"glyph": "🪄",
|
|
6
6
|
"logo": "logo.svg",
|
|
7
7
|
"logo_alt": "a friendly blue spider facing you",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"homepage": "https://gitops.fuz.dev/",
|
|
10
|
-
"repository": "https://github.com/fuzdev/
|
|
10
|
+
"repository": "https://github.com/fuzdev/fuz_repos",
|
|
11
11
|
"author": {
|
|
12
12
|
"name": "Ryan Atkinson",
|
|
13
13
|
"email": "mail@ryanatkn.com",
|
|
14
14
|
"url": "https://www.ryanatkn.com/"
|
|
15
15
|
},
|
|
16
|
-
"bugs": "https://github.com/fuzdev/
|
|
16
|
+
"bugs": "https://github.com/fuzdev/fuz_repos/issues",
|
|
17
17
|
"funding": "https://www.ryanatkn.com/funding",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"start": "gro dev",
|
|
@@ -39,19 +39,19 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@changesets/changelog-git": "^0.2.1",
|
|
42
|
-
"@fuzdev/
|
|
43
|
-
"@fuzdev/fuz_code": "^0.
|
|
44
|
-
"@fuzdev/fuz_css": "^0.
|
|
45
|
-
"@fuzdev/fuz_ui": "^0.
|
|
46
|
-
"@fuzdev/fuz_util": "^0.
|
|
47
|
-
"@fuzdev/gro": "^0.
|
|
48
|
-
"@fuzdev/mdz": "^0.
|
|
49
|
-
"@ryanatkn/eslint-config": "^0.12.
|
|
42
|
+
"@fuzdev/blake3-wasm": "^0.2.0",
|
|
43
|
+
"@fuzdev/fuz_code": "^0.48.0",
|
|
44
|
+
"@fuzdev/fuz_css": "^0.64.0",
|
|
45
|
+
"@fuzdev/fuz_ui": "^0.208.0",
|
|
46
|
+
"@fuzdev/fuz_util": "^0.69.0",
|
|
47
|
+
"@fuzdev/gro": "^0.212.0",
|
|
48
|
+
"@fuzdev/mdz": "^0.3.0",
|
|
49
|
+
"@ryanatkn/eslint-config": "^0.12.2",
|
|
50
50
|
"@sveltejs/acorn-typescript": "^1.0.9",
|
|
51
51
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
52
52
|
"@sveltejs/kit": "^2.63.0",
|
|
53
53
|
"@sveltejs/package": "^2.5.7",
|
|
54
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
54
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
55
55
|
"@types/estree": "^1.0.8",
|
|
56
56
|
"@types/node": "^24.10.1",
|
|
57
57
|
"@webref/css": "^8.2.0",
|
|
@@ -59,37 +59,18 @@
|
|
|
59
59
|
"eslint-plugin-svelte": "^3.13.1",
|
|
60
60
|
"esm-env": "^1.2.2",
|
|
61
61
|
"magic-string": "^0.30.21",
|
|
62
|
-
"prettier": "^3.7.4",
|
|
63
|
-
"prettier-plugin-svelte": "^3.5.1",
|
|
64
62
|
"svelte": "^5.56.2",
|
|
65
63
|
"svelte-check": "^4.6.0",
|
|
66
|
-
"svelte-docinfo": "^0.
|
|
64
|
+
"svelte-docinfo": "^0.7.0",
|
|
67
65
|
"svelte2tsx": "^0.7.52",
|
|
68
66
|
"tslib": "^2.8.1",
|
|
69
67
|
"typescript": "^5.9.3",
|
|
70
68
|
"typescript-eslint": "^8.48.1",
|
|
71
|
-
"vite": "^
|
|
72
|
-
"vitest": "^
|
|
69
|
+
"vite": "^7.3.6",
|
|
70
|
+
"vitest": "^5.0.0",
|
|
73
71
|
"zimmerframe": "^1.1.4",
|
|
74
72
|
"zod": "^4.3.6"
|
|
75
73
|
},
|
|
76
|
-
"prettier": {
|
|
77
|
-
"plugins": [
|
|
78
|
-
"prettier-plugin-svelte"
|
|
79
|
-
],
|
|
80
|
-
"useTabs": true,
|
|
81
|
-
"printWidth": 100,
|
|
82
|
-
"singleQuote": true,
|
|
83
|
-
"bracketSpacing": false,
|
|
84
|
-
"overrides": [
|
|
85
|
-
{
|
|
86
|
-
"files": "package.json",
|
|
87
|
-
"options": {
|
|
88
|
-
"useTabs": false
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
74
|
"sideEffects": [
|
|
94
75
|
"**/*.css"
|
|
95
76
|
],
|
package/src/lib/cargo_toml.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {existsSync} from 'node:fs';
|
|
2
|
-
import {readFile} from 'node:fs/promises';
|
|
3
|
-
import {join} from 'node:path';
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The handful of identity fields gitops reads from a Rust repo's `Cargo.toml`
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {join} from 'node:path';
|
|
11
|
-
import type {Logger} from '@fuzdev/fuz_util/log.ts';
|
|
12
|
-
import type {LocalRepo} from './local_repo.ts';
|
|
13
|
-
import type {PublishedVersion} from './multi_repo_publisher.ts';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
12
|
+
import type { LocalRepo } from './local_repo.ts';
|
|
13
|
+
import type { PublishedVersion } from './multi_repo_publisher.ts';
|
|
14
14
|
import {
|
|
15
15
|
strip_version_prefix,
|
|
16
16
|
required_bump_for_dependency_update,
|
|
17
|
-
type BumpType
|
|
17
|
+
type BumpType
|
|
18
18
|
} from './version_utils.ts';
|
|
19
|
-
import type {FsOperations} from './operations.ts';
|
|
20
|
-
import {default_fs_operations} from './operations_defaults.ts';
|
|
19
|
+
import type { FsOperations } from './operations.ts';
|
|
20
|
+
import { default_fs_operations } from './operations_defaults.ts';
|
|
21
21
|
|
|
22
22
|
export interface DependencyVersionChange {
|
|
23
23
|
package_name: string;
|
|
@@ -34,14 +34,14 @@ export interface DependencyVersionChange {
|
|
|
34
34
|
export const create_changeset_for_dependency_updates = async (
|
|
35
35
|
repo: LocalRepo,
|
|
36
36
|
updates: Array<DependencyVersionChange>,
|
|
37
|
-
options: {log?: Logger; fs_ops?: FsOperations} = {}
|
|
37
|
+
options: { log?: Logger; fs_ops?: FsOperations } = {}
|
|
38
38
|
): Promise<string> => {
|
|
39
|
-
const {log, fs_ops = default_fs_operations} = options;
|
|
39
|
+
const { log, fs_ops = default_fs_operations } = options;
|
|
40
40
|
const changesets_dir = join(repo.repo_dir, '.changeset');
|
|
41
41
|
|
|
42
42
|
// Ensure .changeset directory exists
|
|
43
|
-
if (!(await fs_ops.exists({path: changesets_dir}))) {
|
|
44
|
-
const mkdir_result = await fs_ops.mkdir({path: changesets_dir, recursive: true});
|
|
43
|
+
if (!(await fs_ops.exists({ path: changesets_dir }))) {
|
|
44
|
+
const mkdir_result = await fs_ops.mkdir({ path: changesets_dir, recursive: true });
|
|
45
45
|
if (!mkdir_result.ok) {
|
|
46
46
|
throw new Error(`Failed to create .changeset directory: ${mkdir_result.message}`);
|
|
47
47
|
}
|
|
@@ -60,7 +60,7 @@ export const create_changeset_for_dependency_updates = async (
|
|
|
60
60
|
const content = generate_changeset_content(repo.library.name, updates, required_bump);
|
|
61
61
|
|
|
62
62
|
// Write the changeset file
|
|
63
|
-
const write_result = await fs_ops.writeFile({path: filepath, content});
|
|
63
|
+
const write_result = await fs_ops.writeFile({ path: filepath, content });
|
|
64
64
|
if (!write_result.ok) {
|
|
65
65
|
throw new Error(`Failed to write changeset file: ${write_result.message}`);
|
|
66
66
|
}
|
|
@@ -72,11 +72,11 @@ export const create_changeset_for_dependency_updates = async (
|
|
|
72
72
|
|
|
73
73
|
const calculate_required_bump = (
|
|
74
74
|
repo: LocalRepo,
|
|
75
|
-
updates: Array<DependencyVersionChange
|
|
75
|
+
updates: Array<DependencyVersionChange>
|
|
76
76
|
): BumpType =>
|
|
77
77
|
required_bump_for_dependency_update(
|
|
78
78
|
repo.package_json.version || '0.0.0',
|
|
79
|
-
updates.some((u) => u.breaking)
|
|
79
|
+
updates.some((u) => u.breaking)
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
/**
|
|
@@ -94,7 +94,7 @@ const calculate_required_bump = (
|
|
|
94
94
|
export const generate_changeset_content = (
|
|
95
95
|
package_name: string,
|
|
96
96
|
updates: Array<DependencyVersionChange>,
|
|
97
|
-
bump_type: 'major' | 'minor' | 'patch'
|
|
97
|
+
bump_type: 'major' | 'minor' | 'patch'
|
|
98
98
|
): string => {
|
|
99
99
|
// Group updates by type
|
|
100
100
|
const breaking_updates = updates.filter((u) => u.breaking);
|
|
@@ -112,7 +112,7 @@ export const generate_changeset_content = (
|
|
|
112
112
|
lines.push('Breaking dependency changes:');
|
|
113
113
|
for (const update of breaking_updates) {
|
|
114
114
|
lines.push(
|
|
115
|
-
`- ${update.package_name}: ${update.from_version} → ${update.to_version} (${update.bump_type})
|
|
115
|
+
`- ${update.package_name}: ${update.from_version} → ${update.to_version} (${update.bump_type})`
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
lines.push('');
|
|
@@ -126,7 +126,7 @@ export const generate_changeset_content = (
|
|
|
126
126
|
}
|
|
127
127
|
for (const update of regular_updates) {
|
|
128
128
|
lines.push(
|
|
129
|
-
`- ${update.package_name}: ${update.from_version} → ${update.to_version} (${update.bump_type})
|
|
129
|
+
`- ${update.package_name}: ${update.from_version} → ${update.to_version} (${update.bump_type})`
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
lines.push('');
|
|
@@ -137,7 +137,7 @@ export const generate_changeset_content = (
|
|
|
137
137
|
|
|
138
138
|
export const create_dependency_updates = (
|
|
139
139
|
dependencies: Map<string, string>,
|
|
140
|
-
published_versions: Map<string, PublishedVersion
|
|
140
|
+
published_versions: Map<string, PublishedVersion>
|
|
141
141
|
): Array<DependencyVersionChange> => {
|
|
142
142
|
const updates: Array<DependencyVersionChange> = [];
|
|
143
143
|
|
|
@@ -152,7 +152,7 @@ export const create_dependency_updates = (
|
|
|
152
152
|
from_version: clean_current,
|
|
153
153
|
to_version: published.new_version,
|
|
154
154
|
bump_type: published.bump_type,
|
|
155
|
-
breaking: published.breaking
|
|
155
|
+
breaking: published.breaking
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type {Logger} from '@fuzdev/fuz_util/log.ts';
|
|
11
|
-
import {existsSync} from 'node:fs';
|
|
12
|
-
import {readdir, readFile} from 'node:fs/promises';
|
|
13
|
-
import {join} from 'node:path';
|
|
10
|
+
import type { Logger } from '@fuzdev/fuz_util/log.ts';
|
|
11
|
+
import { existsSync } from 'node:fs';
|
|
12
|
+
import { readdir, readFile } from 'node:fs/promises';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
14
|
|
|
15
|
-
import type {LocalRepo} from './local_repo.ts';
|
|
16
|
-
import {compare_bump_types, calculate_next_version, type BumpType} from './version_utils.ts';
|
|
15
|
+
import type { LocalRepo } from './local_repo.ts';
|
|
16
|
+
import { compare_bump_types, calculate_next_version, type BumpType } from './version_utils.ts';
|
|
17
17
|
|
|
18
18
|
export interface ChangesetInfo {
|
|
19
19
|
filename: string;
|
|
20
|
-
packages: Array<{name: string; bump_type: BumpType}>;
|
|
20
|
+
packages: Array<{ name: string; bump_type: BumpType }>;
|
|
21
21
|
summary: string;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -44,7 +44,7 @@ export interface ChangesetInfo {
|
|
|
44
44
|
*/
|
|
45
45
|
export const parse_changeset_content = (
|
|
46
46
|
content: string,
|
|
47
|
-
filename = 'changeset.md'
|
|
47
|
+
filename = 'changeset.md'
|
|
48
48
|
): ChangesetInfo | null => {
|
|
49
49
|
// Match frontmatter between --- markers
|
|
50
50
|
const frontmatter_match = /^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)/.exec(content);
|
|
@@ -56,7 +56,7 @@ export const parse_changeset_content = (
|
|
|
56
56
|
const summary = frontmatter_match[2]!.trim();
|
|
57
57
|
|
|
58
58
|
// Parse package entries
|
|
59
|
-
const packages: Array<{name: string; bump_type: BumpType}> = [];
|
|
59
|
+
const packages: Array<{ name: string; bump_type: BumpType }> = [];
|
|
60
60
|
|
|
61
61
|
// Match lines like: "package-name": patch
|
|
62
62
|
// or: '@scope/package': minor
|
|
@@ -67,7 +67,7 @@ export const parse_changeset_content = (
|
|
|
67
67
|
while ((match = package_regex.exec(frontmatter)) !== null) {
|
|
68
68
|
packages.push({
|
|
69
69
|
name: match[1]!,
|
|
70
|
-
bump_type: match[2]! as BumpType
|
|
70
|
+
bump_type: match[2]! as BumpType
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -78,13 +78,13 @@ export const parse_changeset_content = (
|
|
|
78
78
|
return {
|
|
79
79
|
filename,
|
|
80
80
|
packages,
|
|
81
|
-
summary
|
|
81
|
+
summary
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
export const parse_changeset_file = async (
|
|
86
86
|
filepath: string,
|
|
87
|
-
log?: Logger
|
|
87
|
+
log?: Logger
|
|
88
88
|
): Promise<ChangesetInfo | null> => {
|
|
89
89
|
try {
|
|
90
90
|
const content = await readFile(filepath, 'utf8');
|
|
@@ -105,7 +105,7 @@ export const parse_changeset_file = async (
|
|
|
105
105
|
|
|
106
106
|
export const read_changesets = async (
|
|
107
107
|
repo: LocalRepo,
|
|
108
|
-
log?: Logger
|
|
108
|
+
log?: Logger
|
|
109
109
|
): Promise<Array<ChangesetInfo>> => {
|
|
110
110
|
const changesets_dir = join(repo.repo_dir, '.changeset');
|
|
111
111
|
|
|
@@ -141,7 +141,7 @@ export const read_changesets = async (
|
|
|
141
141
|
*/
|
|
142
142
|
export const determine_bump_from_changesets = (
|
|
143
143
|
changesets: Array<ChangesetInfo>,
|
|
144
|
-
package_name: string
|
|
144
|
+
package_name: string
|
|
145
145
|
): BumpType | null => {
|
|
146
146
|
let highest_bump: BumpType | null = null;
|
|
147
147
|
|
|
@@ -195,8 +195,8 @@ export const has_changesets = async (repo: LocalRepo): Promise<boolean> => {
|
|
|
195
195
|
*/
|
|
196
196
|
export const predict_next_version = async (
|
|
197
197
|
repo: LocalRepo,
|
|
198
|
-
log?: Logger
|
|
199
|
-
): Promise<{version: string; bump_type: BumpType} | null> => {
|
|
198
|
+
log?: Logger
|
|
199
|
+
): Promise<{ version: string; bump_type: BumpType } | null> => {
|
|
200
200
|
const changesets = await read_changesets(repo, log);
|
|
201
201
|
if (changesets.length === 0) {
|
|
202
202
|
return null;
|
|
@@ -211,11 +211,11 @@ export const predict_next_version = async (
|
|
|
211
211
|
const next_version = calculate_next_version(current_version, bump_type);
|
|
212
212
|
|
|
213
213
|
log?.debug(
|
|
214
|
-
` Predicted ${repo.library.name}: ${current_version} → ${next_version} (${bump_type})
|
|
214
|
+
` Predicted ${repo.library.name}: ${current_version} → ${next_version} (${bump_type})`
|
|
215
215
|
);
|
|
216
216
|
|
|
217
217
|
return {
|
|
218
218
|
version: next_version,
|
|
219
|
-
bump_type
|
|
219
|
+
bump_type
|
|
220
220
|
};
|
|
221
221
|
};
|
package/src/lib/ci_reconcile.ts
CHANGED
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
* Reconciles each repo's declared `ci` flag against whether it actually has
|
|
3
3
|
* GitHub Actions workflow files on disk.
|
|
4
4
|
*
|
|
5
|
-
* The
|
|
6
|
-
* private) with per-repo overrides; this check catches drift between
|
|
7
|
-
* declaration and reality —
|
|
5
|
+
* The registry (`repos.toml`) derives `ci` from visibility (on for public repos,
|
|
6
|
+
* off for private) with per-repo overrides; this check catches drift between
|
|
7
|
+
* that declaration and reality —
|
|
8
8
|
* a repo that claims CI but ships no workflow, or one that disclaims CI yet
|
|
9
|
-
* still carries one.
|
|
10
|
-
*
|
|
11
|
-
* frozen on their host, so their CI state is intentionally left alone and they're
|
|
12
|
-
* skipped too.
|
|
9
|
+
* still carries one. Archived repos are frozen on their host, so their CI state
|
|
10
|
+
* is intentionally left alone and they're skipped.
|
|
13
11
|
*
|
|
14
12
|
* @module
|
|
15
13
|
*/
|
|
16
14
|
|
|
17
|
-
import {existsSync, readdirSync} from 'node:fs';
|
|
18
|
-
import {join} from 'node:path';
|
|
15
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
19
17
|
|
|
20
18
|
/** How a repo's declared `ci` diverges from its workflow files on disk. */
|
|
21
19
|
export type CiDriftKind =
|
|
@@ -34,12 +32,10 @@ export interface CiDrift {
|
|
|
34
32
|
|
|
35
33
|
export interface CiReconcileInput {
|
|
36
34
|
repo_url: string;
|
|
37
|
-
/** The declared/derived `ci` value from the
|
|
35
|
+
/** The declared/derived `ci` value from the registry. */
|
|
38
36
|
ci: boolean;
|
|
39
37
|
/** Whether the repo has at least one workflow file on disk. */
|
|
40
38
|
has_workflows: boolean;
|
|
41
|
-
/** Whether the repo is checked out locally; uncheckable repos are skipped. */
|
|
42
|
-
checkable: boolean;
|
|
43
39
|
/** Whether the repo is archived (frozen) on its host; archived repos are skipped. */
|
|
44
40
|
archived: boolean;
|
|
45
41
|
}
|
|
@@ -51,12 +47,12 @@ export interface CiReconcileInput {
|
|
|
51
47
|
export const reconcile_ci = (repos: Array<CiReconcileInput>): Array<CiDrift> => {
|
|
52
48
|
const drift: Array<CiDrift> = [];
|
|
53
49
|
for (const repo of repos) {
|
|
54
|
-
if (
|
|
55
|
-
const {repo_url, ci, has_workflows} = repo;
|
|
50
|
+
if (repo.archived) continue;
|
|
51
|
+
const { repo_url, ci, has_workflows } = repo;
|
|
56
52
|
if (ci && !has_workflows) {
|
|
57
|
-
drift.push({repo_url, ci, has_workflows, kind: 'missing_ci'});
|
|
53
|
+
drift.push({ repo_url, ci, has_workflows, kind: 'missing_ci' });
|
|
58
54
|
} else if (!ci && has_workflows) {
|
|
59
|
-
drift.push({repo_url, ci, has_workflows, kind: 'stray_ci'});
|
|
55
|
+
drift.push({ repo_url, ci, has_workflows, kind: 'stray_ci' });
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
58
|
return drift;
|