@proletariat/cli 0.3.64 → 0.3.65

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.
Files changed (36) hide show
  1. package/dist/commands/work/start.js +122 -99
  2. package/dist/commands/work/start.js.map +1 -1
  3. package/dist/lib/database/index.d.ts +1 -1
  4. package/dist/lib/database/index.js +9 -107
  5. package/dist/lib/database/index.js.map +1 -1
  6. package/dist/lib/database/migrations/0001_baseline.d.ts +9 -0
  7. package/dist/lib/database/migrations/0001_baseline.js +18 -0
  8. package/dist/lib/database/migrations/0001_baseline.js.map +1 -0
  9. package/dist/lib/database/migrations/index.d.ts +12 -0
  10. package/dist/lib/database/migrations/index.js +15 -0
  11. package/dist/lib/database/migrations/index.js.map +1 -0
  12. package/dist/lib/database/migrator.d.ts +27 -0
  13. package/dist/lib/database/migrator.js +42 -0
  14. package/dist/lib/database/migrator.js.map +1 -0
  15. package/dist/lib/database/workspace-schema.d.ts +7 -0
  16. package/dist/lib/database/workspace-schema.js +109 -0
  17. package/dist/lib/database/workspace-schema.js.map +1 -0
  18. package/dist/lib/events/events.d.ts +5 -0
  19. package/dist/lib/events/index.d.ts +1 -1
  20. package/dist/lib/events/index.js.map +1 -1
  21. package/dist/lib/external-issues/outbound-sync.d.ts +21 -16
  22. package/dist/lib/external-issues/outbound-sync.js +64 -49
  23. package/dist/lib/external-issues/outbound-sync.js.map +1 -1
  24. package/dist/lib/pmo/sync-manager.js +5 -1
  25. package/dist/lib/pmo/sync-manager.js.map +1 -1
  26. package/dist/lib/work-lifecycle/adapter.d.ts +34 -0
  27. package/dist/lib/work-lifecycle/adapter.js +103 -0
  28. package/dist/lib/work-lifecycle/adapter.js.map +1 -0
  29. package/dist/lib/work-lifecycle/events.d.ts +52 -0
  30. package/dist/lib/work-lifecycle/events.js +12 -0
  31. package/dist/lib/work-lifecycle/events.js.map +1 -0
  32. package/dist/lib/work-lifecycle/index.d.ts +9 -0
  33. package/dist/lib/work-lifecycle/index.js +9 -0
  34. package/dist/lib/work-lifecycle/index.js.map +1 -0
  35. package/oclif.manifest.json +2700 -2700
  36. package/package.json +1 -1
