@fuzdev/fuz_gitops 0.78.0 → 0.79.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/README.md +91 -17
  2. package/dist/ModulesDetail.svelte +22 -27
  3. package/dist/ModulesDetail.svelte.d.ts.map +1 -1
  4. package/dist/ModulesNav.svelte +8 -5
  5. package/dist/ModulesNav.svelte.d.ts.map +1 -1
  6. package/dist/ModulesPage.svelte +3 -5
  7. package/dist/ModulesPage.svelte.d.ts.map +1 -1
  8. package/dist/PageFooter.svelte +2 -2
  9. package/dist/PageHeader.svelte +6 -6
  10. package/dist/PageHeader.svelte.d.ts +0 -3
  11. package/dist/PageHeader.svelte.d.ts.map +1 -1
  12. package/dist/PullRequestsDetail.svelte +29 -20
  13. package/dist/PullRequestsDetail.svelte.d.ts.map +1 -1
  14. package/dist/PullRequestsPage.svelte +4 -6
  15. package/dist/PullRequestsPage.svelte.d.ts.map +1 -1
  16. package/dist/ReposTable.svelte +43 -55
  17. package/dist/ReposTable.svelte.d.ts.map +1 -1
  18. package/dist/ReposTree.svelte +9 -21
  19. package/dist/ReposTree.svelte.d.ts.map +1 -1
  20. package/dist/ReposTreeNav.svelte +9 -12
  21. package/dist/ReposTreeNav.svelte.d.ts.map +1 -1
  22. package/dist/TablePage.svelte +3 -5
  23. package/dist/TablePage.svelte.d.ts.map +1 -1
  24. package/dist/TreeItemPage.svelte +3 -5
  25. package/dist/TreeItemPage.svelte.d.ts.map +1 -1
  26. package/dist/TreePage.svelte +3 -5
  27. package/dist/TreePage.svelte.d.ts.map +1 -1
  28. package/dist/changeset_generator.d.ts.map +1 -1
  29. package/dist/changeset_generator.js +2 -2
  30. package/dist/changeset_reader.d.ts.map +1 -1
  31. package/dist/changeset_reader.js +3 -3
  32. package/dist/ci_reconcile.d.ts +6 -10
  33. package/dist/ci_reconcile.d.ts.map +1 -1
  34. package/dist/ci_reconcile.js +6 -8
  35. package/dist/dependency_graph.d.ts +26 -49
  36. package/dist/dependency_graph.d.ts.map +1 -1
  37. package/dist/dependency_graph.js +40 -83
  38. package/dist/dependency_updater.d.ts +1 -1
  39. package/dist/dependency_updater.d.ts.map +1 -1
  40. package/dist/dependency_updater.js +14 -9
  41. package/dist/fetch_repo_data.d.ts +34 -8
  42. package/dist/fetch_repo_data.d.ts.map +1 -1
  43. package/dist/fetch_repo_data.js +44 -22
  44. package/dist/fs_fetch_value_cache.d.ts +1 -1
  45. package/dist/fs_fetch_value_cache.d.ts.map +1 -1
  46. package/dist/fs_fetch_value_cache.js +3 -3
  47. package/dist/git_operations.d.ts +6 -49
  48. package/dist/git_operations.d.ts.map +1 -1
  49. package/dist/git_operations.js +13 -126
  50. package/dist/github.d.ts +17 -2
  51. package/dist/github.d.ts.map +1 -1
  52. package/dist/github.js +17 -8
  53. package/dist/github_helpers.d.ts.map +1 -1
  54. package/dist/github_helpers.js +3 -11
  55. package/dist/gitops_analyze.task.d.ts +24 -2
  56. package/dist/gitops_analyze.task.d.ts.map +1 -1
  57. package/dist/gitops_analyze.task.js +47 -34
  58. package/dist/gitops_config.d.ts +34 -79
  59. package/dist/gitops_config.d.ts.map +1 -1
  60. package/dist/gitops_config.js +76 -53
  61. package/dist/gitops_constants.d.ts +6 -4
  62. package/dist/gitops_constants.d.ts.map +1 -1
  63. package/dist/gitops_constants.js +6 -4
  64. package/dist/gitops_plan.task.d.ts +29 -3
  65. package/dist/gitops_plan.task.d.ts.map +1 -1
  66. package/dist/gitops_plan.task.js +83 -61
  67. package/dist/gitops_publish.task.d.ts +62 -2
  68. package/dist/gitops_publish.task.d.ts.map +1 -1
  69. package/dist/gitops_publish.task.js +193 -105
  70. package/dist/gitops_run.task.d.ts +74 -0
  71. package/dist/gitops_run.task.d.ts.map +1 -1
  72. package/dist/gitops_run.task.js +176 -162
  73. package/dist/gitops_sync.task.d.ts +65 -3
  74. package/dist/gitops_sync.task.d.ts.map +1 -1
  75. package/dist/gitops_sync.task.js +163 -37
  76. package/dist/gitops_task_helpers.d.ts +86 -59
  77. package/dist/gitops_task_helpers.d.ts.map +1 -1
  78. package/dist/gitops_task_helpers.js +120 -79
  79. package/dist/gitops_validate.task.d.ts +1 -2
  80. package/dist/gitops_validate.task.d.ts.map +1 -1
  81. package/dist/gitops_validate.task.js +25 -32
  82. package/dist/graph_validation.d.ts +16 -27
  83. package/dist/graph_validation.d.ts.map +1 -1
  84. package/dist/graph_validation.js +24 -65
  85. package/dist/local_repo.d.ts +50 -62
  86. package/dist/local_repo.d.ts.map +1 -1
  87. package/dist/local_repo.js +83 -196
  88. package/dist/log_helpers.d.ts +8 -8
  89. package/dist/log_helpers.d.ts.map +1 -1
  90. package/dist/multi_repo_publisher.d.ts +10 -0
  91. package/dist/multi_repo_publisher.d.ts.map +1 -1
  92. package/dist/multi_repo_publisher.js +125 -61
  93. package/dist/npm_registry.d.ts +23 -19
  94. package/dist/npm_registry.d.ts.map +1 -1
  95. package/dist/npm_registry.js +21 -48
  96. package/dist/operations.d.ts +75 -180
  97. package/dist/operations.d.ts.map +1 -1
  98. package/dist/operations.js +15 -7
  99. package/dist/operations_defaults.d.ts +17 -2
  100. package/dist/operations_defaults.d.ts.map +1 -1
  101. package/dist/operations_defaults.js +111 -128
  102. package/dist/output_helpers.d.ts +36 -0
  103. package/dist/output_helpers.d.ts.map +1 -1
  104. package/dist/output_helpers.js +37 -3
  105. package/dist/preflight_checks.d.ts +20 -27
  106. package/dist/preflight_checks.d.ts.map +1 -1
  107. package/dist/preflight_checks.js +37 -126
  108. package/dist/publish_gate.d.ts.map +1 -1
  109. package/dist/publish_steps.d.ts +2 -4
  110. package/dist/publish_steps.d.ts.map +1 -1
  111. package/dist/publish_steps.js +4 -8
  112. package/dist/publishing_event.d.ts +2 -8
  113. package/dist/publishing_event.d.ts.map +1 -1
  114. package/dist/publishing_event.js +20 -17
  115. package/dist/publishing_event_handler.d.ts +10 -8
  116. package/dist/publishing_event_handler.d.ts.map +1 -1
  117. package/dist/publishing_event_handler.js +19 -17
  118. package/dist/publishing_plan.d.ts +16 -1
  119. package/dist/publishing_plan.d.ts.map +1 -1
  120. package/dist/publishing_plan.js +332 -254
  121. package/dist/publishing_plan_helpers.d.ts.map +1 -1
  122. package/dist/publishing_plan_helpers.js +3 -3
  123. package/dist/publishing_plan_logging.d.ts +1 -1
  124. package/dist/publishing_plan_logging.d.ts.map +1 -1
  125. package/dist/publishing_plan_logging.js +22 -15
  126. package/dist/repo.svelte.d.ts +7 -0
  127. package/dist/repo.svelte.d.ts.map +1 -1
  128. package/dist/repo.svelte.js +3 -0
  129. package/dist/repo_readiness.d.ts +210 -0
  130. package/dist/repo_readiness.d.ts.map +1 -0
  131. package/dist/repo_readiness.js +516 -0
  132. package/dist/repos_status.d.ts +3340 -0
  133. package/dist/repos_status.d.ts.map +1 -0
  134. package/dist/repos_status.js +555 -0
  135. package/dist/repos_status_load.d.ts +65 -0
  136. package/dist/repos_status_load.d.ts.map +1 -0
  137. package/dist/repos_status_load.js +131 -0
  138. package/dist/version_utils.js +1 -1
  139. package/package.json +15 -34
  140. package/src/lib/cargo_toml.ts +3 -3
  141. package/src/lib/changeset_generator.ts +19 -19
  142. package/src/lib/changeset_reader.ts +18 -18
  143. package/src/lib/ci_reconcile.ts +12 -16
  144. package/src/lib/dependency_graph.ts +61 -113
  145. package/src/lib/dependency_updater.ts +36 -30
  146. package/src/lib/fetch_repo_data.ts +71 -34
  147. package/src/lib/fs_fetch_value_cache.ts +15 -11
  148. package/src/lib/git_operations.ts +22 -194
  149. package/src/lib/github.ts +33 -21
  150. package/src/lib/github_helpers.ts +9 -16
  151. package/src/lib/gitops_analyze.task.ts +104 -66
  152. package/src/lib/gitops_config.ts +90 -139
  153. package/src/lib/gitops_constants.ts +6 -4
  154. package/src/lib/gitops_plan.task.ts +128 -76
  155. package/src/lib/gitops_publish.task.ts +280 -144
  156. package/src/lib/gitops_run.task.ts +265 -193
  157. package/src/lib/gitops_sync.task.ts +236 -52
  158. package/src/lib/gitops_task_helpers.ts +170 -114
  159. package/src/lib/gitops_validate.task.ts +44 -54
  160. package/src/lib/graph_validation.ts +28 -89
  161. package/src/lib/local_repo.ts +128 -335
  162. package/src/lib/log_helpers.ts +18 -28
  163. package/src/lib/multi_repo_publisher.ts +192 -110
  164. package/src/lib/npm_registry.ts +42 -67
  165. package/src/lib/operations.ts +99 -160
  166. package/src/lib/operations_defaults.ts +157 -201
  167. package/src/lib/output_helpers.ts +58 -6
  168. package/src/lib/preflight_checks.ts +52 -188
  169. package/src/lib/publish_gate.ts +7 -9
  170. package/src/lib/publish_steps.ts +27 -25
  171. package/src/lib/publishing_event.ts +26 -23
  172. package/src/lib/publishing_event_handler.ts +24 -22
  173. package/src/lib/publishing_plan.ts +474 -310
  174. package/src/lib/publishing_plan_helpers.ts +16 -12
  175. package/src/lib/publishing_plan_logging.ts +53 -44
  176. package/src/lib/repo.svelte.ts +16 -8
  177. package/src/lib/repo_readiness.ts +647 -0
  178. package/src/lib/repos_status.ts +671 -0
  179. package/src/lib/repos_status_load.ts +173 -0
  180. package/src/lib/version_utils.ts +3 -3
  181. package/dist/config_reconcile.d.ts +0 -46
  182. package/dist/config_reconcile.d.ts.map +0 -1
  183. package/dist/config_reconcile.js +0 -60
  184. package/dist/paths.d.ts +0 -7
  185. package/dist/paths.d.ts.map +0 -1
  186. package/dist/paths.js +0 -6
  187. package/dist/repo_ops.d.ts +0 -59
  188. package/dist/repo_ops.d.ts.map +0 -1
  189. package/dist/repo_ops.js +0 -170
  190. package/dist/resolved_gitops_config.d.ts +0 -9
  191. package/dist/resolved_gitops_config.d.ts.map +0 -1
  192. package/dist/resolved_gitops_config.js +0 -12
  193. package/src/lib/config_reconcile.ts +0 -94
  194. package/src/lib/paths.ts +0 -6
  195. package/src/lib/repo_ops.ts +0 -216
  196. package/src/lib/resolved_gitops_config.ts +0 -27
