@aspruyt/xfg 6.0.3 → 6.2.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/dist/cli/lifecycle-report-builder.d.ts +2 -2
- package/dist/cli/lifecycle-report-builder.js +3 -11
- package/dist/cli/program.d.ts +2 -1
- package/dist/cli/program.js +2 -3
- package/dist/cli/repo-sync-runner.d.ts +24 -0
- package/dist/cli/repo-sync-runner.js +156 -0
- package/dist/cli/results-collector.d.ts +1 -1
- package/dist/cli/results-collector.js +2 -2
- package/dist/cli/settings-factories.d.ts +7 -0
- package/dist/cli/settings-factories.js +27 -0
- package/dist/cli/settings-report-builder.d.ts +1 -1
- package/dist/cli/settings-report-builder.js +12 -23
- package/dist/cli/settings-runner.d.ts +2 -0
- package/dist/cli/settings-runner.js +87 -0
- package/dist/cli/sync-command.d.ts +1 -1
- package/dist/cli/sync-command.js +31 -372
- package/dist/cli/sync-report-builder.d.ts +1 -1
- package/dist/cli/sync-utils.d.ts +8 -0
- package/dist/cli/sync-utils.js +36 -0
- package/dist/cli/types.d.ts +5 -7
- package/dist/cli/unified-summary.d.ts +1 -3
- package/dist/cli/unified-summary.js +7 -5
- package/dist/cli.js +2 -1
- package/dist/{shared → config}/env.js +2 -2
- package/dist/config/extends-resolver.js +4 -3
- package/dist/config/file-reference-resolver.js +4 -2
- package/dist/config/formatter.js +18 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/loader.js +30 -6
- package/dist/config/merge.d.ts +11 -1
- package/dist/config/merge.js +78 -6
- package/dist/config/normalizer.js +53 -38
- package/dist/config/validator.d.ts +1 -4
- package/dist/config/validator.js +13 -599
- package/dist/config/validators/file-validator.d.ts +2 -1
- package/dist/config/validators/file-validator.js +9 -1
- package/dist/config/validators/group-validator.d.ts +3 -0
- package/dist/config/validators/group-validator.js +167 -0
- package/dist/config/validators/repo-entry-validator.d.ts +2 -0
- package/dist/config/validators/repo-entry-validator.js +165 -0
- package/dist/config/validators/repo-settings-validator.js +18 -7
- package/dist/config/validators/ruleset-validator.js +2 -5
- package/dist/config/validators/shared.d.ts +11 -0
- package/dist/config/validators/shared.js +242 -0
- package/dist/lifecycle/ado-migration-source.js +2 -4
- package/dist/lifecycle/github-lifecycle-provider.d.ts +7 -11
- package/dist/lifecycle/github-lifecycle-provider.js +125 -136
- package/dist/lifecycle/{lifecycle-helpers.d.ts → helpers.d.ts} +5 -1
- package/dist/lifecycle/{lifecycle-helpers.js → helpers.js} +9 -8
- package/dist/lifecycle/index.d.ts +2 -2
- package/dist/lifecycle/index.js +1 -1
- package/dist/lifecycle/repo-lifecycle-factory.d.ts +2 -2
- package/dist/output/github-summary.js +2 -3
- package/dist/output/index.d.ts +4 -0
- package/dist/output/index.js +4 -0
- package/dist/output/lifecycle-report.d.ts +1 -1
- package/dist/output/lifecycle-report.js +5 -0
- package/dist/output/sync-report.d.ts +25 -3
- package/dist/output/sync-report.js +11 -11
- package/dist/settings/base-processor.d.ts +18 -7
- package/dist/settings/base-processor.js +26 -5
- package/dist/settings/code-scanning/diff.js +2 -2
- package/dist/settings/code-scanning/formatter.d.ts +2 -6
- package/dist/settings/code-scanning/formatter.js +2 -25
- package/dist/settings/code-scanning/github-code-scanning-strategy.d.ts +3 -7
- package/dist/settings/code-scanning/github-code-scanning-strategy.js +2 -2
- package/dist/settings/code-scanning/processor.js +6 -4
- package/dist/settings/code-scanning/types.d.ts +10 -8
- package/dist/settings/labels/github-labels-strategy.d.ts +3 -11
- package/dist/settings/labels/types.d.ts +12 -10
- package/dist/settings/repo-settings/diff.d.ts +1 -1
- package/dist/settings/repo-settings/diff.js +1 -1
- package/dist/settings/repo-settings/formatter.d.ts +2 -6
- package/dist/settings/repo-settings/formatter.js +4 -23
- package/dist/settings/repo-settings/github-repo-settings-strategy.d.ts +2 -2
- package/dist/settings/repo-settings/github-repo-settings-strategy.js +8 -7
- package/dist/settings/repo-settings/processor.js +11 -11
- package/dist/settings/repo-settings/types.d.ts +2 -2
- package/dist/settings/rulesets/diff-algorithm.js +4 -2
- package/dist/settings/rulesets/diff.js +2 -51
- package/dist/settings/rulesets/formatter.js +4 -0
- package/dist/settings/rulesets/github-ruleset-strategy.d.ts +3 -3
- package/dist/settings/rulesets/github-ruleset-strategy.js +4 -6
- package/dist/settings/rulesets/index.d.ts +1 -1
- package/dist/settings/rulesets/index.js +0 -2
- package/dist/settings/rulesets/processor.js +1 -1
- package/dist/settings/rulesets/types.d.ts +6 -2
- package/dist/shared/command-executor.d.ts +4 -4
- package/dist/shared/command-executor.js +9 -7
- package/dist/shared/diff-format.d.ts +1 -0
- package/dist/shared/diff-format.js +10 -0
- package/dist/shared/errors.d.ts +7 -4
- package/dist/shared/errors.js +8 -8
- package/dist/shared/gh-api-utils.d.ts +3 -34
- package/dist/shared/gh-api-utils.js +23 -53
- package/dist/shared/gh-token-utils.d.ts +26 -0
- package/dist/shared/gh-token-utils.js +32 -0
- package/dist/shared/json-utils.js +1 -1
- package/dist/shared/regex-utils.d.ts +1 -0
- package/dist/shared/regex-utils.js +3 -0
- package/dist/shared/retry-utils.d.ts +1 -0
- package/dist/shared/retry-utils.js +13 -7
- package/dist/sync/auth-options-builder.js +1 -1
- package/dist/sync/branch-manager.js +5 -3
- package/dist/sync/commit-push-manager.js +2 -3
- package/dist/sync/diff-utils.d.ts +0 -1
- package/dist/sync/diff-utils.js +5 -10
- package/dist/sync/file-sync-orchestrator.js +0 -2
- package/dist/sync/file-writer.d.ts +3 -0
- package/dist/sync/file-writer.js +84 -81
- package/dist/sync/index.d.ts +0 -1
- package/dist/sync/index.js +0 -1
- package/dist/sync/manifest.js +1 -1
- package/dist/sync/pr-merge-handler.js +6 -6
- package/dist/sync/sync-workflow.js +1 -1
- package/dist/sync/types.d.ts +2 -2
- package/dist/vcs/ado-pr-strategy.d.ts +3 -5
- package/dist/vcs/ado-pr-strategy.js +131 -33
- package/dist/vcs/authenticated-git-ops.js +45 -23
- package/dist/vcs/git-commit-strategy.js +10 -6
- package/dist/vcs/git-ops.js +30 -24
- package/dist/vcs/github-pr-strategy.d.ts +3 -2
- package/dist/vcs/github-pr-strategy.js +80 -30
- package/dist/vcs/gitlab-pr-strategy.d.ts +2 -5
- package/dist/vcs/gitlab-pr-strategy.js +88 -87
- package/dist/vcs/graphql-commit-strategy.d.ts +1 -5
- package/dist/vcs/graphql-commit-strategy.js +21 -37
- package/dist/vcs/pr-creator.js +9 -2
- package/dist/vcs/pr-strategy.d.ts +2 -3
- package/dist/vcs/pr-strategy.js +0 -1
- package/dist/vcs/types.d.ts +9 -5
- package/package.json +5 -5
- package/dist/config/validators/index.d.ts +0 -3
- package/dist/config/validators/index.js +0 -6
- package/dist/output/types.d.ts +0 -20
- package/dist/output/types.js +0 -1
- package/dist/shared/shell-utils.d.ts +0 -6
- package/dist/shared/shell-utils.js +0 -17
- /package/dist/{shared → config}/env.d.ts +0 -0
- /package/dist/lifecycle/{lifecycle-formatter.d.ts → formatter.d.ts} +0 -0
- /package/dist/lifecycle/{lifecycle-formatter.js → formatter.js} +0 -0
- /package/dist/{vcs → shared}/sanitize-utils.d.ts +0 -0
- /package/dist/{vcs → shared}/sanitize-utils.js +0 -0
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import type { DebugWarnLog } from "../shared/logger.js";
|
|
2
2
|
import type { PRResult } from "./types.js";
|
|
3
3
|
import type { ICommandExecutor } from "../shared/command-executor.js";
|
|
4
|
-
import type { MergeResult, PRStrategyOptions, MergeOptions, CloseExistingPROptions, IPRStrategy } from "./types.js";
|
|
4
|
+
import type { MergeResult, PRStrategyOptions, MergeOptions, CloseExistingPROptions, ClosePRResult, IPRStrategy } from "./types.js";
|
|
5
5
|
export interface IPRStrategyLogger {
|
|
6
6
|
debug(msg: string): void;
|
|
7
7
|
warn(msg: string): void;
|
|
8
8
|
info(msg: string): void;
|
|
9
9
|
}
|
|
10
10
|
export declare abstract class BasePRStrategy implements IPRStrategy {
|
|
11
|
-
protected bodyFilePath: string;
|
|
12
11
|
protected executor: ICommandExecutor;
|
|
13
12
|
protected log?: IPRStrategyLogger;
|
|
14
13
|
constructor(executor: ICommandExecutor, log?: IPRStrategyLogger);
|
|
15
14
|
abstract findExistingPRUrl(options: CloseExistingPROptions): Promise<string | null>;
|
|
16
|
-
abstract closeExistingPR(options: CloseExistingPROptions): Promise<
|
|
15
|
+
abstract closeExistingPR(options: CloseExistingPROptions): Promise<ClosePRResult>;
|
|
17
16
|
abstract create(options: PRStrategyOptions): Promise<PRResult>;
|
|
18
17
|
abstract merge(options: MergeOptions): Promise<MergeResult>;
|
|
19
18
|
/**
|
package/dist/vcs/pr-strategy.js
CHANGED
package/dist/vcs/types.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { RepoInfo } from "../repo/index.js";
|
|
2
2
|
import type { MergeMode, MergeStrategy } from "../config/index.js";
|
|
3
|
+
export type ClosePRResult = {
|
|
4
|
+
status: "no_pr";
|
|
5
|
+
} | {
|
|
6
|
+
status: "closed";
|
|
7
|
+
} | {
|
|
8
|
+
status: "close_failed";
|
|
9
|
+
message: string;
|
|
10
|
+
};
|
|
3
11
|
export interface GitAuthOptions {
|
|
4
12
|
token: string;
|
|
5
13
|
/** e.g., "github.com", "github.mycompany.com" */
|
|
@@ -125,11 +133,7 @@ export interface IPRStrategy {
|
|
|
125
133
|
* @returns PR URL if exists, null if not found or on error
|
|
126
134
|
*/
|
|
127
135
|
findExistingPRUrl(options: CloseExistingPROptions): Promise<string | null>;
|
|
128
|
-
|
|
129
|
-
* Close an existing PR and delete its branch.
|
|
130
|
-
* @returns true if PR was closed, false if no PR existed
|
|
131
|
-
*/
|
|
132
|
-
closeExistingPR(options: CloseExistingPROptions): Promise<boolean>;
|
|
136
|
+
closeExistingPR(options: CloseExistingPROptions): Promise<ClosePRResult>;
|
|
133
137
|
/**
|
|
134
138
|
* Create a new PR. Throws on infrastructure failures; PRWorkflowExecutor
|
|
135
139
|
* catches and converts to PRResult.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aspruyt/xfg",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Manage files, settings, and repositories across GitHub, Azure DevOps, and GitLab — declaratively, from a single YAML config",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"url": "https://github.com/anthony-spruyt/xfg/issues"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
32
|
+
"node": ">=22"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"build": "tsc",
|
|
36
36
|
"start": "node dist/cli.js",
|
|
37
37
|
"dev": "tsx src/cli.ts",
|
|
38
38
|
"test": "node --import tsx scripts/run-tests.js",
|
|
39
|
-
"test:coverage": "c8 --check-coverage --lines 95 --reporter=text --reporter=lcov --all --src=src --exclude='test/**/*.test.ts' --exclude='scripts/**' --exclude='src/vcs/types.ts' --exclude='src/settings/rulesets/types.ts' --exclude='src/settings/repo-settings/types.ts' --exclude='src/settings/labels/types.ts' --exclude='src/**/index.ts' --exclude='test/mocks/**' --exclude='src/sync/types.ts' --exclude='src/lifecycle/types.ts' --exclude='src/cli/program.ts' --exclude='src/cli.ts' --exclude='src/index.ts' npm test",
|
|
39
|
+
"test:coverage": "c8 --check-coverage --lines 95 --reporter=text --reporter=lcov --all --src=src --exclude='test/**/*.test.ts' --exclude='scripts/**' --exclude='src/vcs/types.ts' --exclude='src/settings/rulesets/types.ts' --exclude='src/settings/repo-settings/types.ts' --exclude='src/settings/labels/types.ts' --exclude='src/**/index.ts' --exclude='test/mocks/**' --exclude='src/sync/types.ts' --exclude='src/lifecycle/types.ts' --exclude='src/cli/program.ts' --exclude='src/cli/types.ts' --exclude='src/cli.ts' --exclude='src/index.ts' npm test",
|
|
40
40
|
"test:integration:github": "npm run build && node --import tsx --test test/integration/github.test.ts",
|
|
41
41
|
"test:integration:ado": "npm run build && node --import tsx --test test/integration/ado.test.ts",
|
|
42
42
|
"test:integration:gitlab": "npm run build && node --import tsx --test test/integration/gitlab.test.ts",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"chalk": "^5.3.0",
|
|
75
75
|
"commander": "^14.0.2",
|
|
76
76
|
"json5": "^2.2.3",
|
|
77
|
-
"p-retry": "^
|
|
77
|
+
"p-retry": "^8.0.0",
|
|
78
78
|
"yaml": "^2.4.5"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
@@ -82,6 +82,6 @@
|
|
|
82
82
|
"bottleneck": "^2.19.5",
|
|
83
83
|
"c8": "^11.0.0",
|
|
84
84
|
"tsx": "^4.15.0",
|
|
85
|
-
"typescript": "^
|
|
85
|
+
"typescript": "^6.0.0"
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// File validation
|
|
2
|
-
export { isTextContent, isObjectContent, isStructuredFileExtension, validateFileName, VALID_STRATEGIES, } from "./file-validator.js";
|
|
3
|
-
// Repo settings validation
|
|
4
|
-
export { validateRepoSettings } from "./repo-settings-validator.js";
|
|
5
|
-
// Ruleset validation
|
|
6
|
-
export { validateRuleset } from "./ruleset-validator.js";
|
package/dist/output/types.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { MergeMode } from "../config/index.js";
|
|
2
|
-
import type { FileChangeDetail } from "../sync/index.js";
|
|
3
|
-
export type ReportFileChange = FileChangeDetail;
|
|
4
|
-
export interface SyncReport {
|
|
5
|
-
repos: RepoFileChanges[];
|
|
6
|
-
totals: {
|
|
7
|
-
files: {
|
|
8
|
-
create: number;
|
|
9
|
-
update: number;
|
|
10
|
-
delete: number;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export interface RepoFileChanges {
|
|
15
|
-
repoName: string;
|
|
16
|
-
files: ReportFileChange[];
|
|
17
|
-
prUrl?: string;
|
|
18
|
-
mergeOutcome?: MergeMode;
|
|
19
|
-
error?: string;
|
|
20
|
-
}
|
package/dist/output/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ValidationError } from "./errors.js";
|
|
2
|
-
export function escapeRegExp(str) {
|
|
3
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Escapes a string for safe use as a shell argument.
|
|
7
|
-
* Uses single quotes and escapes any single quotes within the string.
|
|
8
|
-
*/
|
|
9
|
-
export function escapeShellArg(arg) {
|
|
10
|
-
// Defense-in-depth: reject null bytes even if upstream validation should catch them
|
|
11
|
-
if (arg.includes("\0")) {
|
|
12
|
-
throw new ValidationError("Shell argument contains null byte");
|
|
13
|
-
}
|
|
14
|
-
// Use single quotes and escape any single quotes within
|
|
15
|
-
// 'string' -> quote ends, escaped quote, quote starts again
|
|
16
|
-
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
17
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|