@aspruyt/xfg 5.7.0 → 6.0.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/sync-command.js +2 -2
- package/dist/lifecycle/github-lifecycle-provider.js +1 -0
- package/dist/vcs/commit-strategy-selector.d.ts +1 -1
- package/dist/vcs/commit-strategy-selector.js +1 -1
- package/dist/vcs/github-app-token-manager.d.ts +2 -2
- package/dist/vcs/github-app-token-manager.js +4 -4
- package/package.json +1 -1
package/dist/cli/sync-command.js
CHANGED
|
@@ -420,9 +420,9 @@ export async function runSync(options, deps = {}) {
|
|
|
420
420
|
getLogger().log(`Found ${config.repos.length} repositories to process`);
|
|
421
421
|
getLogger().log(`Target files: ${formatFileNames(fileNames)}`);
|
|
422
422
|
getLogger().log(`Branch: ${branchName}\n`);
|
|
423
|
-
const tokenManager = createTokenManager(process.env.
|
|
423
|
+
const tokenManager = createTokenManager(process.env.XFG_GITHUB_CLIENT_ID && process.env.XFG_GITHUB_APP_PRIVATE_KEY
|
|
424
424
|
? {
|
|
425
|
-
|
|
425
|
+
clientId: process.env.XFG_GITHUB_CLIENT_ID,
|
|
426
426
|
privateKey: process.env.XFG_GITHUB_APP_PRIVATE_KEY,
|
|
427
427
|
}
|
|
428
428
|
: undefined);
|
|
@@ -316,6 +316,7 @@ export class GitHubLifecycleProvider {
|
|
|
316
316
|
const command = parts.join(" ");
|
|
317
317
|
await withRetry(() => this.executor.exec(command, this.cwd, { env: tokenEnv }), {
|
|
318
318
|
retries: this.retries,
|
|
319
|
+
permanentErrorPatterns: POST_CREATE_PERMANENT_PATTERNS,
|
|
319
320
|
});
|
|
320
321
|
}
|
|
321
322
|
/**
|
|
@@ -3,7 +3,7 @@ import type { ICommitStrategy } from "./types.js";
|
|
|
3
3
|
import { GitHubAppTokenManager } from "./github-app-token-manager.js";
|
|
4
4
|
import type { ICommandExecutor } from "../shared/command-executor.js";
|
|
5
5
|
interface GitHubAppCredentials {
|
|
6
|
-
|
|
6
|
+
clientId: string;
|
|
7
7
|
privateKey: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
@@ -10,7 +10,7 @@ export function createTokenManager(credentials) {
|
|
|
10
10
|
if (!credentials) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
13
|
-
return new GitHubAppTokenManager(credentials.
|
|
13
|
+
return new GitHubAppTokenManager(credentials.clientId, credentials.privateKey);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Returns FileModeFixupCommitStrategy (decorating GraphQLCommitStrategy) for
|
|
@@ -4,7 +4,7 @@ import type { GitHubRepoInfo } from "../shared/repo-detector.js";
|
|
|
4
4
|
* Handles JWT generation, installation discovery, and token caching.
|
|
5
5
|
*/
|
|
6
6
|
export declare class GitHubAppTokenManager {
|
|
7
|
-
private readonly
|
|
7
|
+
private readonly clientId;
|
|
8
8
|
private readonly privateKey;
|
|
9
9
|
/** Map of "apiHost:owner" -> installation ID */
|
|
10
10
|
private installations;
|
|
@@ -12,7 +12,7 @@ export declare class GitHubAppTokenManager {
|
|
|
12
12
|
private discoveredHosts;
|
|
13
13
|
/** Map of "apiHost:owner" -> cached token */
|
|
14
14
|
private tokenCache;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(clientId: string, privateKey: string);
|
|
16
16
|
/**
|
|
17
17
|
* Generates a JWT for GitHub App authentication.
|
|
18
18
|
* The JWT is signed with RS256 and valid for 10 minutes.
|
|
@@ -14,7 +14,7 @@ async function assertOkResponse(res, context) {
|
|
|
14
14
|
* Handles JWT generation, installation discovery, and token caching.
|
|
15
15
|
*/
|
|
16
16
|
export class GitHubAppTokenManager {
|
|
17
|
-
|
|
17
|
+
clientId;
|
|
18
18
|
privateKey;
|
|
19
19
|
/** Map of "apiHost:owner" -> installation ID */
|
|
20
20
|
installations = new Map();
|
|
@@ -22,8 +22,8 @@ export class GitHubAppTokenManager {
|
|
|
22
22
|
discoveredHosts = new Set();
|
|
23
23
|
/** Map of "apiHost:owner" -> cached token */
|
|
24
24
|
tokenCache = new Map();
|
|
25
|
-
constructor(
|
|
26
|
-
this.
|
|
25
|
+
constructor(clientId, privateKey) {
|
|
26
|
+
this.clientId = clientId;
|
|
27
27
|
this.privateKey = privateKey;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
@@ -39,7 +39,7 @@ export class GitHubAppTokenManager {
|
|
|
39
39
|
const payload = {
|
|
40
40
|
iat: now - 60, // Issued 60 seconds ago to account for clock drift
|
|
41
41
|
exp: now + 600, // Expires in 10 minutes
|
|
42
|
-
iss: this.
|
|
42
|
+
iss: this.clientId,
|
|
43
43
|
};
|
|
44
44
|
const encodedHeader = base64UrlEncode(JSON.stringify(header));
|
|
45
45
|
const encodedPayload = base64UrlEncode(JSON.stringify(payload));
|
package/package.json
CHANGED