@@ -1387,8 +1387,8 @@ export default class WorkStart extends PMOCommand {
1387
1387
  this.log('');
1388
1388
  this.log(styles.warning('Docker daemon is not running. Start Docker Desktop or use --run-on-host.'));
1389
1389
  this.log('');
1390
- if (jsonMode && flags.yes) {
1391
- // In JSON mode with --yes, auto-switch to host
1390
+ if (flags.yes || !process.stdout.isTTY) {
1391
+ // Non-interactive mode: auto-switch to host
1392
1392
  environment = 'host';
1393
1393
  this.log(styles.muted('Switched to host environment (Docker not running).'));
1394
1394
  }
@@ -1441,11 +1441,19 @@ export default class WorkStart extends PMOCommand {
1441
1441
  // Saved preference: OAuth — validate credentials exist
1442
1442
  const hasCredentials = dockerCredentialsExist();
1443
1443
  if (!hasCredentials) {
1444
- this.log('');
1445
- this.log(styles.warning('⚠️ Saved auth method is "oauth" but no OAuth credentials found.'));
1446
- this.log(styles.muted(' Run "' + this.config.bin + ' agent auth" to authenticate.'));
1447
- db.close();
1448
- return;
1444
+ if (flags.yes || !process.stdout.isTTY) {
1445
+ // Non-interactive mode: auto-fallback to host
1446
+ this.log(styles.warning('⚠️ Saved auth method is "oauth" but no OAuth credentials found.'));
1447
+ environment = 'host';
1448
+ this.log(styles.muted('Switched to host environment (OAuth credentials missing).'));
1449
+ }
1450
+ else {
1451
+ this.log('');
1452
+ this.log(styles.warning('⚠️ Saved auth method is "oauth" but no OAuth credentials found.'));
1453
+ this.log(styles.muted(' Run "' + this.config.bin + ' agent auth" to authenticate.'));
1454
+ db.close();
1455
+ return;
1456
+ }
1449
1457
  }
1450
1458
  // OAuth credentials valid — continue (useApiKey stays false)
1451
1459
  }
@@ -1458,9 +1466,10 @@ export default class WorkStart extends PMOCommand {
1458
1466
  }
1459
1467
  else {
1460
1468
  // No saved preference and no OAuth credentials — prompt user
1461
- // In JSON mode with --yes, continue anyway (agent can run /login)
1462
- if (jsonMode && flags.yes) {
1463
- // Continue without prompting - agent will need to handle auth
1469
+ if (flags.yes || !process.stdout.isTTY) {
1470
+ // Non-interactive mode: auto-fallback to host
1471
+ environment = 'host';
1472
+ this.log(styles.warning('⚠️ No OAuth credentials found. Switched to host environment.'));
1464
1473
  }
1465
1474
  else {
1466
1475
  this.log('');
@@ -2188,115 +2197,129 @@ export default class WorkStart extends PMOCommand {
2188
2197
  this.log('');
2189
2198
  this.log(styles.warning('Docker daemon is not running. Start Docker Desktop or use --run-on-host.'));
2190
2199
  this.log('');
2191
- const { dockerAction } = await this.prompt([
2192
- {
2193
- type: 'list',
2194
- name: 'dockerAction',
2195
- message: 'Docker is not running. What would you like to do?',
2196
- choices: [
2197
- { name: '💻 Run all agents on host instead (--run-on-host)', value: 'host', command: 'prlt work start --all --run-on-host --json' },
2198
- { name: '✗ Cancel', value: 'cancel', command: '' },
2199
- ],
2200
- },
2201
- ], batchJsonModeConfig);
2202
- if (dockerAction === 'cancel') {
2203
- db.close();
2204
- this.log(styles.muted('Cancelled.'));
2205
- return;
2200
+ if (!process.stdout.isTTY) {
2201
+ // Non-interactive mode: auto-switch to host
2202
+ flags['run-on-host'] = true;
2203
+ this.log(styles.muted('All agents will run on host (Docker not running).'));
2206
2204
  }
2207
- flags['run-on-host'] = true;
2208
- this.log(styles.muted('All agents will run on host.'));
2209
- }
2210
- if (!flags['run-on-host']) {
2211
- const hasCredentials = dockerCredentialsExist();
2212
- if (!hasCredentials) {
2213
- const hasApiKey = !!process.env.ANTHROPIC_API_KEY;
2214
- this.log('');
2215
- this.log(styles.warning('⚠️ No Claude Code OAuth credentials found for Docker containers'));
2216
- this.log(styles.muted(' Agents need credentials to authenticate with Claude.'));
2217
- this.log('');
2218
- // Build choices based on available options
2219
- const batchAuthChoices = [
2220
- { name: `🔐 Run ${this.config.bin} agent auth now (recommended — uses Max subscription)`, value: 'auth', command: `${this.config.bin} agent auth` },
2221
- ];
2222
- if (hasApiKey) {
2223
- batchAuthChoices.push({ name: '🔑 Use ANTHROPIC_API_KEY (⚠️ uses API credits, not Max subscription)', value: 'apikey', command: '' });
2224
- }
2225
- batchAuthChoices.push({ name: '💻 Run all agents on host instead (--run-on-host)', value: 'host', command: 'prlt work start --all --run-on-host --json' }, { name: '✗ Cancel', value: 'cancel', command: '' });
2226
- const { authAction } = await this.prompt([
2205
+ else {
2206
+ const { dockerAction } = await this.prompt([
2227
2207
  {
2228
2208
  type: 'list',
2229
- name: 'authAction',
2230
- message: 'What would you like to do?',
2231
- choices: batchAuthChoices,
2209
+ name: 'dockerAction',
2210
+ message: 'Docker is not running. What would you like to do?',
2211
+ choices: [
2212
+ { name: '💻 Run all agents on host instead (--run-on-host)', value: 'host', command: 'prlt work start --all --run-on-host --json' },
2213
+ { name: '✗ Cancel', value: 'cancel', command: '' },
2214
+ ],
2232
2215
  },
2233
2216
  ], batchJsonModeConfig);
2234
- if (authAction === 'cancel') {
2217
+ if (dockerAction === 'cancel') {
2235
2218
  db.close();
2236
2219
  this.log(styles.muted('Cancelled.'));
2237
2220
  return;
2238
2221
  }
2239
- if (authAction === 'host') {
2222
+ flags['run-on-host'] = true;
2223
+ this.log(styles.muted('All agents will run on host.'));
2224
+ }
2225
+ }
2226
+ if (!flags['run-on-host']) {
2227
+ const hasCredentials = dockerCredentialsExist();
2228
+ if (!hasCredentials) {
2229
+ if (!process.stdout.isTTY) {
2230
+ // Non-interactive mode: auto-fallback to host
2231
+ this.log(styles.warning('⚠️ No OAuth credentials found. Switched to host environment.'));
2240
2232
  flags['run-on-host'] = true;
2241
- this.log(styles.muted('All agents will run on host.'));
2242
2233
  }
2243
- else if (authAction === 'apikey') {
2244
- batchUseApiKey = true;
2245
- this.log(styles.warning('Using ANTHROPIC_API_KEY — this will consume API credits.'));
2246
- this.log(styles.muted(`Run "${this.config.bin} agent auth" to set up OAuth and use your Max subscription instead.`));
2247
- this.log('');
2248
- }
2249
- else if (authAction === 'auth') {
2234
+ else {
2235
+ const hasApiKey = !!process.env.ANTHROPIC_API_KEY;
2250
2236
  this.log('');
2251
- this.log(styles.primary(`Opening ${this.config.bin} agent auth in new tab...`));
2237
+ this.log(styles.warning('⚠️ No Claude Code OAuth credentials found for Docker containers'));
2238
+ this.log(styles.muted(' Agents need credentials to authenticate with Claude.'));
2252
2239
  this.log('');
2253
- // Open auth in a new terminal tab
2254
- const authCmd = `${process.argv[1]} agent auth`;
2255
- try {
2256
- execSync(`osascript -e '
2257
- tell application "iTerm"
2258
- tell current window
2259
- create tab with default profile
2260
- tell current session
2261
- write text "${authCmd}"
2262
- end tell
2263
- end tell
2264
- end tell
2265
- '`);
2240
+ // Build choices based on available options
2241
+ const batchAuthChoices = [
2242
+ { name: `🔐 Run ${this.config.bin} agent auth now (recommended — uses Max subscription)`, value: 'auth', command: `${this.config.bin} agent auth` },
2243
+ ];
2244
+ if (hasApiKey) {
2245
+ batchAuthChoices.push({ name: '🔑 Use ANTHROPIC_API_KEY (⚠️ uses API credits, not Max subscription)', value: 'apikey', command: '' });
2266
2246
  }
2267
- catch {
2268
- // Fallback: try Terminal.app
2247
+ batchAuthChoices.push({ name: '💻 Run all agents on host instead (--run-on-host)', value: 'host', command: 'prlt work start --all --run-on-host --json' }, { name: '✗ Cancel', value: 'cancel', command: '' });
2248
+ const { authAction } = await this.prompt([
2249
+ {
2250
+ type: 'list',
2251
+ name: 'authAction',
2252
+ message: 'What would you like to do?',
2253
+ choices: batchAuthChoices,
2254
+ },
2255
+ ], batchJsonModeConfig);
2256
+ if (authAction === 'cancel') {
2257
+ db.close();
2258
+ this.log(styles.muted('Cancelled.'));
2259
+ return;
2260
+ }
2261
+ if (authAction === 'host') {
2262
+ flags['run-on-host'] = true;
2263
+ this.log(styles.muted('All agents will run on host.'));
2264
+ }
2265
+ else if (authAction === 'apikey') {
2266
+ batchUseApiKey = true;
2267
+ this.log(styles.warning('Using ANTHROPIC_API_KEY — this will consume API credits.'));
2268
+ this.log(styles.muted(`Run "${this.config.bin} agent auth" to set up OAuth and use your Max subscription instead.`));
2269
+ this.log('');
2270
+ }
2271
+ else if (authAction === 'auth') {
2272
+ this.log('');
2273
+ this.log(styles.primary(`Opening ${this.config.bin} agent auth in new tab...`));
2274
+ this.log('');
2275
+ // Open auth in a new terminal tab
2276
+ const authCmd = `${process.argv[1]} agent auth`;
2269
2277
  try {
2270
- execSync(`osascript -e 'tell application "Terminal" to do script "${authCmd}"'`);
2278
+ execSync(`osascript -e '
2279
+ tell application "iTerm"
2280
+ tell current window
2281
+ create tab with default profile
2282
+ tell current session
2283
+ write text "${authCmd}"
2284
+ end tell
2285
+ end tell
2286
+ end tell
2287
+ '`);
2271
2288
  }
2272
2289
  catch {
2273
- this.log(styles.warning('Could not open new terminal tab.'));
2274
- this.log(styles.muted(`Please run manually: ${authCmd}`));
2290
+ // Fallback: try Terminal.app
2291
+ try {
2292
+ execSync(`osascript -e 'tell application "Terminal" to do script "${authCmd}"'`);
2293
+ }
2294
+ catch {
2295
+ this.log(styles.warning('Could not open new terminal tab.'));
2296
+ this.log(styles.muted(`Please run manually: ${authCmd}`));
2297
+ }
2298
+ }
2299
+ this.log(styles.muted('Complete the /login flow in the new tab, then press Enter here...'));
2300
+ this.log('');
2301
+ // Wait for user to complete auth
2302
+ await this.prompt([{
2303
+ type: 'input',
2304
+ name: 'done',
2305
+ message: 'Press Enter when authentication is complete:',
2306
+ }], batchJsonModeConfig);
2307
+ // Check if credentials now exist
2308
+ if (!dockerCredentialsExist()) {
2309
+ this.log('');
2310
+ this.log(styles.warning('Authentication did not complete. No credentials found.'));
2311
+ db.close();
2312
+ return;
2313
+ }
2314
+ const info = getDockerCredentialInfo();
2315
+ this.log('');
2316
+ this.log(styles.success('✓ Credentials configured'));
2317
+ if (info) {
2318
+ this.log(styles.muted(` Subscription: ${info.subscriptionType || 'unknown'}`));
2319
+ this.log(styles.muted(` Expires: ${info.expiresAt.toLocaleDateString()}`));
2275
2320
  }
2276
- }
2277
- this.log(styles.muted('Complete the /login flow in the new tab, then press Enter here...'));
2278
- this.log('');
2279
- // Wait for user to complete auth
2280
- await this.prompt([{
2281
- type: 'input',
2282
- name: 'done',
2283
- message: 'Press Enter when authentication is complete:',
2284
- }], batchJsonModeConfig);
2285
- // Check if credentials now exist
2286
- if (!dockerCredentialsExist()) {
2287
2321
  this.log('');
2288
- this.log(styles.warning('Authentication did not complete. No credentials found.'));
2289
- db.close();
2290
- return;
2291
- }
2292
- const info = getDockerCredentialInfo();
2293
- this.log('');
2294
- this.log(styles.success('✓ Credentials configured'));
2295
- if (info) {
2296
- this.log(styles.muted(` Subscription: ${info.subscriptionType || 'unknown'}`));
2297
- this.log(styles.muted(` Expires: ${info.expiresAt.toLocaleDateString()}`));
2298
2322
  }
2299
- this.log('');
2300
2323
  }
2301
2324
  }
2302
2325
  }