@teamvibe/poller 0.1.21 → 0.1.23

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.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Configure git credentials from GITHUB_TOKEN env var.
3
- * Uses git credential store so tokens don't appear in remote URLs.
2
+ * Configure git auth using `gh auth setup-git`.
3
+ * Uses gitEnv which includes /data/bin in PATH.
4
4
  */
5
5
  export declare function configureGitAuth(): Promise<void>;
6
6
  interface BrainConfig {
@@ -1,32 +1,33 @@
1
1
  import { exec } from 'child_process';
2
2
  import { promisify } from 'util';
3
- import { existsSync, mkdirSync, writeFileSync } from 'fs';
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';
7
7
  const execAsync = promisify(exec);
8
- // Clean env for git commands — npm/npx sets GIT_ASKPASS which
9
- // prevents git credential helpers (like gh) from working.
8
+ // Clean env for git commands:
9
+ // - npm/npx sets GIT_ASKPASS which prevents credential helpers from working
10
+ // - /data/bin may not be in PATH but contains tools like gh
10
11
  const gitEnv = { ...process.env };
11
12
  delete gitEnv['GIT_ASKPASS'];
13
+ if (gitEnv['PATH'] && !gitEnv['PATH'].includes('/data/bin')) {
14
+ gitEnv['PATH'] = `/data/bin:${gitEnv['PATH']}`;
15
+ }
12
16
  function gitExec(command, options) {
13
17
  return execAsync(command, { ...options, env: gitEnv });
14
18
  }
15
19
  /**
16
- * Configure git credentials from GITHUB_TOKEN env var.
17
- * Uses git credential store so tokens don't appear in remote URLs.
20
+ * Configure git auth using `gh auth setup-git`.
21
+ * Uses gitEnv which includes /data/bin in PATH.
18
22
  */
19
23
  export async function configureGitAuth() {
20
- const token = process.env['GITHUB_TOKEN'];
21
- if (!token) {
22
- logger.info('GITHUB_TOKEN not set, skipping git auth configuration');
23
- return;
24
+ try {
25
+ await gitExec('gh auth setup-git');
26
+ logger.info('Git authentication configured via gh');
27
+ }
28
+ catch (error) {
29
+ logger.warn(`Could not configure git auth: ${error instanceof Error ? error.message : error}`);
24
30
  }
25
- const home = process.env['HOME'] || '/root';
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');
30
31
  }
31
32
  // Cooldown tracker per brain
32
33
  const lastUpdateTimes = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamvibe/poller",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {