cyrus-ai
Version:
AI-powered Linear issue automation using Claude
60 lines β’ 2.87 kB
JavaScript
import { getCyrusAppUrl } from "cyrus-cloudflare-tunnel-client";
import { BaseCommand } from "./ICommand.js";
/**
* Start command - main entry point for starting the edge worker
*/
export class StartCommand extends BaseCommand {
async execute(_args) {
try {
// Load edge configuration
const edgeConfig = this.app.config.load();
const repositories = edgeConfig.repositories || [];
// Always start the EdgeWorker β it handles zero repos gracefully.
// Webhook transports (Slack, GitHub) register regardless of repos
// so URL verification and event reception work during onboarding.
await this.app.worker.startEdgeWorker({
repositories,
});
// Display server information
const serverPort = this.app.worker.getServerPort();
this.logger.raw("");
this.logger.divider(70);
this.logger.info(`π Version: ${this.app.version}`);
this.logger.info(`π Server running on port ${serverPort}`);
if (process.env.CLOUDFLARE_TOKEN) {
this.logger.info("π©οΈ Cloudflare tunnel: Active");
}
if (repositories.length > 0) {
this.logger.info(`\nπ¦ Managing ${repositories.length} repositories:`);
repositories.forEach((repo) => {
this.logger.info(` β’ ${repo.name} (${repo.repositoryPath})`);
});
}
else {
this.logger.info("\nβΈοΈ No repositories configured");
this.logger.info(" Add one with: cyrus self-add-repo <git-url>");
}
this.logger.divider(70);
// Setup signal handlers for graceful shutdown
this.app.setupSignalHandlers();
}
catch (error) {
this.logger.error(`Failed to start edge application: ${error.message}`);
// Provide helpful error guidance
if (error.message?.includes("CLOUDFLARE_TOKEN")) {
this.logger.info("\nπ‘ Cloudflare tunnel requires:");
this.logger.info(" - CLOUDFLARE_TOKEN environment variable");
this.logger.info(` - Get your token from: ${getCyrusAppUrl()}/onboarding`);
}
else if (error.message?.includes("Failed to connect")) {
this.logger.info("\nπ‘ Connection issues can occur when:");
this.logger.info(" - Linear OAuth tokens have expired");
this.logger.info(" - The Linear API is temporarily unavailable");
this.logger.info(" - Your network connection is having issues");
}
await this.app.shutdown();
process.exit(1);
}
}
}
//# sourceMappingURL=StartCommand.js.map