@aspruyt/xfg 4.0.5 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli/program.d.ts +3 -0
- package/dist/cli/program.js +18 -13
- package/dist/cli/sync-command.js +63 -39
- package/dist/cli/sync-report-builder.js +7 -4
- package/dist/cli/types.d.ts +1 -0
- package/dist/config/formatter.js +14 -9
- package/dist/config/merge.d.ts +2 -4
- package/dist/config/merge.js +15 -67
- package/dist/config/validator.js +2 -9
- package/dist/lifecycle/repo-lifecycle-factory.js +0 -4
- package/dist/output/github-summary.d.ts +3 -2
- package/dist/output/github-summary.js +1 -7
- package/dist/output/lifecycle-report.js +7 -14
- package/dist/output/sync-report.d.ts +2 -19
- package/dist/output/sync-report.js +16 -28
- package/dist/output/types.d.ts +19 -0
- package/dist/output/types.js +1 -0
- package/dist/output/unified-summary.d.ts +2 -1
- package/dist/output/unified-summary.js +4 -1
- package/dist/settings/base-processor.d.ts +3 -1
- package/dist/settings/base-processor.js +9 -5
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/labels/diff.d.ts +2 -1
- package/dist/settings/labels/formatter.js +2 -4
- package/dist/settings/labels/github-labels-strategy.js +2 -1
- package/dist/settings/labels/processor.js +0 -1
- package/dist/settings/repo-settings/github-repo-settings-strategy.js +2 -1
- package/dist/settings/rulesets/diff-algorithm.js +0 -1
- package/dist/settings/rulesets/diff.d.ts +2 -1
- package/dist/settings/rulesets/diff.js +37 -21
- package/dist/settings/rulesets/formatter.js +44 -38
- package/dist/settings/rulesets/github-ruleset-strategy.js +2 -1
- package/dist/settings/rulesets/processor.js +0 -1
- package/dist/shared/gh-api-utils.d.ts +8 -7
- package/dist/shared/gh-api-utils.js +2 -16
- package/dist/shared/interpolation-engine.d.ts +3 -0
- package/dist/shared/interpolation-engine.js +0 -3
- package/dist/shared/json-utils.d.ts +6 -0
- package/dist/shared/json-utils.js +16 -0
- package/dist/shared/repo-detector.js +0 -4
- package/dist/shared/xfg-template.d.ts +3 -0
- package/dist/shared/xfg-template.js +0 -20
- package/dist/sync/auth-options-builder.js +7 -1
- package/dist/sync/branch-manager.d.ts +1 -1
- package/dist/sync/commit-message.d.ts +1 -1
- package/dist/sync/commit-push-manager.d.ts +1 -1
- package/dist/sync/commit-push-manager.js +2 -2
- package/dist/sync/diff-utils.d.ts +15 -2
- package/dist/sync/diff-utils.js +50 -14
- package/dist/sync/file-sync-orchestrator.js +2 -4
- package/dist/sync/file-sync-strategy.js +11 -4
- package/dist/sync/file-writer.js +9 -4
- package/dist/sync/index.d.ts +2 -1
- package/dist/sync/index.js +1 -0
- package/dist/sync/manifest-manager.d.ts +1 -1
- package/dist/sync/manifest-manager.js +20 -6
- package/dist/sync/pr-merge-handler.js +6 -1
- package/dist/sync/repository-processor.js +8 -1
- package/dist/sync/types.d.ts +5 -4
- package/dist/vcs/authenticated-git-ops.d.ts +9 -1
- package/dist/vcs/authenticated-git-ops.js +7 -14
- package/dist/vcs/git-ops.js +29 -12
- package/dist/vcs/github-pr-strategy.js +6 -1
- package/dist/vcs/gitlab-pr-strategy.js +7 -2
- package/dist/vcs/graphql-commit-strategy.js +2 -1
- package/dist/vcs/index.d.ts +1 -0
- package/dist/vcs/index.js +2 -0
- package/dist/vcs/pr-creator.d.ts +5 -1
- package/dist/vcs/pr-creator.js +4 -4
- package/package.json +1 -1
- package/dist/output/index.d.ts +0 -5
- package/dist/output/index.js +0 -10
- package/dist/shared/index.d.ts +0 -15
- package/dist/shared/index.js +0 -30
|
@@ -5,7 +5,7 @@ import { assertGitLabRepo } from "../shared/repo-detector.js";
|
|
|
5
5
|
import { BasePRStrategy } from "./pr-strategy.js";
|
|
6
6
|
import { withRetry, isPermanentError } from "../shared/retry-utils.js";
|
|
7
7
|
import { getStderr } from "../shared/command-executor.js";
|
|
8
|
-
import { parseApiJson } from "../shared/
|
|
8
|
+
import { parseApiJson } from "../shared/json-utils.js";
|
|
9
9
|
import { sanitizeCredentials } from "../shared/sanitize-utils.js";
|
|
10
10
|
import { toErrorMessage, safeCleanup } from "../shared/type-guards.js";
|
|
11
11
|
import { NO_OP_DEBUG_LOG } from "../shared/logger.js";
|
|
@@ -146,7 +146,12 @@ export class GitLabPRStrategy extends BasePRStrategy {
|
|
|
146
146
|
assertGitLabRepo(repoInfo, "GitLab PR strategy");
|
|
147
147
|
const repoFlag = this.getRepoFlag(repoInfo);
|
|
148
148
|
const descFile = join(workDir, this.bodyFilePath);
|
|
149
|
-
|
|
149
|
+
try {
|
|
150
|
+
writeFileSync(descFile, body, "utf-8");
|
|
151
|
+
}
|
|
152
|
+
catch (err) {
|
|
153
|
+
throw new SyncError(`Failed to write PR description to ${descFile}: ${toErrorMessage(err)}`);
|
|
154
|
+
}
|
|
150
155
|
// glab mr create with description from file
|
|
151
156
|
const command = `glab mr create --source-branch ${escapeShellArg(branchName)} --target-branch ${escapeShellArg(baseBranch)} --title ${escapeShellArg(title)} --description "$(cat ${escapeShellArg(descFile)})" --yes -R ${escapeShellArg(repoFlag)}`;
|
|
152
157
|
try {
|
|
@@ -2,7 +2,8 @@ import { isGitHubRepo } from "../shared/repo-detector.js";
|
|
|
2
2
|
import { escapeShellArg } from "../shared/shell-utils.js";
|
|
3
3
|
import { withRetry, CORE_PERMANENT_ERROR_PATTERNS, DEFAULT_PERMANENT_ERROR_PATTERNS, } from "../shared/retry-utils.js";
|
|
4
4
|
import { toErrorMessage } from "../shared/type-guards.js";
|
|
5
|
-
import { parseApiJson
|
|
5
|
+
import { parseApiJson } from "../shared/json-utils.js";
|
|
6
|
+
import { buildTokenEnv } from "../shared/gh-api-utils.js";
|
|
6
7
|
import { ValidationError, GraphQLApiError } from "../shared/errors.js";
|
|
7
8
|
/**
|
|
8
9
|
* Maximum payload size for GitHub GraphQL API (50MB).
|
package/dist/vcs/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export type { PRMergeConfig, FileChange, FileAction, IGitOps, ILocalGitOps, INet
|
|
|
2
2
|
export type { GitOpsOptions } from "./git-ops.js";
|
|
3
3
|
export { getCommitStrategy, createTokenManager, } from "./commit-strategy-selector.js";
|
|
4
4
|
export { getPRStrategy } from "./pr-strategy-factory.js";
|
|
5
|
+
export { createPR, mergePR } from "./pr-creator.js";
|
package/dist/vcs/index.js
CHANGED
package/dist/vcs/pr-creator.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RepoInfo } from "../shared/repo-detector.js";
|
|
2
2
|
import type { IPRStrategyLogger } from "./pr-strategy.js";
|
|
3
|
-
import type { FileAction, MergeResult, PRMergeConfig, PRResult } from "./types.js";
|
|
3
|
+
import type { FileAction, IPRStrategy, MergeResult, PRMergeConfig, PRResult } from "./types.js";
|
|
4
4
|
import { ICommandExecutor } from "../shared/command-executor.js";
|
|
5
5
|
export type { FileAction };
|
|
6
6
|
interface PROptions {
|
|
@@ -22,6 +22,8 @@ interface PROptions {
|
|
|
22
22
|
labels?: string[];
|
|
23
23
|
/** Optional logger for PR strategy debug/warn/info messages */
|
|
24
24
|
log?: IPRStrategyLogger;
|
|
25
|
+
/** Pre-constructed PR strategy to reuse (avoids redundant instantiation) */
|
|
26
|
+
strategy?: IPRStrategy;
|
|
25
27
|
}
|
|
26
28
|
export type { PRResult } from "./types.js";
|
|
27
29
|
/**
|
|
@@ -53,5 +55,7 @@ interface MergePROptions {
|
|
|
53
55
|
token?: string;
|
|
54
56
|
/** Optional logger for PR strategy debug/warn/info messages */
|
|
55
57
|
log?: IPRStrategyLogger;
|
|
58
|
+
/** Pre-constructed PR strategy to reuse (avoids redundant instantiation) */
|
|
59
|
+
strategy?: IPRStrategy;
|
|
56
60
|
}
|
|
57
61
|
export declare function mergePR(options: MergePROptions): Promise<MergeResult>;
|
package/dist/vcs/pr-creator.js
CHANGED
|
@@ -106,8 +106,8 @@ export async function createPR(options) {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
// Get the appropriate strategy and execute via workflow executor
|
|
109
|
-
const
|
|
110
|
-
const workflow = new PRWorkflowExecutor(
|
|
109
|
+
const resolvedStrategy = options.strategy ?? getPRStrategy(repoInfo, executor, log);
|
|
110
|
+
const workflow = new PRWorkflowExecutor(resolvedStrategy);
|
|
111
111
|
return workflow.execute({
|
|
112
112
|
repoInfo,
|
|
113
113
|
title,
|
|
@@ -135,8 +135,8 @@ export async function mergePR(options) {
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
// Get the appropriate strategy and execute merge
|
|
138
|
-
const
|
|
139
|
-
return
|
|
138
|
+
const resolvedStrategy = options.strategy ?? getPRStrategy(repoInfo, executor, log);
|
|
139
|
+
return resolvedStrategy.merge({
|
|
140
140
|
prUrl,
|
|
141
141
|
repoInfo,
|
|
142
142
|
config: mergeConfig,
|
package/package.json
CHANGED
package/dist/output/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { formatSyncReportCLI, formatSyncReportMarkdown, writeSyncReportSummary, type SyncReport, type RepoFileChanges, type ReportFileChange, } from "./sync-report.js";
|
|
2
|
-
export { formatSettingsReportCLI, formatSettingsReportMarkdown, writeSettingsReportSummary, type SettingsReport, type RepoChanges, type RulesetChange, type SettingChange, } from "./settings-report.js";
|
|
3
|
-
export { formatUnifiedSummaryMarkdown, writeUnifiedSummary, } from "./unified-summary.js";
|
|
4
|
-
export { formatSummary, shouldWriteSummary, writeSummary, type MergeOutcome, type FileChanges, type RulesetPlanDetail, type RepoSettingsPlanDetail, type RepoResult, type SummaryData, } from "./github-summary.js";
|
|
5
|
-
export { getMergeOutcome, toFileChanges, buildRepoResult, buildErrorResult, } from "./summary-utils.js";
|
package/dist/output/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Sync report (repo-grouped file changes)
|
|
2
|
-
export { formatSyncReportCLI, formatSyncReportMarkdown, writeSyncReportSummary, } from "./sync-report.js";
|
|
3
|
-
// Settings report (repo-grouped settings changes)
|
|
4
|
-
export { formatSettingsReportCLI, formatSettingsReportMarkdown, writeSettingsReportSummary, } from "./settings-report.js";
|
|
5
|
-
// Unified summary (lifecycle + sync + settings in one diff block)
|
|
6
|
-
export { formatUnifiedSummaryMarkdown, writeUnifiedSummary, } from "./unified-summary.js";
|
|
7
|
-
// GitHub Actions summary
|
|
8
|
-
export { formatSummary, shouldWriteSummary, writeSummary, } from "./github-summary.js";
|
|
9
|
-
// Summary utilities
|
|
10
|
-
export { getMergeOutcome, toFileChanges, buildRepoResult, buildErrorResult, } from "./summary-utils.js";
|
package/dist/shared/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { Logger, NO_OP_DEBUG_LOG, type ILogger, type DebugLog, type DebugWarnLog, type DebugInfoLog, type DebugInfoWarnLog, } from "./logger.js";
|
|
2
|
-
export { withRetry, isPermanentError, isTransientError, DEFAULT_PERMANENT_ERROR_PATTERNS, } from "./retry-utils.js";
|
|
3
|
-
export { ShellCommandExecutor, type ICommandExecutor, } from "./command-executor.js";
|
|
4
|
-
export { escapeShellArg, escapeRegExp } from "./shell-utils.js";
|
|
5
|
-
export { sanitizeCredentials } from "./sanitize-utils.js";
|
|
6
|
-
export { interpolateEnvVars, interpolateContent, type EnvInterpolationOptions, } from "./env.js";
|
|
7
|
-
export { generateWorkspaceName } from "./workspace-utils.js";
|
|
8
|
-
export { detectRepoType, parseGitUrl, getRepoDisplayName, isGitHubRepo, isAzureDevOpsRepo, isGitLabRepo, type RepoInfo, type GitHubRepoInfo, type AzureDevOpsRepoInfo, type GitLabRepoInfo, } from "./repo-detector.js";
|
|
9
|
-
export { ValidationError, GraphQLApiError, SyncError, LifecycleError, } from "./errors.js";
|
|
10
|
-
export { formatStatusBadge, type FileStatus } from "./file-status.js";
|
|
11
|
-
export { GhApiClient, getHostnameFlag, buildTokenEnv, resolveGitHubToken, isHttp404Error, parseApiJson, type GhApiOptions, } from "./gh-api-utils.js";
|
|
12
|
-
export { interpolateString, interpolateValue, type InterpolationConfig, } from "./interpolation-engine.js";
|
|
13
|
-
export { camelToSnake } from "./string-utils.js";
|
|
14
|
-
export { isPlainObject, toErrorMessage, safeCleanup } from "./type-guards.js";
|
|
15
|
-
export { interpolateXfgContent, type XfgTemplateContext, } from "./xfg-template.js";
|
package/dist/shared/index.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Logging
|
|
2
|
-
export { Logger, NO_OP_DEBUG_LOG, } from "./logger.js";
|
|
3
|
-
// Retry utilities
|
|
4
|
-
export { withRetry, isPermanentError, isTransientError, DEFAULT_PERMANENT_ERROR_PATTERNS, } from "./retry-utils.js";
|
|
5
|
-
// Command execution
|
|
6
|
-
export { ShellCommandExecutor, } from "./command-executor.js";
|
|
7
|
-
// Shell utilities
|
|
8
|
-
export { escapeShellArg, escapeRegExp } from "./shell-utils.js";
|
|
9
|
-
// Sanitization
|
|
10
|
-
export { sanitizeCredentials } from "./sanitize-utils.js";
|
|
11
|
-
// Environment
|
|
12
|
-
export { interpolateEnvVars, interpolateContent, } from "./env.js";
|
|
13
|
-
// Workspace utilities
|
|
14
|
-
export { generateWorkspaceName } from "./workspace-utils.js";
|
|
15
|
-
// Repository detection
|
|
16
|
-
export { detectRepoType, parseGitUrl, getRepoDisplayName, isGitHubRepo, isAzureDevOpsRepo, isGitLabRepo, } from "./repo-detector.js";
|
|
17
|
-
// Errors
|
|
18
|
-
export { ValidationError, GraphQLApiError, SyncError, LifecycleError, } from "./errors.js";
|
|
19
|
-
// File status
|
|
20
|
-
export { formatStatusBadge } from "./file-status.js";
|
|
21
|
-
// GitHub API utilities
|
|
22
|
-
export { GhApiClient, getHostnameFlag, buildTokenEnv, resolveGitHubToken, isHttp404Error, parseApiJson, } from "./gh-api-utils.js";
|
|
23
|
-
// Interpolation engine
|
|
24
|
-
export { interpolateString, interpolateValue, } from "./interpolation-engine.js";
|
|
25
|
-
// String utilities
|
|
26
|
-
export { camelToSnake } from "./string-utils.js";
|
|
27
|
-
// Type guards
|
|
28
|
-
export { isPlainObject, toErrorMessage, safeCleanup } from "./type-guards.js";
|
|
29
|
-
// XFG templating
|
|
30
|
-
export { interpolateXfgContent, } from "./xfg-template.js";
|