@chrisromp/copilot-bridge 0.6.0-dev.2 → 0.6.0-dev.4
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.
- package/bin/copilot-bridge.js +1 -0
- package/package.json +1 -1
- package/scripts/check.ts +7 -4
- package/scripts/init.ts +14 -5
- package/scripts/install-service.ts +9 -4
package/bin/copilot-bridge.js
CHANGED
|
@@ -52,6 +52,7 @@ if (!script) {
|
|
|
52
52
|
const child = spawn(process.execPath, ['--import', 'tsx/esm', script, ...process.argv.slice(3)], {
|
|
53
53
|
stdio: 'inherit',
|
|
54
54
|
cwd: root,
|
|
55
|
+
env: { ...process.env, COPILOT_BRIDGE_CLI: '1' },
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
child.on('exit', (code) => process.exit(code ?? 1));
|
package/package.json
CHANGED
package/scripts/check.ts
CHANGED
|
@@ -38,7 +38,9 @@ async function main() {
|
|
|
38
38
|
const result: CheckResult = { status: 'fail', label: 'Config file', detail: `not found at ${configPath}` };
|
|
39
39
|
printCheck(result);
|
|
40
40
|
results.push(result);
|
|
41
|
-
info(
|
|
41
|
+
info(process.env.COPILOT_BRIDGE_CLI === '1'
|
|
42
|
+
? 'Run "copilot-bridge init" to create a config file.'
|
|
43
|
+
: 'Run "npm run init" to create a config file.');
|
|
42
44
|
printSummary(results);
|
|
43
45
|
process.exit(results.some(r => r.status === 'fail') ? 1 : 0);
|
|
44
46
|
}
|
|
@@ -225,12 +227,13 @@ async function main() {
|
|
|
225
227
|
printCheck(result);
|
|
226
228
|
results.push(result);
|
|
227
229
|
} else {
|
|
230
|
+
const isCli = process.env.COPILOT_BRIDGE_CLI === '1';
|
|
228
231
|
const platform = detectPlatform();
|
|
229
232
|
const serviceHint = platform === 'macos'
|
|
230
|
-
?
|
|
233
|
+
? `install with: ${isCli ? 'copilot-bridge install-service' : 'npm run install-service'}`
|
|
231
234
|
: platform === 'linux'
|
|
232
|
-
?
|
|
233
|
-
:
|
|
235
|
+
? `install with: ${isCli ? 'copilot-bridge install-service' : 'npm run install-service'} (requires sudo)`
|
|
236
|
+
: `start with: ${isCli ? 'copilot-bridge start' : 'npm run dev (or npm start)'}`;
|
|
234
237
|
const result: CheckResult = { status: 'warn', label: 'Service not running', detail: serviceHint };
|
|
235
238
|
printCheck(result);
|
|
236
239
|
results.push(result);
|
package/scripts/init.ts
CHANGED
|
@@ -232,12 +232,21 @@ async function main() {
|
|
|
232
232
|
if (channels.length > 0) info(`Channels: ${channels.length} configured`);
|
|
233
233
|
info('DMs: enabled automatically');
|
|
234
234
|
blank();
|
|
235
|
+
|
|
236
|
+
// Detect if running via the copilot-bridge CLI (global install)
|
|
237
|
+
const isCli = process.env.COPILOT_BRIDGE_CLI === '1';
|
|
235
238
|
dim('Next steps:');
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
if (isCli) {
|
|
240
|
+
dim(' copilot-bridge check Validate your setup');
|
|
241
|
+
dim(' copilot-bridge start Start the bridge');
|
|
242
|
+
dim(' copilot-bridge install-service Install as a system service');
|
|
243
|
+
} else {
|
|
244
|
+
dim(' npm run dev Start in development mode (watch)');
|
|
245
|
+
dim(' npm run check Validate your setup');
|
|
246
|
+
dim(' npm run install-service Install as a system service');
|
|
247
|
+
dim(' npm run build Build for production');
|
|
248
|
+
dim(' npm start Start production server');
|
|
249
|
+
}
|
|
241
250
|
blank();
|
|
242
251
|
|
|
243
252
|
closePrompts();
|
|
@@ -35,7 +35,9 @@ function main() {
|
|
|
35
35
|
|
|
36
36
|
const distPath = path.join(bridgePath, 'dist', 'index.js');
|
|
37
37
|
if (!fs.existsSync(distPath)) {
|
|
38
|
-
fail(
|
|
38
|
+
fail(process.env.COPILOT_BRIDGE_CLI === '1'
|
|
39
|
+
? 'dist/index.js not found. Package may be corrupted — try reinstalling.'
|
|
40
|
+
: 'dist/index.js not found. Run "npm run build" first.');
|
|
39
41
|
process.exit(1);
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -67,10 +69,11 @@ function main() {
|
|
|
67
69
|
info('Linux detected — installing systemd service (system-scoped).');
|
|
68
70
|
dim('The service starts at boot and restarts on crash.\n');
|
|
69
71
|
|
|
70
|
-
// Check if dist/index.js exists
|
|
71
72
|
const distPath = path.join(bridgePath, 'dist', 'index.js');
|
|
72
73
|
if (!fs.existsSync(distPath)) {
|
|
73
|
-
fail(
|
|
74
|
+
fail(process.env.COPILOT_BRIDGE_CLI === '1'
|
|
75
|
+
? 'dist/index.js not found. Package may be corrupted — try reinstalling.'
|
|
76
|
+
: 'dist/index.js not found. Run "npm run build" first.');
|
|
74
77
|
process.exit(1);
|
|
75
78
|
}
|
|
76
79
|
|
|
@@ -115,7 +118,9 @@ function main() {
|
|
|
115
118
|
|
|
116
119
|
} else {
|
|
117
120
|
fail('Unsupported platform for automatic service install.');
|
|
118
|
-
info(
|
|
121
|
+
info(process.env.COPILOT_BRIDGE_CLI === '1'
|
|
122
|
+
? 'Run the bridge manually: copilot-bridge start'
|
|
123
|
+
: 'Run the bridge manually: npm run dev (development) or npm start (production)');
|
|
119
124
|
process.exit(1);
|
|
120
125
|
}
|
|
121
126
|
}
|