@teamvibe/poller 0.1.20 → 0.1.21

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,7 +1,8 @@
1
1
  /**
2
- * Log git auth diagnostics to help debug credential issues.
2
+ * Configure git credentials from GITHUB_TOKEN env var.
3
+ * Uses git credential store so tokens don't appear in remote URLs.
3
4
  */
4
- export declare function logGitDiagnostics(): Promise<void>;
5
+ export declare function configureGitAuth(): Promise<void>;
5
6
  interface BrainConfig {
6
7
  brainId: string;
7
8
  gitRepoUrl: string;
@@ -1,6 +1,6 @@
1
1
  import { exec } from 'child_process';
2
2
  import { promisify } from 'util';
3
- import { existsSync, mkdirSync } from 'fs';
3
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
4
4
  import { join } from 'path';
5
5
  import { config } from './config.js';
6
6
  import { logger } from './logger.js';
@@ -13,27 +13,20 @@ function gitExec(command, options) {
13
13
  return execAsync(command, { ...options, env: gitEnv });
14
14
  }
15
15
  /**
16
- * Log git auth diagnostics to help debug credential issues.
16
+ * Configure git credentials from GITHUB_TOKEN env var.
17
+ * Uses git credential store so tokens don't appear in remote URLs.
17
18
  */
18
- export async function logGitDiagnostics() {
19
- const diag = async (label, cmd) => {
20
- try {
21
- const { stdout } = await execAsync(cmd);
22
- logger.info(`[git-diag] ${label}: ${stdout.trim()}`);
23
- }
24
- catch (e) {
25
- logger.warn(`[git-diag] ${label}: FAILED - ${e instanceof Error ? e.message : e}`);
26
- }
27
- };
28
- logger.info(`[git-diag] GIT_ASKPASS=${process.env['GIT_ASKPASS'] ?? '(unset)'}`);
29
- logger.info(`[git-diag] GIT_TERMINAL_PROMPT=${process.env['GIT_TERMINAL_PROMPT'] ?? '(unset)'}`);
30
- logger.info(`[git-diag] GITHUB_TOKEN=${process.env['GITHUB_TOKEN'] ? '***set***' : '(unset)'}`);
31
- logger.info(`[git-diag] HOME=${process.env['HOME'] ?? '(unset)'}`);
32
- await diag('git version', 'git --version');
33
- await diag('gh version', 'gh --version | head -1');
34
- await diag('credential.helper', 'git config --global credential.helper || echo "(not set)"');
35
- await diag('credential.github', 'git config --global --get-regexp "credential.*github" || echo "(not set)"');
36
- await diag('gh auth status', 'gh auth status 2>&1 || true');
19
+ 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
+ }
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');
37
30
  }
38
31
  // Cooldown tracker per brain
39
32
  const lastUpdateTimes = new Map();
package/dist/poller.js CHANGED
@@ -4,7 +4,7 @@ import { pollMessages, deleteMessage, extendVisibility, } from './sqs-poller.js'
4
4
  import { spawnClaudeCode, isAtCapacity, getActiveProcessCount } from './claude-spawner.js';
5
5
  import { sendSlackError, addReaction, getUserInfo, startTypingIndicator } from './slack-client.js';
6
6
  import { acquireSessionLock, releaseSessionLock, updateSessionId } from './session-store.js';
7
- import { getBrainPath, ensureDirectories, ensureBaseBrain, pushBrainChanges, logGitDiagnostics } from './brain-manager.js';
7
+ import { getBrainPath, ensureDirectories, ensureBaseBrain, pushBrainChanges, configureGitAuth } from './brain-manager.js';
8
8
  import { initAuth, stopRefresh } from './auth-provider.js';
9
9
  // Track active message processing
10
10
  const processingMessages = new Set();
@@ -254,7 +254,7 @@ export async function startPoller() {
254
254
  logger.info(` Queue: ${config.SQS_QUEUE_URL}`);
255
255
  logger.info(` Sessions table: ${config.SESSIONS_TABLE}`);
256
256
  }
257
- await logGitDiagnostics();
257
+ await configureGitAuth();
258
258
  await ensureDirectories();
259
259
  await ensureBaseBrain();
260
260
  await pollLoop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamvibe/poller",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {