gitops_run.task.ts view source
ZodObject<{ command: ZodString; config: ZodDefault<ZodString>; concurrency: ZodDefault<ZodNumber>; format: ZodDefault<ZodEnum<{ json: "json"; text: "text"; }>>; }, $strict> a tool for managing many repos
189 declarations
gitops_run.task.ts view source
ZodObject<{ command: ZodString; config: ZodDefault<ZodString>; concurrency: ZodDefault<ZodNumber>; format: ZodDefault<ZodEnum<{ json: "json"; text: "text"; }>>; }, $strict> BuildOperations Build operations for validating packages compile before publishing.
build_packageBuilds a package using gro build.
(options: {
repo: LocalRepo;
log?: Logger;
}) => Promise<Result<object, {message: string; output?: string}>>BumpType Semantic Versioning 2.0.0 utilities
publishing_plan_helpers.ts view source
(repos: LocalRepo[], predicted_versions: Map<string, string>, breaking_packages: Set<string>): { dependency_updates: DependencyUpdate[]; breaking_cascades: Map<...>; } Calculates all dependency updates between packages based on predicted versions.
Iterates through all repos, checking prod, peer, and dev dependencies to find which packages will need dependency version bumps after publishing.
Also tracks "breaking cascades" - when a breaking change propagates to dependents.
reposLocalRepo[]predicted_versionsMap<string, string>breaking_packagesSet<string>{ dependency_updates: DependencyUpdate[]; breaking_cascades: Map<string, string[]>; } (current_version: string, bump_type: BumpType): string current_versionstringbump_typestring changeset_reader.ts view source
ChangesetInfo filenamestringpackagesArray<{name: string; bump_type: BumpType}>summarystringChangesetOperations Changeset operations for reading and predicting versions from .changeset/*.md files.
has_changesetsChecks if a repo has any changeset files. Returns true if changesets exist, false if none found.
(options: {
repo: LocalRepo;
}) => Promise<Result<{value: boolean}, {message: string}>>read_changesetsReads all changeset files from a repo. Returns array of changeset info, or error if reading fails.
(options: {
repo: LocalRepo;
log?: Logger;
}) => Promise<Result<{value: Array<ChangesetInfo>}, {message: string}>>predict_next_versionPredicts the next version based on changesets. Returns null if no changesets found (expected, not an error). Returns error Result if changesets exist but can't be read/parsed.
(options: {
repo: LocalRepo;
log?: Logger;
}) => Promise<Result<{version: string; bump_type: BumpType}, {message: string}> | null>(pkg: string, version: string, options?: { log?: Logger | undefined; }): Promise<boolean> pkgstringversionstringoptions{ log?: Logger | undefined; }{}Promise<boolean> (dir: string, options?: WalkOptions | undefined): Promise<string[]> Collect all files from walk_repo_files into an array. Convenience function for when you need all paths upfront.
dirstringoptions?WalkOptions | undefinedPromise<string[]> (a: BumpType, b: BumpType): number Compares bump types. Returns positive if a > b, negative if a < b, 0 if equal.
abnumber changeset_generator.ts view source
(repo: LocalRepo, updates: DependencyVersionChange[], options?: { log?: Logger | undefined; }): Promise<string> Creates a changeset file for dependency updates. Returns the path to the created changeset file.
repoupdatesDependencyVersionChange[]options{ log?: Logger | undefined; }{}Promise<string> changeset_generator.ts view source
(dependencies: Map<string, string>, published_versions: Map<string, PublishedVersion>): DependencyVersionChange[] dependenciesMap<string, string>published_versionsMap<string, PublishedVersion>DependencyVersionChange[] (): GitopsConfig GitopsConfig fs_fetch_value_cache.ts view source
(name: string, dir?: string): Promise<FetchCache> Creates file-system backed cache for fuz_util's fetch.js API responses.
Cache invalidation strategy: If cache file can't be read or parsed, entire cache is cleared (delete file) and starts fresh. This handles format changes.
Uses structuredClone to track changes - only writes to disk if data modified.
Formatted with Prettier before writing for version control friendliness.
namecache filename (without .json extension)
stringdircache directory (defaults to .gro/build/fetch/)
stringjoin(paths.build, 'fetch')Promise<FetchCache> cache object with Map-based data and save() method
CreateGitopsConfig operations_defaults.ts view source
BuildOperations operations_defaults.ts view source
ChangesetOperations readonly ["node_modules", ".git", ".gro", ".svelte-kit", ".deno", ".vscode", ".idea", "dist", "build", "coverage", ".cache", ".turbo"] Default directories to exclude from file walking
readonly [".png", ".jpg", ".jpeg", ".gif", ".svg", ".ico", ".webp", ".woff", ".woff2", ".ttf", ".eot", ".mp4", ".webm", ".mp3", ".wav", ".ogg", ".zip", ".tar", ".gz", ".lock", ".pdf"] Default binary/non-text extensions to exclude from content processing
operations_defaults.ts view source
FsOperations operations_defaults.ts view source
GitOperations operations_defaults.ts view source
GitopsOperations Combined default operations for all gitops functionality.
operations_defaults.ts view source
NpmOperations operations_defaults.ts view source
PreflightOperations operations_defaults.ts view source
ProcessOperations ".." Default repos directory relative to gitops config file.
Resolves to the parent of the directory with the config
(e.g., /dev/repo/gitops.config.ts resolves to /dev/).
dependency_graph.ts view source
{ readonly PROD: "prod"; readonly PEER: "peer"; readonly DEV: "dev"; } dependency_graph.ts view source
nodestype Map<string, DependencyNode>
edgestype Map<string, Set<string>>
constructortype new (): DependencyGraph
init_from_repostype (repos: LocalRepo[]): void
reposLocalRepo[]voidget_nodetype (name: string): DependencyNode | undefined
namestringDependencyNode | undefinedget_dependentstype (name: string): Set<string>
namestringSet<string>get_dependenciestype (name: string): Map<string, DependencySpec>
namestringMap<string, DependencySpec>topological_sortComputes topological sort order for dependency graph.
Uses Kahn's algorithm with alphabetical ordering within tiers for deterministic results. Throws if cycles detected.
type (exclude_dev?: boolean): string[]
exclude_devif true, excludes dev dependencies to break cycles. Publishing uses exclude_dev=true to handle circular dev deps.
booleanfalsestring[]array of package names in dependency order (dependencies before dependents)
if - circular dependencies detected in included dependency typesdetect_cyclestype (): string[][]
string[][]detect_cycles_by_typeDetects circular dependencies, categorized by severity.
Production/peer cycles prevent publishing (impossible to order packages). Dev cycles are normal (test utils, shared configs) and safely ignored.
Uses DFS traversal with recursion stack to identify back edges. Deduplicates cycles using sorted cycle keys.
type (): { production_cycles: string[][]; dev_cycles: string[][]; }
{ production_cycles: string[][]; dev_cycles: string[][]; }object with production_cycles (errors) and dev_cycles (info)
toJSONtype (): DependencyGraphJson
dependency_graph.ts view source
Builder for creating and analyzing dependency graphs.
build_from_reposConstructs dependency graph from local repos.
Two-pass algorithm: first creates nodes, then builds edges (dependents). Prioritizes prod/peer deps over dev deps when same package appears in multiple dependency types (stronger constraint wins).
type (repos: LocalRepo[]): DependencyGraph
reposLocalRepo[]fully initialized dependency graph with all nodes and edges
compute_publishing_orderComputes publishing order using topological sort with dev deps excluded.
Excludes dev dependencies to break circular dev dependency cycles while preserving production/peer dependency ordering. This allows patterns like shared test utilities that depend on each other for development.
type (graph: DependencyGraph): string[]
graphstring[]package names in safe publishing order (dependencies before dependents)
if - production/peer cycles detected (cannot be resolved by exclusion)analyzetype (graph: DependencyGraph): { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }
graph{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }dependency_graph.ts view source
DependencyGraphJson nodesArray<{
name: string;
version: string;
dependencies: Array<{name: string; spec: DependencySpec}>;
dependents: Array<string>;
publishable: boolean;
}>edgesArray<{from: string; to: string}>dependency_graph.ts view source
DependencyNode namestringversionstringrepodependenciesMap<string, DependencySpec>dependentsSet<string>publishablebooleandependency_graph.ts view source
DependencySpec typeversionstringresolvedstringdependency_graph.ts view source
DependencyType publishing_plan.ts view source
DependencyUpdate dependent_packagestringupdated_dependencystringcurrent_versionstringnew_versionstringtype'dependencies' | 'devDependencies' | 'peerDependencies'causes_republishbooleanchangeset_generator.ts view source
DependencyVersionChange package_namestringfrom_versionstringto_versionstringbump_type'major' | 'minor' | 'patch'breakingboolean(old_version: string, new_version: string): "major" | "minor" | "patch" old_versionstringnew_versionstring"major" | "minor" | "patch" changeset_reader.ts view source
(changesets: ChangesetInfo[], package_name: string): BumpType | null Determines the bump type for a package from its changesets.
When multiple changesets exist for the same package, returns the highest bump type (major > minor > patch) to ensure the most significant change is reflected in the version bump.
changesetsChangesetInfo[]package_namestringBumpType | null the highest bump type, or null if package has no changesets
(repo_info: GithubRepoInfo, options?: { cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefined; log?: Logger | undefined; token?: string | undefined; api_version?: string | undefined; ref?: string | undefined; }): Promise<...> repo_infooptions{ cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefined; log?: Logger | undefined; token?: string | undefined; api_version?: string | undefined; ref?: string | undefined; }{}Promise<{ status: "queued" | "in_progress" | "completed"; conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null; } | null> (repo_info: GithubRepoInfo, options?: { cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefined; log?: Logger | undefined; token?: string | undefined; api_version?: string | undefined; }): Promise<...> repo_infooptions{ cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefined; log?: Logger | undefined; token?: string | undefined; api_version?: string | undefined; }{}Promise<{ number: number; title: string; user: { login: string; }; draft: boolean; }[] | null> fetch_repo_data.ts view source
(resolved_repos: LocalRepo[], token?: string | undefined, cache?: Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefined, log?: Logger | undefined, delay?: number, github_api_version?: string | undefined): Promise<...> Fetches GitHub metadata (CI status, PRs) for all repos.
Fetches sequentially with delay between requests to respect GitHub API rate limits.
Uses await_in_loop intentionally to avoid parallel requests overwhelming the API.
Error handling: Logs fetch failures but continues processing remaining repos.
Repos with failed fetches will have null for check_runs or pull_requests.
resolved_reposLocalRepo[]token?string | undefinedcache?optional cache from fuz_util's fetch.js for response memoization
Map<string, { key: string; url: string; params: any; value: any; etag: string | null; last_modified: string | null; }> | undefinedlog?Logger | undefineddelaymilliseconds between API requests (default: 33ms)
number33github_api_version?string | undefinedPromise<RepoJson[]> array of Repo objects with GitHub metadata attached
fs_fetch_value_cache.ts view source
FetchCache namestringdataFetchValueCachesave() => Promise<boolean>FilterPullRequest dependency_updater.ts view source
(repo: LocalRepo, published: Map<string, string>): Map<string, { current: string; new: string; type: "dependencies" | "devDependencies" | "peerDependencies"; }> repopublishedMap<string, string>Map<string, { current: string; new: string; type: "dependencies" | "devDependencies" | "peerDependencies"; }> <T>(data: T, formatters: OutputFormatters<T>, options: OutputOptions): Promise<void> Formats data and outputs to file or stdout based on options.
Supports three formats: - stdout: Uses logger for colored/styled output (cannot use with --outfile) - json: Stringified JSON - markdown: Formatted markdown text
dataTformattersOutputFormatters<T>optionsPromise<void> if - stdout format used with outfile, or if logger missing for stdout(analysis: { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }): string[] Formats dev circular dependencies as styled strings. Returns array of lines for inclusion in output.
analysis{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }string[] (analysis: { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }): string[] Formats production/peer circular dependencies as styled strings. Returns array of lines for inclusion in output.
analysis{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }string[] (analysis: { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }): string[] Formats wildcard dependencies as styled strings. Returns array of lines for inclusion in output.
analysis{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }string[] FsOperations File system operations for reading and writing files.
readFileReads a file from the file system.
(options: {
path: string;
encoding: BufferEncoding;
}) => Promise<Result<{value: string}, {message: string}>>writeFileWrites a file to the file system.
(options: {
path: string;
content: string;
}) => Promise<Result<object, {message: string}>>changeset_generator.ts view source
(package_name: string, updates: DependencyVersionChange[], bump_type: "major" | "minor" | "patch"): string Generates markdown changeset content for dependency updates.
Creates properly formatted changeset with YAML frontmatter, summary, and categorized list of breaking vs regular updates. Output format matches changesets CLI for consistency.
package_namepackage receiving the dependency updates
stringupdateslist of dependency changes with version info
DependencyVersionChange[]bump_typerequired bump type (calculated from breaking changes)
"major" | "minor" | "patch"string markdown content ready to write to .changeset/*.md file
publishing_plan.ts view source
(repos: LocalRepo[], options?: GeneratePlanOptions): Promise<PublishingPlan> Generates a publishing plan showing what would happen during publishing. Shows version changes, dependency updates, and breaking change cascades. Uses fixed-point iteration to resolve transitive cascades.
reposLocalRepo[]options{}Promise<PublishingPlan> publishing_plan.ts view source
GeneratePlanOptions logLoggeropsverbosebooleangitops_task_helpers.ts view source
(options: GetGitopsReadyOptions): Promise<{ config_path: string; repos_dir: string; gitops_config: GitopsConfig; local_repos: LocalRepo[]; }> Central initialization function for all gitops tasks.
Initialization sequence:
1. Loads and normalizes config from gitops.config.ts
2. Resolves local repo paths (creates missing with --download)
3. Switches branches and pulls latest changes (in parallel by default)
4. Auto-installs deps if package.json changed during pull
Priority for path resolution:
- dir argument (explicit override)
- Config repos_dir setting
- DEFAULT_REPOS_DIR constant
optionsPromise<{ config_path: string; repos_dir: string; gitops_config: GitopsConfig; local_repos: LocalRepo[]; }> initialized config and fully loaded repos ready for operations
if - config loading or repo resolution fails(pkg: string, options?: { log?: Logger | undefined; }): Promise<PackageInfo | null> Fetches package metadata from NPM registry.
Returns name and latest version. Returns null if package doesn't exist or registry is unreachable.
pkgstringoptions{ log?: Logger | undefined; }{}Promise<PackageInfo | null> package info or null on error/not found
(config_path?: string | undefined): Promise<RepoPath[]> Get repo paths from gitops config without full git sync.
Lighter weight than get_gitops_ready() - just resolves paths.
config_path?Path to gitops.config.ts (defaults to ./gitops.config.ts)
string | undefinedPromise<RepoPath[]> Array of repo info with name, path, and url
publishing_plan_helpers.ts view source
(repo: LocalRepo, dependency_updates: DependencyUpdate[], breaking_packages: Set<string>): BumpType | null Determines the required bump type for a package based on its dependency updates.
Returns null if no prod/peer dependency updates, otherwise returns the minimum required bump type (major for breaking deps, patch otherwise).
Respects pre-1.0 semver conventions (minor for breaking in 0.x).
repodependency_updatesDependencyUpdate[]breaking_packagesSet<string>BumpType | null (current_version: string, default_strategy?: "" | "^" | "~" | ">="): string Determines version prefix to use when updating dependencies.
Strategy: - Wildcard (*): Use caret (^) as default - Has existing prefix: Preserve it (^, ~, >=, <=, etc) - No prefix: Use default_strategy
This preserves user intent while handling wildcard replacements sensibly.
current_versionstringdefault_strategyprefix to use when no existing prefix found
"" | "^" | "~" | ">="'^'string (version: string): string Gets the version prefix (^, ~, >=, <=, or empty string).
versionstringstring gitops_task_helpers.ts view source
GetGitopsReadyOptions configstringdirstringdownloadbooleanlogLoggergit_opsnpm_opsparallelbooleanconcurrencynumber(files: string | string[], options?: SpawnOptions | undefined): Promise<void> Adds files to git staging area and throws if anything goes wrong.
filesstring | string[]options?SpawnOptions | undefinedPromise<void> (files: string | string[], message: string, options?: SpawnOptions | undefined): Promise<void> Adds files and commits in one operation and throws if anything goes wrong.
filesstring | string[]messagestringoptions?SpawnOptions | undefinedPromise<void> (options?: SpawnOptions | undefined): Promise<boolean> Wrapper for gro's git_check_clean_workspace that returns a boolean.
options?SpawnOptions | undefinedPromise<boolean> (message: string, options?: SpawnOptions | undefined): Promise<void> Commits staged changes with a message and throws if anything goes wrong.
messagestringoptions?SpawnOptions | undefinedPromise<void> (options?: SpawnOptions | undefined): Promise<string> Wrapper for gro's git_current_branch_name that throws if null.
options?SpawnOptions | undefinedPromise<string> (branch?: string | undefined, options?: SpawnOptions | undefined): Promise<string> Wrapper for gro's git_current_commit_hash that throws if null.
branch?string | undefinedoptions?SpawnOptions | undefinedPromise<string> (options?: SpawnOptions | undefined): Promise<string[]> Returns list of changed files compared to HEAD.
options?SpawnOptions | undefinedPromise<string[]> (options?: SpawnOptions | undefined): Promise<boolean> options?SpawnOptions | undefinedPromise<boolean> (from_commit: string, to_commit: string, file_path: string, options?: SpawnOptions | undefined): Promise<boolean> from_commitstringto_commitstringfile_pathstringoptions?SpawnOptions | undefinedPromise<boolean> (remote?: string, options?: SpawnOptions | undefined): Promise<boolean> remotestring'origin'options?SpawnOptions | undefinedPromise<boolean> (tag_name: string, origin?: GitOrigin, options?: SpawnOptions | undefined): Promise<void> Pushes a tag to origin and throws if anything goes wrong.
tag_namestringoriginGitOrigin'origin' as GitOriginoptions?SpawnOptions | undefinedPromise<void> (message?: string | undefined, options?: SpawnOptions | undefined): Promise<void> Stashes current changes and throws if anything goes wrong.
message?string | undefinedoptions?SpawnOptions | undefinedPromise<void> (options?: SpawnOptions | undefined): Promise<void> Applies stashed changes and throws if anything goes wrong.
options?SpawnOptions | undefinedPromise<void> (branch: GitBranch, pull?: boolean, options?: SpawnOptions | undefined): Promise<void> Switches to a branch with safety checks and throws if workspace is not clean.
branchGitBranchpullbooleantrueoptions?SpawnOptions | undefinedPromise<void> (tag_name: string, message?: string | undefined, options?: SpawnOptions | undefined): Promise<void> Creates a git tag and throws if anything goes wrong.
tag_namestringmessage?string | undefinedoptions?SpawnOptions | undefinedPromise<void> ZodObject<{ total_count: ZodNumber; check_runs: ZodArray<ZodObject<{ status: ZodEnum<{ queued: "queued"; in_progress: "in_progress"; completed: "completed"; }>; conclusion: ZodNullable<ZodEnum<{ success: "success"; ... 5 more ...; action_required: "action_required"; }>>; }, $strip>>; }, $strip> ZodObject<{ status: ZodEnum<{ queued: "queued"; in_progress: "in_progress"; completed: "completed"; }>; conclusion: ZodNullable<ZodEnum<{ success: "success"; failure: "failure"; neutral: "neutral"; cancelled: "cancelled"; skipped: "skipped"; timed_out: "timed_out"; action_required: "action_required"; }>>; }, $strip> ZodObject<{ number: ZodNumber; title: ZodString; user: ZodObject<{ login: ZodString; }, $strip>; draft: ZodBoolean; }, $strip> ZodArray<ZodObject<{ number: ZodNumber; title: ZodString; user: ZodObject<{ login: ZodString; }, $strip>; draft: ZodBoolean; }, $strip>> GithubRepoInfo Minimal interface for GitHub API calls - works with both Pkg and Repo.
owner_namestring | nullrepo_namestringGitOperations Git operations for branch management, commits, tags, and workspace state.
All operations return Result instead of throwing errors.
current_branch_nameGets the current branch name.
(options?: {
cwd?: string;
}) => Promise<Result<{value: string}, {message: string}>>current_commit_hashGets the current commit hash.
(options?: {
branch?: string;
cwd?: string;
}) => Promise<Result<{value: string}, {message: string}>>check_clean_workspaceChecks if the workspace is clean (no uncommitted changes).
(options?: {
cwd?: string;
}) => Promise<Result<{value: boolean}, {message: string}>>checkoutChecks out a branch.
(options: {branch: string; cwd?: string}) => Promise<Result<object, {message: string}>>pullPulls changes from remote.
(options?: {
origin?: string;
branch?: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>switch_branchSwitches to a branch, optionally pulling.
(options: {
branch: string;
pull?: boolean;
cwd?: string;
}) => Promise<Result<object, {message: string}>>has_remoteChecks if a remote exists.
(options?: {
remote?: string;
cwd?: string;
}) => Promise<Result<{value: boolean}, {message: string}>>addStages files for commit.
(options: {
files: string | Array<string>;
cwd?: string;
}) => Promise<Result<object, {message: string}>>commitCreates a commit.
(options: {message: string; cwd?: string}) => Promise<Result<object, {message: string}>>add_and_commitStages files and creates a commit.
(options: {
files: string | Array<string>;
message: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>has_changesChecks if there are any uncommitted changes.
(options?: {cwd?: string}) => Promise<Result<{value: boolean}, {message: string}>>get_changed_filesGets a list of changed files.
(options?: {
cwd?: string;
}) => Promise<Result<{value: Array<string>}, {message: string}>>tagCreates a git tag.
(options: {
tag_name: string;
message?: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>push_tagPushes a tag to remote.
(options: {
tag_name: string;
origin?: string;
cwd?: string;
}) => Promise<Result<object, {message: string}>>stashStashes uncommitted changes.
(options?: {message?: string; cwd?: string}) => Promise<Result<object, {message: string}>>stash_popPops the most recent stash.
(options?: {cwd?: string}) => Promise<Result<object, {message: string}>>has_file_changedChecks if a specific file changed between two commits.
(options: {
from_commit: string;
to_commit: string;
file_path: string;
cwd?: string;
}) => Promise<Result<{value: boolean}, {message: string}>>gitops_constants.ts view source
5 Default number of repos to process concurrently during parallel operations.
gitops_constants.ts view source
"gitops.config.ts" Default path to the gitops configuration file.
gitops_constants.ts view source
10 Maximum number of iterations for fixed-point iteration during publishing. Used in both plan generation and actual publishing to resolve transitive dependency cascades.
In practice, most repos converge in 2-3 iterations. Deep dependency chains may require more iterations.
gitops_constants.ts view source
600000 Default timeout in milliseconds for waiting on NPM package propagation (10 minutes). NPM's CDN uses eventual consistency, so published packages may not be immediately available.
".gro/fuz_gitops" Base directory for all gitops-generated files.
GitopsConfig reposArray<GitopsRepoConfig>repos_dirstringGitopsConfigModule defaultRawGitopsConfig | CreateGitopsConfigGitopsOperations Combined operations interface grouping all gitops functionality. This is the main interface injected into publishing and validation workflows.
changesetgitprocessnpmpreflightfsbuildGitopsRepoConfig repo_urlThe HTTPS URL to the repo. Does not include a .git suffix.
Urlrepo_dirRelative or absolute path to the repo's local directory.
If null, the directory is inferred from the URL and cwd.
string | nullbranchThe branch name to use when fetching the repo. Defaults to main.
GitBranchgraph_validation.ts view source
GraphValidationResult graphpublishing_orderArray<string>production_cyclesArray<Array<string>>dev_cyclesArray<Array<string>>sort_errorstringchangeset_reader.ts view source
(repo: LocalRepo): Promise<boolean> Checks if a repo has any changeset files (excluding README.md).
Used by preflight checks and publishing workflow to determine which packages need to be published. Returns false if .changeset directory doesn't exist or contains only README.md.
repoPromise<boolean> true if repo has unpublished changesets
gitops_task_helpers.ts view source
(config_path: string): Promise<GitopsConfig> config_pathstringPromise<GitopsConfig> npm_install_helpers.ts view source
(repo: LocalRepo, ops: GitopsOperations, log?: Logger | undefined): Promise<void> Installs npm dependencies with cache healing on ETARGET errors.
Strategy:
1. First attempt: regular npm install
2. On ETARGET error (stale cache): npm cache clean --force then retry
3. On other errors: fail immediately
Why ETARGET errors occur: After publishing a package and waiting for NPM registry propagation, npm's local cache may still have stale "404" metadata. This healing strategy clears the cache to force fresh metadata fetch.
repo- The repository to install dependencies for
ops- Gitops operations (for dependency injection)
log?- Optional logger
Logger | undefinedPromise<void> Error - if install fails (with details about cache healing attempts)(old_version: string, bump_type: "major" | "minor" | "patch"): boolean Determines if a bump is a breaking change based on semver rules. Pre-1.0: minor bumps are breaking 1.0+: major bumps are breaking
old_versionstringbump_type"major" | "minor" | "patch"boolean (version: string): boolean versionstringboolean (config_path: string): Promise<GitopsConfig | null> config_pathstringPromise<GitopsConfig | null> ({ local_repo_path, log: _log, git_ops, npm_ops, }: { local_repo_path: LocalRepoPath; log?: Logger | undefined; git_ops?: GitOperations | undefined; npm_ops?: NpmOperations | undefined; }): Promise<...> Loads repo data with automatic syncing and dependency management.
Workflow: 1. Records current commit hash (for detecting changes) 2. Switches to target branch if needed (requires clean workspace) 3. Pulls latest changes from remote (skipped for local-only repos) 4. Validates workspace is clean after pull 5. Auto-installs dependencies if package.json changed 6. Imports library_json from src/routes/library.ts 7. Creates Library and extracts dependency maps
This ensures repos are always in sync with their configured branch before being used by gitops commands.
__0{ local_repo_path: LocalRepoPath; log?: Logger | undefined; git_ops?: GitOperations | undefined; npm_ops?: NpmOperations | undefined; }Promise<LocalRepo> if - workspace dirty, branch switch fails, install fails, or library.ts missing({ repo_config, repos_dir, }: { repo_config: GitopsRepoConfig; repos_dir: string; }): LocalRepoPath | LocalRepoMissing __0{ repo_config: GitopsRepoConfig; repos_dir: string; }LocalRepoPath | LocalRepoMissing ({ resolved_config, repos_dir, gitops_config, download, log, npm_ops, }: { resolved_config: ResolvedGitopsConfig; repos_dir: string; gitops_config: GitopsConfig; download: boolean; log?: Logger | undefined; npm_ops?: NpmOperations | undefined; }): Promise<...> __0{ resolved_config: ResolvedGitopsConfig; repos_dir: string; gitops_config: GitopsConfig; download: boolean; log?: Logger | undefined; npm_ops?: NpmOperations | undefined; }Promise<LocalRepoPath[]> ({ local_repo_paths, log, git_ops, npm_ops, parallel, concurrency, }: { local_repo_paths: LocalRepoPath[]; log?: Logger | undefined; git_ops?: GitOperations | undefined; npm_ops?: NpmOperations | undefined; parallel?: boolean | undefined; concurrency?: number | undefined; }): Promise<...> __0{ local_repo_paths: LocalRepoPath[]; log?: Logger | undefined; git_ops?: GitOperations | undefined; npm_ops?: NpmOperations | undefined; parallel?: boolean | undefined; concurrency?: number | undefined; }Promise<LocalRepo[]> LocalRepo Fully loaded local repo with Library and extracted dependency data. Does not extend LocalRepoPath - Library is source of truth for name/repo_url/etc.
libraryLibrarylibrary_jsonLibraryJsonrepo_dirstringrepo_git_ssh_urlstringrepo_configdependenciesMap<string, string>dev_dependenciesMap<string, string>peer_dependenciesMap<string, string>LocalRepoMissing A repo that is missing from the filesystem (needs cloning).
type'local_repo_missing'repo_namestringrepo_urlstringrepo_git_ssh_urlstringrepo_configLocalRepoPath A repo that has been located on the filesystem (path exists). Used before loading - just filesystem/git concerns.
type'local_repo_path'repo_namestringrepo_dirstringrepo_urlstringrepo_git_ssh_urlstringrepo_config(analysis: { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }, log: Logger, indent?: string): void Logs all dependency analysis results (wildcards, production cycles, dev cycles). Convenience function that calls all three logging functions in order.
analysis{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }logLoggerindentstring''void (analysis: { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }, log: Logger, indent?: string): void Logs dev circular dependencies as info. Dev cycles are normal and non-blocking, so they're informational, not warnings.
analysis{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }logLoggerindentstring''void (items: string[], header: string, color: "cyan" | "yellow" | "red" | "dim", log: Logger, log_method?: "error" | "info" | "warn"): void Logs a simple bulleted list with a header. Common pattern for warnings, info messages, and other lists.
itemsstring[]headerstringcolor"cyan" | "yellow" | "red" | "dim"logLoggerlog_method"error" | "info" | "warn"'info'void (analysis: { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }, log: Logger, indent?: string): void Logs production/peer circular dependencies as errors. Production cycles block publishing and must be resolved.
analysis{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }logLoggerindentstring''void publishing_plan_logging.ts view source
(plan: PublishingPlan, log: Logger, options?: LogPlanOptions): void Logs a complete publishing plan to the console.
Displays errors, publishing order, version changes grouped by scenario, dependency-only updates, warnings, and a summary.
planlogLoggeroptions{}void (analysis: { production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }, log: Logger, indent?: string): void Logs wildcard dependencies as warnings. Wildcard dependencies require attention and should be reviewed.
analysis{ production_cycles: string[][]; dev_cycles: string[][]; wildcard_deps: { pkg: string; dep: string; version: string; }[]; missing_peers: { pkg: string; dep: string; }[]; }logLoggerindentstring''void publishing_plan_logging.ts view source
LogPlanOptions verbosebooleanModulesDetail.svelte view source
reposArray<Repo>nav_footer?Snippetrepos_modulesArray<{
repo: Repo;
modules: Array<unknown>;
}>ModulesPage.svelte view source
reporeposArray<Repo>(current: string, new_version: string): boolean currentstringnew_versionstringboolean (raw_config: RawGitopsConfig): GitopsConfig Transforms a RawGitopsConfig to the more strict GitopsConfig. This allows users to provide a more relaxed config.
raw_configGitopsConfig (version: string): string Normalizes version string for comparison.
Strips prefixes (^, ~, >=) to get bare version number. Handles wildcards as-is. Used by needs_update to compare versions.
versionstringstring NpmOperations NPM registry operations for package availability checks and authentication. Includes exponential backoff for waiting on package propagation.
wait_for_packageWaits for a package version to be available on NPM. Uses exponential backoff with configurable timeout.
(options: {
pkg: string;
version: string;
wait_options?: WaitOptions;
log?: Logger;
}) => Promise<Result<object, {message: string; timeout?: boolean}>>check_package_availableChecks if a package version is available on NPM.
(options: {
pkg: string;
version: string;
log?: Logger;
}) => Promise<Result<{value: boolean}, {message: string}>>check_authChecks npm authentication status.
() => Promise<Result<{username: string}, {message: string}>>check_registryChecks if npm registry is reachable.
() => Promise<Result<object, {message: string}>>installInstalls npm dependencies.
(options?: {
cwd?: string;
}) => Promise<Result<object, {message: string; stderr?: string}>>cache_cleanCleans the npm cache.
Uses npm cache clean --force to clear stale cache entries.
() => Promise<Result<object, {message: string}>>OutputFormat OutputFormatters<T> Tjson(data: T) => stringmarkdown(data: T) => Array<string>stdoutThis function should call log methods directly for colored/styled output.
(data: T, log: Logger) => voidOutputOptions formatoutfilestringlogLogger(pkg: string, options?: { log?: Logger | undefined; }): Promise<boolean> pkgstringoptions{ log?: Logger | undefined; }{}Promise<boolean> PackageInfo namestringversionstringrepo{package_json: PackageJson} | {url: string; package_json: null}nav_attrs?SvelteHTMLElements['nav']attrs?SvelteHTMLElements['header']nav?Snippetchildren?Snippetchangeset_reader.ts view source
(content: string, filename?: string): ChangesetInfo | null Parses changeset content string from markdown format.
Pure function for testability - no file I/O, just string parsing. Extracts package names, bump types, and summary from YAML frontmatter format. Returns null if format is invalid or no packages found.
Expected format: --- "package-name": patch "@scope/package": minor ---
Summary of changes
contentchangeset markdown with YAML frontmatter
stringfilenameoptional filename for error reporting context
string'changeset.md'ChangesetInfo | null parsed changeset info or null if invalid format
changeset_reader.ts view source
(filepath: string, log?: Logger | undefined): Promise<ChangesetInfo | null> filepathstringlog?Logger | undefinedPromise<ChangesetInfo | null> changeset_reader.ts view source
(repo: LocalRepo, log?: Logger | undefined): Promise<{ version: string; bump_type: BumpType; } | null> Predicts the next version by analyzing all changesets in a repo.
Reads all changesets, determines the highest bump type for the package, and calculates the next version. Returns null if no changesets found.
Critical for dry-run mode accuracy - allows simulating publishes without
actually running gro publish which consumes changesets.
repolog?Logger | undefinedPromise<{ version: string; bump_type: BumpType; } | null> predicted version and bump type, or null if no changesets
PreflightOperations Preflight validation operations to ensure repos are ready for publishing. Validates workspace state, branches, builds, and npm authentication.
run_preflight_checksRuns preflight validation checks before publishing.
(options: {
repos: Array<LocalRepo>;
preflight_options: PreflightOptions;
git_ops?: GitOperations;
npm_ops?: NpmOperations;
build_ops?: BuildOperations;
changeset_ops?: ChangesetOperations;
}) => Promise<PreflightResult>preflight_checks.ts view source
PreflightOptions skip_changesetsbooleanskip_build_validationbooleanrequired_branchstringcheck_remotebooleanestimate_timebooleanlogLoggerpreflight_checks.ts view source
PreflightResult okbooleanwarningsArray<string>errorsArray<string>repos_with_changesetsSet<string>repos_without_changesetsSet<string>estimated_durationnumbernpm_usernamestringProcessOperations Process spawning operations for running shell commands.
spawnSpawns a child process and waits for completion.
(options: {
cmd: string;
args: Array<string>;
spawn_options?: SpawnOptions;
}) => Promise<Result<{stdout?: string; stderr?: string}, {message: string; stderr?: string}>>multi_repo_publisher.ts view source
(repos: LocalRepo[], options: PublishingOptions): Promise<PublishingResult> reposLocalRepo[]optionsPromise<PublishingResult> multi_repo_publisher.ts view source
PublishedVersion namestringold_versionstringnew_versionstringbump_type'major' | 'minor' | 'patch'breakingbooleancommitstringtagstringmulti_repo_publisher.ts view source
PublishingOptions dry_runbooleanupdate_depsbooleanversion_strategydeploybooleanmax_waitnumberskip_installbooleanlogLoggeropspublishing_plan.ts view source
PublishingPlan publishing_orderArray<string>version_changesArray<VersionChange>dependency_updatesArray<DependencyUpdate>breaking_cascadesMap<string, Array<string>>warningsArray<string>infoArray<string>errorsArray<string>verbose_datamulti_repo_publisher.ts view source
PublishingResult okbooleanpublishedArray<PublishedVersion>failedArray<{name: string; error: Error}>durationnumberPullRequestMeta repopull_requestPullRequestsDetail.svelte view source
reposArray<Repo>filter_pull_request?FilterPullRequest | undefinedPullRequestsPage.svelte view source
reporeposArray<Repo>filter_pull_request?FilterPullRequest | undefinedRawGitopsConfig reposArray<Url | RawGitopsRepoConfig>repos_dirstringRawGitopsRepoConfig repo_urlUrlrepo_dirstring | nullbranchGitBranchchangeset_reader.ts view source
(repo: LocalRepo, log?: Logger | undefined): Promise<ChangesetInfo[]> repolog?Logger | undefinedPromise<ChangesetInfo[]> Runtime repo with Library composition for package metadata.
Wraps a Library instance and adds GitHub-specific data (CI status, PRs).
Convenience getters delegate to this.library.* for common properties.
librarytype Library
check_runstype GithubCheckRunsItem | null
pull_requeststype Array<GithubPullRequest> | null
constructortype new (repo_json: RepoJson): Repo
repo_jsonRepoJson Serialized repo data as stored in repos.ts (JSON).
library_jsonLibraryJsoncheck_runsGithubCheckRunsItem | nullpull_requestsArray<GithubPullRequest> | nullRepoPath namestringpathstringurlstringRepos reporeposArray<Repo>{ get: (error_message?: string | undefined) => Repos; get_maybe: () => Repos | undefined; set: (value: Repos) => Repos; } (repos: Repo[], homepage_url: string): Repos reposRepo[]homepage_urlstringRepos reposArray<Repo>deps?Array<string>reposArray<Repo>selected_repo?Repo | undefinednavSnippetReposTreeNav.svelte view source
reposArray<Repo>selected_repo?childrenSnippetresolved_gitops_config.ts view source
(gitops_config: GitopsConfig, repos_dir: string): ResolvedGitopsConfig gitops_configrepos_dirstringResolvedGitopsConfig gitops_task_helpers.ts view source
(options: ResolveGitopsPathsOptions): { config_path: string; repos_dir: string; } options{ config_path: string; repos_dir: string; } resolved_gitops_config.ts view source
ResolvedGitopsConfig local_reposArray<LocalRepoPath | LocalRepoMissing> | nulllocal_repo_pathsArray<LocalRepoPath> | nulllocal_repos_missingArray<LocalRepoMissing> | nullgitops_task_helpers.ts view source
ResolveGitopsPathsOptions configstringdirstringconfig_repos_dirstringpreflight_checks.ts view source
({ repos, preflight_options, git_ops, npm_ops, build_ops, changeset_ops, }: RunPreflightChecksOptions): Promise<PreflightResult> Validates all requirements before publishing can proceed.
Performs comprehensive pre-flight validation: - Clean workspaces (100% clean required - no uncommitted changes) - Correct branch (usually main) - Changesets present (unless skip_changesets=true) - Builds successful (fail-fast to prevent broken state) - Git remote reachability - NPM authentication with username - NPM registry connectivity
Build validation runs BEFORE any publishing to prevent the scenario where version is bumped but build fails, leaving repo in broken state.
__0Promise<PreflightResult> result with ok=false if any errors, plus warnings and detailed status
preflight_checks.ts view source
RunPreflightChecksOptions reposArray<LocalRepo>preflight_optionsgit_opsnpm_opsbuild_opschangeset_opsSemver majornumberminornumberpatchnumberprereleasestringbuildstring(version: string, type: BumpType): string Bumps a version according to the specified type. Resets lower version numbers per SemVer spec.
versionstringtypestring (a: string, b: string): number Compares two semver versions according to SemVer 2.0.0 spec. Returns -1 if a < b, 0 if a === b, 1 if a > b. Build metadata is ignored in precedence comparison.
astringbstringnumber serialization_types.ts view source
(graph: DependencyGraph): SerializedGraph Serializes a dependency graph to a JSON-safe format.
graphSerializedGraph serialization_types.ts view source
SerializedGraph nodesArray<SerializedNode>edgesArray<[string, string]>serialization_types.ts view source
SerializedNode namestringversionstringdependenciesArray<{
name: string;
type: string;
version: string;
}>dependentsArray<string>publishablebooleanserialization_types.ts view source
SerializedPublishingPlan publishing_orderArray<string>version_changesArray<{
package_name: string;
from: string;
to: string;
bump_type: string;
breaking: boolean;
has_changesets: boolean;
will_generate_changeset?: boolean;
needs_bump_escalation?: boolean;
existing_bump?: string;
required_bump?: string;
}>dependency_updatesArray<{
dependent_package: string;
updated_dependency: string;
new_version: string;
type: string;
causes_republish: boolean;
}>breaking_cascadesRecord<string, Array<string>>warningsArray<string>errorsArray<string>(file_path: string, options?: WalkOptions | undefined): boolean Check if a path should be excluded based on options.
file_pathstringoptions?WalkOptions | undefinedboolean (version: string): string Strips version prefix (^, ~, >=, <=, etc) from a version string.
versionstringstring reporeposArray<Repo>gitops_run.task.ts view source
Task<{ command: string; config: string; concurrency: number; format: "json" | "text"; }, ZodType<Args, Args, $ZodTypeInternals<Args, Args>>, unknown> (repos: Repo[], filter_pull_request?: FilterPullRequest | undefined): PullRequestMeta[] reposRepo[]filter_pull_request?FilterPullRequest | undefinedPullRequestMeta[] (repo_url: string, pull: { number: number; title: string; user: { login: string; }; draft: boolean; }): string repo_urlstringpull{ number: number; title: string; user: { login: string; }; draft: boolean; }string TreeItemPage.svelte view source
reporeposArray<Repo>slugstringreporeposArray<Repo>dependency_updater.ts view source
(repos: LocalRepo[], published: Map<string, string>, options?: UpdateAllReposOptions): Promise<{ updated: number; failed: { repo: string; error: Error; }[]; }> reposLocalRepo[]publishedMap<string, string>options{}Promise<{ updated: number; failed: { repo: string; error: Error; }[]; }> dependency_updater.ts view source
(repo: LocalRepo, updates: Map<string, string>, options?: UpdatePackageJsonOptions): Promise<void> Updates package.json dependencies and creates changeset if needed.
Workflow: 1. Updates all dependency types (dependencies, devDependencies, peerDependencies) 2. Writes updated package.json with tabs formatting 3. Creates auto-changeset if published_versions provided (for transitive updates) 4. Commits both package.json and changeset with standard message
Uses version strategy to determine prefix (exact, caret, tilde) while preserving existing prefixes when possible.
repoupdatesMap<string, string>options{}Promise<void> if - file operations or git operations faildependency_updater.ts view source
UpdateAllReposOptions strategylogLoggergit_opsfs_opsdependency_updater.ts view source
UpdatePackageJsonOptions strategypublished_versionsMap<string, PublishedVersion>logLoggergit_opsfs_opsgraph_validation.ts view source
(repos: LocalRepo[], options?: { log?: Logger | undefined; throw_on_prod_cycles?: boolean | undefined; log_cycles?: boolean | undefined; log_order?: boolean | undefined; }): GraphValidationResult Shared utility for building dependency graph, detecting cycles, and computing publishing order. This centralizes logic that was duplicated across multi_repo_publisher, publishing_plan, and gitops_analyze.
reposLocalRepo[]options{ log?: Logger | undefined; throw_on_prod_cycles?: boolean | undefined; log_cycles?: boolean | undefined; log_order?: boolean | undefined; }{}GraphValidationResult graph validation result with graph, publishing order, and detected cycles
if - production cycles detected and throw_on_prod_cycles is true(config_module: any, config_path: string): asserts config_module is GitopsConfigModule config_moduleanyconfig_pathstringvoid publishing_plan.ts view source
VerboseChangesetDetail package_namestringfilesArray<{filename: string; bump_type: BumpType; summary: string}>publishing_plan.ts view source
VerboseData changeset_detailsArray<VerboseChangesetDetail>iterationsArray<VerboseIteration>propagation_chainsArray<VerbosePropagationChain>graph_summarytotal_iterationsnumberpublishing_plan.ts view source
VerboseGraphSummary package_countnumberinternal_dep_countnumberprod_peer_edgesArray<{from: string; to: string; type: 'prod' | 'peer'}>dev_edgesArray<{from: string; to: string}>prod_cycle_countnumberdev_cycle_countnumberpublishing_plan.ts view source
VerboseIteration iterationnumberpackagesArray<VerboseIterationPackage>new_changesnumberpublishing_plan.ts view source
VerboseIterationPackage namestringchangeset_countnumberbump_from_changesetsBumpType | nullrequired_bumpBumpType | nulltriggering_depstring | nullaction'publish' | 'auto_changeset' | 'escalation' | 'skip'version_tostring | nullis_breakingbooleanpublishing_plan.ts view source
VerbosePropagationChain sourcestringchainArray<{pkg: string; dep_type: 'prod' | 'peer'; action: string}>publishing_plan.ts view source
VersionChange package_namestringfromstringtostringbump_typebreakingbooleanhas_changesetsbooleanwill_generate_changesetbooleanneeds_bump_escalationbooleanexisting_bumprequired_bumpdependency_updater.ts view source
VersionStrategy (pkg: string, version: string, options?: WaitOptions): Promise<void> Waits for package version to propagate to NPM registry.
Uses exponential backoff with jitter to avoid hammering registry. Logs progress every 5 attempts. Respects timeout to avoid infinite waits.
Critical for multi-repo publishing: ensures published packages are available before updating dependent packages.
pkgstringversionstringoptions{}Promise<void> if - timeout reached or max attempts exceededWaitOptions logLoggermax_attemptsnumberinitial_delaynumbermax_delaynumbertimeoutnumber(dir: string, options?: WalkOptions | undefined): AsyncGenerator<string, void, undefined> Walk files in a directory, respecting common exclusions. Yields absolute paths to files (and optionally directories).
dirDirectory to walk
stringoptions?Walk options for exclusions and filtering
WalkOptions | undefinedAsyncGenerator<string, void, undefined> WalkOptions exclude_dirsAdditional directories to exclude (merged with defaults)
Array<string>exclude_extensionsAdditional extensions to exclude (merged with defaults)
Array<string>max_file_sizeMaximum file size in bytes (default: 10MB)
numberinclude_dirsInclude directories in output (default: false)
booleanno_defaultsUse only provided exclusions, ignoring defaults
boolean