@chrisromp/copilot-bridge 0.6.0 → 0.6.1-dev.10

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.
@@ -21,6 +21,7 @@ import {
21
21
  import { execSync } from 'node:child_process';
22
22
 
23
23
  function main() {
24
+ const isCli = process.env.COPILOT_BRIDGE_CLI === '1';
24
25
  const osPlatform = detectPlatform();
25
26
  const bridgePath = process.cwd();
26
27
  const homePath = os.homedir();
@@ -35,7 +36,9 @@ function main() {
35
36
 
36
37
  const distPath = path.join(bridgePath, 'dist', 'index.js');
37
38
  if (!fs.existsSync(distPath)) {
38
- fail('dist/index.js not found. Run "npm run build" first.');
39
+ fail(isCli
40
+ ? 'dist/index.js not found. Package may be corrupted — try reinstalling.'
41
+ : 'dist/index.js not found. Run "npm run build" first.');
39
42
  process.exit(1);
40
43
  }
41
44
 
@@ -67,10 +70,11 @@ function main() {
67
70
  info('Linux detected — installing systemd service (system-scoped).');
68
71
  dim('The service starts at boot and restarts on crash.\n');
69
72
 
70
- // Check if dist/index.js exists
71
73
  const distPath = path.join(bridgePath, 'dist', 'index.js');
72
74
  if (!fs.existsSync(distPath)) {
73
- fail('dist/index.js not found. Run "npm run build" first.');
75
+ fail(isCli
76
+ ? 'dist/index.js not found. Package may be corrupted — try reinstalling.'
77
+ : 'dist/index.js not found. Run "npm run build" first.');
74
78
  process.exit(1);
75
79
  }
76
80
 
@@ -115,7 +119,9 @@ function main() {
115
119
 
116
120
  } else {
117
121
  fail('Unsupported platform for automatic service install.');
118
- info('Run the bridge manually: npm run dev (development) or npm start (production)');
122
+ info(isCli
123
+ ? 'Run the bridge manually: copilot-bridge start'
124
+ : 'Run the bridge manually: npm run dev (development) or npm start (production)');
119
125
  process.exit(1);
120
126
  }
121
127
  }
@@ -33,7 +33,6 @@ export interface GeneratedConfig {
33
33
  platforms: {
34
34
  mattermost: {
35
35
  url: string;
36
- botToken?: string;
37
36
  bots?: Record<string, { token: string; admin?: boolean; agent?: string }>;
38
37
  };
39
38
  };
@@ -62,10 +61,8 @@ export function buildConfig(opts: {
62
61
  channels: [],
63
62
  };
64
63
 
65
- // Single bot botToken; multiple bots object
66
- if (opts.bots.length === 1) {
67
- config.platforms.mattermost.botToken = opts.bots[0].token;
68
- } else if (opts.bots.length > 1) {
64
+ // Always use named bots object (clearer schema, supports admin flag and multi-bot)
65
+ if (opts.bots.length > 0) {
69
66
  config.platforms.mattermost.bots = {};
70
67
  for (const bot of opts.bots) {
71
68
  config.platforms.mattermost.bots[bot.name] = {
@@ -81,7 +78,7 @@ export function buildConfig(opts: {
81
78
  id: ch.id,
82
79
  ...(ch.name ? { name: ch.name } : {}),
83
80
  platform: ch.platform,
84
- ...(opts.bots.length > 1 ? { bot: ch.bot } : {}),
81
+ bot: ch.bot,
85
82
  workingDirectory: ch.workingDirectory,
86
83
  });
87
84
  }