@teamvibe/poller 0.1.34 → 0.1.36

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.
@@ -59,12 +59,27 @@ export async function install() {
59
59
  }
60
60
  // Load existing .env values as defaults
61
61
  const existingEnv = loadExistingEnv();
62
+ const hasExistingConfig = !!(existingEnv['TEAMVIBE_POLLER_TOKEN']);
63
+ // If existing config found, offer to keep it
64
+ let reuseExisting = false;
65
+ if (hasExistingConfig && !nonInteractive && !flags['token']) {
66
+ console.log('Existing configuration found:');
67
+ console.log(` TEAMVIBE_POLLER_TOKEN: ${existingEnv['TEAMVIBE_POLLER_TOKEN']?.slice(0, 8)}...`);
68
+ console.log(` TEAMVIBE_API_URL: ${existingEnv['TEAMVIBE_API_URL'] || 'https://poller.api.teamvibe.ai'}`);
69
+ if (existingEnv['CLAUDE_CODE_OAUTH_TOKEN']) {
70
+ console.log(` CLAUDE_CODE_OAUTH_TOKEN: ${existingEnv['CLAUDE_CODE_OAUTH_TOKEN']?.slice(0, 8)}...`);
71
+ }
72
+ reuseExisting = await confirm('\nKeep existing configuration?');
73
+ }
62
74
  // Collect configuration
63
75
  let token;
64
76
  if (flags['token']) {
65
77
  token = flags['token'];
66
78
  console.log(`Using provided token: ${token.slice(0, 8)}...`);
67
79
  }
80
+ else if (reuseExisting) {
81
+ token = existingEnv['TEAMVIBE_POLLER_TOKEN'];
82
+ }
68
83
  else {
69
84
  console.log('Step 1: Poller Token\n');
70
85
  console.log(' Get your token from the TeamVibe dashboard (Pollers > Setup Instructions).');
@@ -76,7 +91,7 @@ export async function install() {
76
91
  process.exit(1);
77
92
  }
78
93
  let claudeOAuthToken = flags['claude-token'] || existingEnv['CLAUDE_CODE_OAUTH_TOKEN'] || '';
79
- if (!claudeOAuthToken) {
94
+ if (!claudeOAuthToken && !reuseExisting) {
80
95
  if (nonInteractive) {
81
96
  console.log('\nDetecting Claude Code token...');
82
97
  }
@@ -108,7 +123,7 @@ export async function install() {
108
123
  }
109
124
  let apiUrl;
110
125
  let maxConcurrent;
111
- if (nonInteractive) {
126
+ if (nonInteractive || reuseExisting) {
112
127
  apiUrl = flags['api-url'] || existingEnv['TEAMVIBE_API_URL'] || 'https://poller.api.teamvibe.ai';
113
128
  maxConcurrent = flags['max-concurrent'] || existingEnv['MAX_CONCURRENT_SESSIONS'] || '5';
114
129
  }
@@ -190,7 +205,11 @@ export async function install() {
190
205
  envLines.push(`CLAUDE_CODE_OAUTH_TOKEN=${claudeOAuthToken}`);
191
206
  }
192
207
  let writeEnv = true;
193
- if (fs.existsSync(envPath) && !nonInteractive) {
208
+ if (reuseExisting) {
209
+ writeEnv = false;
210
+ console.log('Keeping existing .env file.');
211
+ }
212
+ else if (fs.existsSync(envPath) && !nonInteractive) {
194
213
  writeEnv = await confirm('\n.env file already exists. Overwrite?', false);
195
214
  if (!writeEnv) {
196
215
  console.log('Keeping existing .env file.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamvibe/poller",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "bin": {