@@ -1,94 +0,0 @@
1
- /**
2
- * Reconciles repo metadata across multiple gitops configs.
3
- *
4
- * The ecosystem keeps several gitops configs — a canonical superset plus
5
- * narrower per-project subsets. They can't share one source of truth (the
6
- * superset includes private repos that public configs may not reference), so the
7
- * same repo is declared independently in each. This check flags when a subset's
8
- * intrinsic fields drift from the canonical config, or when a subset lists a
9
- * repo the canonical config doesn't. `repo_dir` is per-config and ignored.
10
- *
11
- * @module
12
- */
13
-
14
- import type {GitopsRepoConfig} from './gitops_config.ts';
15
-
16
- /** Repo fields that must agree across every config that lists the repo. */
17
- const INTRINSIC_FIELDS = ['visibility', 'ci', 'archived', 'branch'] as const;
18
-
19
- export type IntrinsicField = (typeof INTRINSIC_FIELDS)[number];
20
-
21
- export type ConfigDriftKind =
22
- /** The repo is in a subset config but absent from the canonical config. */
23
- | 'missing_from_canonical'
24
- /** An intrinsic field disagrees between the subset and the canonical config. */
25
- | 'field_mismatch';
26
-
27
- export interface ConfigDrift {
28
- repo_url: string;
29
- /** Name of the subset config whose entry diverges. */
30
- config: string;
31
- kind: ConfigDriftKind;
32
- /** The field that disagrees, set when `kind` is `'field_mismatch'`. */
33
- field?: IntrinsicField;
34
- /** The canonical config's value, set when `kind` is `'field_mismatch'`. */
35
- canonical_value?: string;
36
- /** The subset config's value, set when `kind` is `'field_mismatch'`. */
37
- config_value?: string;
38
- }
39
-
40
- export interface NamedRepos {
41
- name: string;
42
- repos: Array<GitopsRepoConfig>;
43
- }
44
-
45
- const field_value = (repo: GitopsRepoConfig, field: IntrinsicField): string => {
46
- switch (field) {
47
- case 'visibility':
48
- return repo.visibility;
49
- case 'ci':
50
- return String(repo.ci);
51
- case 'archived':
52
- return String(repo.archived);
53
- case 'branch':
54
- return repo.branch;
55
- }
56
- };
57
-
58
- /**
59
- * Compares each subset config against the canonical config. Repos that live only
60
- * in the canonical config are fine — the subsets are intentional partial views.
61
- * @returns one `ConfigDrift` per subset entry that is missing from the canonical
62
- * config or whose intrinsic fields disagree with it
63
- */
64
- export const reconcile_configs = (
65
- canonical: NamedRepos,
66
- subsets: Array<NamedRepos>,
67
- ): Array<ConfigDrift> => {
68
- const drift: Array<ConfigDrift> = [];
69
- const canonical_by_url = new Map(canonical.repos.map((r) => [r.repo_url, r] as const));
70
- for (const subset of subsets) {
71
- for (const repo of subset.repos) {
72
- const canon = canonical_by_url.get(repo.repo_url);
73
- if (!canon) {
74
- drift.push({repo_url: repo.repo_url, config: subset.name, kind: 'missing_from_canonical'});
75
- continue;
76
- }
77
- for (const field of INTRINSIC_FIELDS) {
78
- const canonical_value = field_value(canon, field);
79
- const config_value = field_value(repo, field);
80
- if (canonical_value !== config_value) {
81
- drift.push({
82
- repo_url: repo.repo_url,
83
- config: subset.name,
84
- kind: 'field_mismatch',
85
- field,
86
- canonical_value,
87
- config_value,
88
- });
89
- }
90
- }
91
- }
92
- }
93
- return drift;
94
- };
package/src/lib/paths.ts DELETED
@@ -1,6 +0,0 @@
1
- /**
2
- * Default repos directory relative to gitops config file.
3
- * Resolves to the parent of the directory with the config
4
- * (e.g., `~/dev/repo/gitops.config.ts` resolves to `~/dev/`).
5
- */
6
- export const DEFAULT_REPOS_DIR = '..';
@@ -1,216 +0,0 @@
1
- /**
2
- * Generic repository operations for scripts that work across repos.
3
- *
4
- * Provides lightweight utilities for:
5
- * - Getting repo paths from gitops config (without full git sync)
6
- * - Walking files in repos with sensible exclusions
7
- * - Common exclusion patterns for node/svelte projects
8
- *
9
- * For full git sync/clone functionality, use `get_gitops_ready()` from `gitops_task_helpers`.
10
- *
11
- * @module
12
- */
13
-
14
- import {existsSync} from 'node:fs';
15
- import {readdir, stat} from 'node:fs/promises';
16
- import {join, resolve, dirname} from 'node:path';
17
-
18
- import {load_gitops_config} from './gitops_config.ts';
19
- import {DEFAULT_REPOS_DIR} from './paths.ts';
20
- import {GITOPS_CONFIG_PATH_DEFAULT} from './gitops_constants.ts';
21
-
22
- /** Default directories to exclude from file walking */
23
- export const DEFAULT_EXCLUDE_DIRS = [
24
- 'node_modules',
25
- '.git',
26
- '.gro',
27
- '.svelte-kit',
28
- '.deno',
29
- '.vscode',
30
- '.idea',
31
- 'dist',
32
- 'build',
33
- 'coverage',
34
- '.cache',
35
- '.turbo',
36
- ] as const;
37
-
38
- /** Default binary/non-text extensions to exclude from content processing */
39
- export const DEFAULT_EXCLUDE_EXTENSIONS = [
40
- '.png',
41
- '.jpg',
42
- '.jpeg',
43
- '.gif',
44
- '.svg',
45
- '.ico',
46
- '.webp',
47
- '.woff',
48
- '.woff2',
49
- '.ttf',
50
- '.eot',
51
- '.mp4',
52
- '.webm',
53
- '.mp3',
54
- '.wav',
55
- '.ogg',
56
- '.zip',
57
- '.tar',
58
- '.gz',
59
- '.lock',
60
- '.pdf',
61
- ] as const;
62
-
63
- export interface WalkOptions {
64
- /** Additional directories to exclude (merged with defaults) */
65
- exclude_dirs?: Array<string>;
66
- /** Additional extensions to exclude (merged with defaults) */
67
- exclude_extensions?: Array<string>;
68
- /** Maximum file size in bytes (default: 10MB) */
69
- max_file_size?: number;
70
- /** Include directories in output (default: false) */
71
- include_dirs?: boolean;
72
- /** Use only provided exclusions, ignoring defaults */
73
- no_defaults?: boolean;
74
- }
75
-
76
- export interface RepoPath {
77
- name: string;
78
- path: string;
79
- url: string;
80
- }
81
-
82
- /**
83
- * Get repo paths from gitops config without full git sync.
84
- * Lighter weight than `get_gitops_ready()` - just resolves paths.
85
- *
86
- * @param config_path - path to the gitops config file (defaults to `gitops.config.ts`)
87
- * @returns array of repo info with name, path, and url
88
- */
89
- export const get_repo_paths = async (config_path?: string): Promise<Array<RepoPath>> => {
90
- const resolved_config_path = resolve(config_path ?? GITOPS_CONFIG_PATH_DEFAULT);
91
- const config = await load_gitops_config(resolved_config_path);
92
-
93
- if (!config) {
94
- throw new Error(`No gitops config found at ${resolved_config_path}`);
95
- }
96
-
97
- const config_dir = dirname(resolved_config_path);
98
- const repos_dir = resolve(config_dir, config.repos_dir || DEFAULT_REPOS_DIR);
99
-
100
- const repos: Array<RepoPath> = [];
101
-
102
- for (const repo_config of config.repos) {
103
- const url = repo_config.repo_url;
104
- const name = url.split('/').at(-1);
105
- if (!name) continue;
106
-
107
- const path = repo_config.repo_dir
108
- ? resolve(config_dir, repo_config.repo_dir)
109
- : join(repos_dir, name);
110
-
111
- if (existsSync(path)) {
112
- repos.push({name, path, url});
113
- }
114
- }
115
-
116
- return repos;
117
- };
118
-
119
- /**
120
- * Check if a path should be excluded based on options.
121
- */
122
- export const should_exclude_path = (file_path: string, options?: WalkOptions): boolean => {
123
- const exclude_dirs = options?.no_defaults
124
- ? (options.exclude_dirs ?? [])
125
- : [...DEFAULT_EXCLUDE_DIRS, ...(options?.exclude_dirs ?? [])];
126
-
127
- const exclude_extensions = options?.no_defaults
128
- ? (options.exclude_extensions ?? [])
129
- : [...DEFAULT_EXCLUDE_EXTENSIONS, ...(options?.exclude_extensions ?? [])];
130
-
131
- const normalized = file_path.toLowerCase();
132
-
133
- // Check excluded directories
134
- for (const dir of exclude_dirs) {
135
- // Must match as a full directory component, not a prefix
136
- if (normalized.includes(`/${dir}/`) || normalized.endsWith(`/${dir}`)) {
137
- return true;
138
- }
139
- }
140
-
141
- // Check excluded extensions
142
- for (const ext of exclude_extensions) {
143
- if (normalized.endsWith(ext)) {
144
- return true;
145
- }
146
- }
147
-
148
- return false;
149
- };
150
-
151
- /**
152
- * Walk files in a directory, respecting common exclusions.
153
- * Yields absolute paths to files (and optionally directories).
154
- *
155
- * @param dir - directory to walk
156
- * @param options - walk options for exclusions and filtering
157
- */
158
- export async function* walk_repo_files(
159
- dir: string,
160
- options?: WalkOptions,
161
- ): AsyncGenerator<string, void, undefined> {
162
- const max_file_size = options?.max_file_size ?? 10 * 1024 * 1024;
163
- const include_dirs = options?.include_dirs ?? false;
164
-
165
- async function* walk(current_dir: string): AsyncGenerator<string, void, undefined> {
166
- let entries;
167
- try {
168
- entries = await readdir(current_dir, {withFileTypes: true});
169
- } catch {
170
- // Skip directories we can't read
171
- return;
172
- }
173
-
174
- for (const entry of entries) {
175
- const full_path = join(current_dir, entry.name);
176
-
177
- if (should_exclude_path(full_path, options)) {
178
- continue;
179
- }
180
-
181
- if (entry.isDirectory()) {
182
- if (include_dirs) {
183
- yield full_path;
184
- }
185
- yield* walk(full_path);
186
- } else if (entry.isFile()) {
187
- // Check file size
188
- try {
189
- const file_stat = await stat(full_path);
190
- if (file_stat.size <= max_file_size) {
191
- yield full_path;
192
- }
193
- } catch {
194
- // Skip files we can't stat
195
- }
196
- }
197
- }
198
- }
199
-
200
- yield* walk(dir);
201
- }
202
-
203
- /**
204
- * Collect all files from `walk_repo_files` into an array.
205
- * Convenience function for when you need all paths upfront.
206
- */
207
- export const collect_repo_files = async (
208
- dir: string,
209
- options?: WalkOptions,
210
- ): Promise<Array<string>> => {
211
- const files: Array<string> = [];
212
- for await (const file of walk_repo_files(dir, options)) {
213
- files.push(file);
214
- }
215
- return files;
216
- };
@@ -1,27 +0,0 @@
1
- import type {GitopsConfig} from './gitops_config.ts';
2
- import {local_repo_locate, type LocalRepoPath, type LocalRepoMissing} from './local_repo.ts';
3
-
4
- export interface ResolvedGitopsConfig {
5
- local_repos: Array<LocalRepoPath | LocalRepoMissing> | null;
6
- local_repo_paths: Array<LocalRepoPath> | null;
7
- local_repos_missing: Array<LocalRepoMissing> | null;
8
- }
9
-
10
- export const resolve_gitops_config = (
11
- gitops_config: GitopsConfig,
12
- repos_dir: string,
13
- ): ResolvedGitopsConfig => {
14
- const local_repos = gitops_config.repos.map((r) =>
15
- local_repo_locate({repo_config: r, repos_dir}),
16
- );
17
-
18
- const local_repo_paths = local_repos.filter((r) => r.type === 'local_repo_path');
19
- const local_repos_missing = local_repos.filter((r) => r.type === 'local_repo_missing');
20
-
21
- const config: ResolvedGitopsConfig = {
22
- local_repos: local_repos.length ? local_repos : null,
23
- local_repo_paths: local_repo_paths.length ? local_repo_paths : null,
24
- local_repos_missing: local_repos_missing.length ? local_repos_missing : null,
25
- };
26
- return config;
27
- };