@teamvibe/poller 0.1.21 → 0.1.22
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/brain-manager.d.ts +2 -2
- package/dist/brain-manager.js +14 -12
- package/package.json +1 -1
package/dist/brain-manager.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Configure git
|
|
3
|
-
*
|
|
2
|
+
* Configure git auth using `gh auth setup-git`.
|
|
3
|
+
* Finds gh binary in PATH or common locations (/data/bin).
|
|
4
4
|
*/
|
|
5
5
|
export declare function configureGitAuth(): Promise<void>;
|
|
6
6
|
interface BrainConfig {
|
package/dist/brain-manager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { exec } from 'child_process';
|
|
2
2
|
import { promisify } from 'util';
|
|
3
|
-
import { existsSync, mkdirSync
|
|
3
|
+
import { existsSync, mkdirSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import { config } from './config.js';
|
|
6
6
|
import { logger } from './logger.js';
|
|
@@ -13,20 +13,22 @@ function gitExec(command, options) {
|
|
|
13
13
|
return execAsync(command, { ...options, env: gitEnv });
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Configure git
|
|
17
|
-
*
|
|
16
|
+
* Configure git auth using `gh auth setup-git`.
|
|
17
|
+
* Finds gh binary in PATH or common locations (/data/bin).
|
|
18
18
|
*/
|
|
19
19
|
export async function configureGitAuth() {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const ghPaths = ['gh', '/data/bin/gh'];
|
|
21
|
+
for (const gh of ghPaths) {
|
|
22
|
+
try {
|
|
23
|
+
await execAsync(`${gh} auth setup-git`);
|
|
24
|
+
logger.info(`Git authentication configured via ${gh}`);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// try next path
|
|
29
|
+
}
|
|
24
30
|
}
|
|
25
|
-
|
|
26
|
-
const credentialsPath = join(home, '.git-credentials');
|
|
27
|
-
writeFileSync(credentialsPath, `https://x-access-token:${token}@github.com\n`, { mode: 0o600 });
|
|
28
|
-
await execAsync('git config --global credential.helper store');
|
|
29
|
-
logger.info('Git credentials configured from GITHUB_TOKEN');
|
|
31
|
+
logger.warn('Could not configure git auth: gh not found in PATH or /data/bin');
|
|
30
32
|
}
|
|
31
33
|
// Cooldown tracker per brain
|
|
32
34
|
const lastUpdateTimes = new Map();
|