cyrus-ai 0.1.58 → 0.2.0-rc.1
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/dist/app.js +166 -2
- package/dist/app.js.map +1 -1
- package/dist/src/Application.d.ts +69 -0
- package/dist/src/Application.d.ts.map +1 -0
- package/dist/src/Application.js +273 -0
- package/dist/src/Application.js.map +1 -0
- package/dist/src/app.d.ts +3 -0
- package/dist/src/app.d.ts.map +1 -0
- package/dist/src/app.js +101 -0
- package/dist/src/app.js.map +1 -0
- package/dist/src/commands/AuthCommand.d.ts +8 -0
- package/dist/src/commands/AuthCommand.d.ts.map +1 -0
- package/dist/src/commands/AuthCommand.js +69 -0
- package/dist/src/commands/AuthCommand.js.map +1 -0
- package/dist/src/commands/CheckTokensCommand.d.ts +8 -0
- package/dist/src/commands/CheckTokensCommand.d.ts.map +1 -0
- package/dist/src/commands/CheckTokensCommand.js +53 -0
- package/dist/src/commands/CheckTokensCommand.js.map +1 -0
- package/dist/src/commands/ICommand.d.ts +38 -0
- package/dist/src/commands/ICommand.d.ts.map +1 -0
- package/dist/src/commands/ICommand.js +37 -0
- package/dist/src/commands/ICommand.js.map +1 -0
- package/dist/src/commands/RefreshTokenCommand.d.ts +8 -0
- package/dist/src/commands/RefreshTokenCommand.d.ts.map +1 -0
- package/dist/src/commands/RefreshTokenCommand.js +152 -0
- package/dist/src/commands/RefreshTokenCommand.js.map +1 -0
- package/dist/src/commands/StartCommand.d.ts +8 -0
- package/dist/src/commands/StartCommand.d.ts.map +1 -0
- package/dist/src/commands/StartCommand.js +70 -0
- package/dist/src/commands/StartCommand.js.map +1 -0
- package/dist/src/config/constants.d.ts +12 -0
- package/dist/src/config/constants.d.ts.map +1 -0
- package/dist/src/config/constants.js +19 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/types.d.ts +21 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config/types.js +2 -0
- package/dist/src/config/types.js.map +1 -0
- package/dist/src/services/ConfigService.d.ts +32 -0
- package/dist/src/services/ConfigService.d.ts.map +1 -0
- package/dist/src/services/ConfigService.js +72 -0
- package/dist/src/services/ConfigService.js.map +1 -0
- package/dist/src/services/GitService.d.ts +28 -0
- package/dist/src/services/GitService.d.ts.map +1 -0
- package/dist/src/services/GitService.js +339 -0
- package/dist/src/services/GitService.js.map +1 -0
- package/dist/src/services/Logger.d.ts +88 -0
- package/dist/src/services/Logger.d.ts.map +1 -0
- package/dist/src/services/Logger.js +146 -0
- package/dist/src/services/Logger.js.map +1 -0
- package/dist/src/services/WorkerService.d.ts +53 -0
- package/dist/src/services/WorkerService.d.ts.map +1 -0
- package/dist/src/services/WorkerService.js +173 -0
- package/dist/src/services/WorkerService.js.map +1 -0
- package/dist/src/ui/CLIPrompts.d.ts +18 -0
- package/dist/src/ui/CLIPrompts.d.ts.map +1 -0
- package/dist/src/ui/CLIPrompts.js +53 -0
- package/dist/src/ui/CLIPrompts.js.map +1 -0
- package/package.json +10 -9
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseCommand } from "./ICommand.js";
|
|
2
|
+
/**
|
|
3
|
+
* Refresh token command - refresh a specific Linear token
|
|
4
|
+
*/
|
|
5
|
+
export declare class RefreshTokenCommand extends BaseCommand {
|
|
6
|
+
execute(_args: string[]): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=RefreshTokenCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshTokenCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/RefreshTokenCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAmC5C;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,WAAW;IAC7C,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAwJ7C"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import open from "open";
|
|
3
|
+
import { CLIPrompts } from "../ui/CLIPrompts.js";
|
|
4
|
+
import { BaseCommand } from "./ICommand.js";
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to check Linear token status
|
|
7
|
+
*/
|
|
8
|
+
async function checkLinearToken(token) {
|
|
9
|
+
try {
|
|
10
|
+
const response = await fetch("https://api.linear.app/graphql", {
|
|
11
|
+
method: "POST",
|
|
12
|
+
headers: {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
Authorization: token,
|
|
15
|
+
},
|
|
16
|
+
body: JSON.stringify({
|
|
17
|
+
query: "{ viewer { id email name } }",
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
const data = (await response.json());
|
|
21
|
+
if (data.errors) {
|
|
22
|
+
return {
|
|
23
|
+
valid: false,
|
|
24
|
+
error: data.errors[0]?.message || "Unknown error",
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return { valid: true };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return { valid: false, error: error.message };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Refresh token command - refresh a specific Linear token
|
|
35
|
+
*/
|
|
36
|
+
export class RefreshTokenCommand extends BaseCommand {
|
|
37
|
+
async execute(_args) {
|
|
38
|
+
if (!this.app.config.exists()) {
|
|
39
|
+
this.logError("No edge configuration found. Please run setup first.");
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
const config = this.app.config.load();
|
|
43
|
+
// Show repositories with their token status
|
|
44
|
+
console.log("Checking current token status...\n");
|
|
45
|
+
const tokenStatuses = [];
|
|
46
|
+
for (const repo of config.repositories) {
|
|
47
|
+
const result = await checkLinearToken(repo.linearToken);
|
|
48
|
+
tokenStatuses.push({ repo, valid: result.valid });
|
|
49
|
+
console.log(`${tokenStatuses.length}. ${repo.name} (${repo.linearWorkspaceName}): ${result.valid ? "✅ Valid" : "❌ Invalid"}`);
|
|
50
|
+
}
|
|
51
|
+
// Ask which token to refresh
|
|
52
|
+
const answer = await CLIPrompts.ask('\nWhich repository token would you like to refresh? (Enter number or "all"): ');
|
|
53
|
+
const indicesToRefresh = [];
|
|
54
|
+
if (answer.toLowerCase() === "all") {
|
|
55
|
+
indicesToRefresh.push(...Array.from({ length: tokenStatuses.length }, (_, i) => i));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const index = parseInt(answer, 10) - 1;
|
|
59
|
+
if (Number.isNaN(index) || index < 0 || index >= tokenStatuses.length) {
|
|
60
|
+
this.logError("Invalid selection");
|
|
61
|
+
process.exit(1);
|
|
62
|
+
}
|
|
63
|
+
indicesToRefresh.push(index);
|
|
64
|
+
}
|
|
65
|
+
// Refresh tokens
|
|
66
|
+
for (const index of indicesToRefresh) {
|
|
67
|
+
const tokenStatus = tokenStatuses[index];
|
|
68
|
+
if (!tokenStatus)
|
|
69
|
+
continue;
|
|
70
|
+
const { repo } = tokenStatus;
|
|
71
|
+
console.log(`\nRefreshing token for ${repo.name} (${repo.linearWorkspaceName || repo.linearWorkspaceId})...`);
|
|
72
|
+
console.log("Opening Linear OAuth flow in your browser...");
|
|
73
|
+
// Use the proxy's OAuth flow with a callback to localhost
|
|
74
|
+
const serverPort = process.env.CYRUS_SERVER_PORT
|
|
75
|
+
? parseInt(process.env.CYRUS_SERVER_PORT, 10)
|
|
76
|
+
: 3456;
|
|
77
|
+
const callbackUrl = `http://localhost:${serverPort}/callback`;
|
|
78
|
+
const proxyUrl = this.app.getProxyUrl();
|
|
79
|
+
const oauthUrl = `${proxyUrl}/oauth/authorize?callback=${encodeURIComponent(callbackUrl)}`;
|
|
80
|
+
console.log(`\nPlease complete the OAuth flow in your browser.`);
|
|
81
|
+
console.log(`If the browser doesn't open automatically, visit:\n${oauthUrl}\n`);
|
|
82
|
+
// Start a temporary server to receive the OAuth callback
|
|
83
|
+
let tokenReceived = null;
|
|
84
|
+
const server = await new Promise((resolve) => {
|
|
85
|
+
const s = http.createServer((req, res) => {
|
|
86
|
+
if (req.url?.startsWith("/callback")) {
|
|
87
|
+
const url = new URL(req.url, `http://localhost:${serverPort}`);
|
|
88
|
+
tokenReceived = url.searchParams.get("token");
|
|
89
|
+
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
|
|
90
|
+
res.end(`
|
|
91
|
+
<html>
|
|
92
|
+
<head>
|
|
93
|
+
<meta charset="UTF-8">
|
|
94
|
+
</head>
|
|
95
|
+
<body style="font-family: system-ui; padding: 40px; text-align: center;">
|
|
96
|
+
<h2>✅ Authorization successful!</h2>
|
|
97
|
+
<p>You can close this window and return to your terminal.</p>
|
|
98
|
+
<script>setTimeout(() => window.close(), 2000);</script>
|
|
99
|
+
</body>
|
|
100
|
+
</html>
|
|
101
|
+
`);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
res.writeHead(404);
|
|
105
|
+
res.end("Not found");
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
s.listen(serverPort, () => {
|
|
109
|
+
console.log("Waiting for OAuth callback...");
|
|
110
|
+
resolve(s);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
await open(oauthUrl);
|
|
114
|
+
// Wait for the token with timeout
|
|
115
|
+
const startTime = Date.now();
|
|
116
|
+
while (!tokenReceived && Date.now() - startTime < 120000) {
|
|
117
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
118
|
+
}
|
|
119
|
+
server.close();
|
|
120
|
+
const newToken = tokenReceived;
|
|
121
|
+
if (!newToken || !newToken.startsWith("lin_oauth_")) {
|
|
122
|
+
this.logError("Invalid token received from OAuth flow");
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
// Verify the new token
|
|
126
|
+
const verifyResult = await checkLinearToken(newToken);
|
|
127
|
+
if (!verifyResult.valid) {
|
|
128
|
+
this.logError(`New token is invalid: ${verifyResult.error}`);
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
// Update the config - update ALL repositories that had the same old token
|
|
132
|
+
const oldToken = repo.linearToken;
|
|
133
|
+
let updatedCount = 0;
|
|
134
|
+
this.app.config.update((cfg) => {
|
|
135
|
+
for (let i = 0; i < cfg.repositories.length; i++) {
|
|
136
|
+
const currentRepo = cfg.repositories[i];
|
|
137
|
+
if (currentRepo && currentRepo.linearToken === oldToken) {
|
|
138
|
+
currentRepo.linearToken = newToken;
|
|
139
|
+
updatedCount++;
|
|
140
|
+
this.logSuccess(`Updated token for ${currentRepo.name}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return cfg;
|
|
144
|
+
});
|
|
145
|
+
if (updatedCount > 1) {
|
|
146
|
+
console.log(`\n📝 Updated ${updatedCount} repositories that shared the same token`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
this.logSuccess("Configuration saved");
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=RefreshTokenCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefreshTokenCommand.js","sourceRoot":"","sources":["../../../src/commands/RefreshTokenCommand.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,KAAK,UAAU,gBAAgB,CAC9B,KAAa;IAEb,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,gCAAgC,EAAE;YAC9D,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACR,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,KAAK;aACpB;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,8BAA8B;aACrC,CAAC;SACF,CAAC,CAAC;QAEH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AAE;gBAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;oBAClD,MAAM,WAAW,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBACxC,IAAI,WAAW,IAAI,WAAW,CAAC,WAAW,KAAK,QAAQ,EAAE,CAAC;wBACzD,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC;wBACnC,YAAY,EAAE,CAAC;wBACf,IAAI,CAAC,UAAU,CAAC,qBAAqB,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;oBAC1D,CAAC;gBACF,CAAC;gBACD,OAAO,GAAG,CAAC;YACZ,CAAC,CAAC,CAAC;YAEH,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO,CAAC,GAAG,CACV,gBAAgB,YAAY,0CAA0C,CACtE,CAAC;YACH,CAAC;QACF,CAAC;QAED,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;CACD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseCommand } from "./ICommand.js";
|
|
2
|
+
/**
|
|
3
|
+
* Start command - main entry point for starting the edge worker
|
|
4
|
+
*/
|
|
5
|
+
export declare class StartCommand extends BaseCommand {
|
|
6
|
+
execute(_args: string[]): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=StartCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StartCommand.d.ts","sourceRoot":"","sources":["../../../src/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;IACtC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAkF7C"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { BaseCommand } from "./ICommand.js";
|
|
2
|
+
/**
|
|
3
|
+
* Start command - main entry point for starting the edge worker
|
|
4
|
+
*/
|
|
5
|
+
export class StartCommand extends BaseCommand {
|
|
6
|
+
async execute(_args) {
|
|
7
|
+
try {
|
|
8
|
+
// Load edge configuration
|
|
9
|
+
const edgeConfig = this.app.config.load();
|
|
10
|
+
const repositories = edgeConfig.repositories || [];
|
|
11
|
+
// Check if we're in setup waiting mode (no repositories + CYRUS_SETUP_PENDING flag)
|
|
12
|
+
if (repositories.length === 0 &&
|
|
13
|
+
process.env.CYRUS_SETUP_PENDING === "true") {
|
|
14
|
+
// Enable setup waiting mode and start config watcher
|
|
15
|
+
this.app.enableSetupWaitingMode();
|
|
16
|
+
// Start setup waiting mode - server only, no EdgeWorker
|
|
17
|
+
await this.app.worker.startSetupWaitingMode();
|
|
18
|
+
// Setup signal handlers for graceful shutdown
|
|
19
|
+
this.app.setupSignalHandlers();
|
|
20
|
+
// Keep process alive and wait for configuration
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Validate we have repositories configured (normal operation mode)
|
|
24
|
+
if (repositories.length === 0) {
|
|
25
|
+
this.logError("No repositories configured");
|
|
26
|
+
this.logger.info("\nRepositories must be configured in ~/.cyrus/config.json or via environment variables");
|
|
27
|
+
this.logger.info("See https://github.com/ceedaragents/cyrus#configuration for details");
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
// Start the edge worker (SharedApplicationServer will start Cloudflare tunnel if CLOUDFLARE_TOKEN is set)
|
|
31
|
+
await this.app.worker.startEdgeWorker({
|
|
32
|
+
repositories,
|
|
33
|
+
});
|
|
34
|
+
// Display server information
|
|
35
|
+
const serverPort = this.app.worker.getServerPort();
|
|
36
|
+
this.logger.raw("");
|
|
37
|
+
this.logger.divider(70);
|
|
38
|
+
this.logger.success("Edge worker started successfully");
|
|
39
|
+
this.logger.info(`🔗 Server running on port ${serverPort}`);
|
|
40
|
+
if (process.env.CLOUDFLARE_TOKEN) {
|
|
41
|
+
this.logger.info("🌩️ Cloudflare tunnel: Active");
|
|
42
|
+
}
|
|
43
|
+
this.logger.info(`\n📦 Managing ${repositories.length} repositories:`);
|
|
44
|
+
repositories.forEach((repo) => {
|
|
45
|
+
this.logger.info(` • ${repo.name} (${repo.repositoryPath})`);
|
|
46
|
+
});
|
|
47
|
+
this.logger.divider(70);
|
|
48
|
+
// Setup signal handlers for graceful shutdown
|
|
49
|
+
this.app.setupSignalHandlers();
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.logger.error(`Failed to start edge application: ${error.message}`);
|
|
53
|
+
// Provide helpful error guidance
|
|
54
|
+
if (error.message?.includes("CLOUDFLARE_TOKEN")) {
|
|
55
|
+
this.logger.info("\n💡 Cloudflare tunnel requires:");
|
|
56
|
+
this.logger.info(" - CLOUDFLARE_TOKEN environment variable");
|
|
57
|
+
this.logger.info(" - Get your token from: https://app.atcyrus.com/onboarding");
|
|
58
|
+
}
|
|
59
|
+
else if (error.message?.includes("Failed to connect")) {
|
|
60
|
+
this.logger.info("\n💡 Connection issues can occur when:");
|
|
61
|
+
this.logger.info(" - Linear OAuth tokens have expired");
|
|
62
|
+
this.logger.info(" - The Linear API is temporarily unavailable");
|
|
63
|
+
this.logger.info(" - Your network connection is having issues");
|
|
64
|
+
}
|
|
65
|
+
await this.app.shutdown();
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=StartCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StartCommand.js","sourceRoot":"","sources":["../../../src/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC5C,KAAK,CAAC,OAAO,CAAC,KAAe;QAC5B,IAAI,C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C,CAAC;gBAC1D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;gBACnE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;YACnE,CAAC;YAED,MAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application constants
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Default server port for OAuth callbacks and webhooks
|
|
6
|
+
*/
|
|
7
|
+
export declare const DEFAULT_SERVER_PORT = 3456;
|
|
8
|
+
/**
|
|
9
|
+
* Parse a port number from string with validation
|
|
10
|
+
*/
|
|
11
|
+
export declare function parsePort(value: string | undefined, defaultPort: number): number;
|
|
12
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;GAEG;AACH,wBAAgB,SAAS,CACxB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,WAAW,EAAE,MAAM,GACjB,MAAM,CAMR"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application constants
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Default server port for OAuth callbacks and webhooks
|
|
6
|
+
*/
|
|
7
|
+
export const DEFAULT_SERVER_PORT = 3456;
|
|
8
|
+
/**
|
|
9
|
+
* Parse a port number from string with validation
|
|
10
|
+
*/
|
|
11
|
+
export function parsePort(value, defaultPort) {
|
|
12
|
+
if (!value)
|
|
13
|
+
return defaultPort;
|
|
14
|
+
const parsed = parseInt(value, 10);
|
|
15
|
+
return Number.isNaN(parsed) || parsed < 1 || parsed > 65535
|
|
16
|
+
? defaultPort
|
|
17
|
+
: parsed;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,SAAS,CACxB,KAAyB,EACzB,WAAmB;IAEnB,IAAI,CAAC,KAAK;QAAE,OAAO,WAAW,CAAC;IAC/B,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,KAAK;QAC1D,CAAC,CAAC,WAAW;QACb,CAAC,CAAC,MAAM,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EdgeConfig } from "cyrus-core";
|
|
2
|
+
/**
|
|
3
|
+
* Linear credentials obtained from OAuth flow
|
|
4
|
+
*/
|
|
5
|
+
export interface LinearCredentials {
|
|
6
|
+
linearToken: string;
|
|
7
|
+
linearWorkspaceId: string;
|
|
8
|
+
linearWorkspaceName: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Workspace information for issue processing
|
|
12
|
+
*/
|
|
13
|
+
export interface Workspace {
|
|
14
|
+
path: string;
|
|
15
|
+
isGitWorktree: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Re-export EdgeConfig from cyrus-core for convenience
|
|
19
|
+
*/
|
|
20
|
+
export type { EdgeConfig };
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/config/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EdgeConfig } from "../config/types.js";
|
|
2
|
+
import type { Logger } from "./Logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Service responsible for configuration management
|
|
5
|
+
* Handles loading, saving, and validation of edge configuration
|
|
6
|
+
*/
|
|
7
|
+
export declare class ConfigService {
|
|
8
|
+
private logger;
|
|
9
|
+
private configPath;
|
|
10
|
+
constructor(cyrusHome: string, logger: Logger);
|
|
11
|
+
/**
|
|
12
|
+
* Get the configuration file path
|
|
13
|
+
*/
|
|
14
|
+
getConfigPath(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Load edge configuration from disk
|
|
17
|
+
*/
|
|
18
|
+
load(): EdgeConfig;
|
|
19
|
+
/**
|
|
20
|
+
* Save edge configuration to disk
|
|
21
|
+
*/
|
|
22
|
+
save(config: EdgeConfig): void;
|
|
23
|
+
/**
|
|
24
|
+
* Update a specific field in the configuration
|
|
25
|
+
*/
|
|
26
|
+
update(updater: (config: EdgeConfig) => EdgeConfig): void;
|
|
27
|
+
/**
|
|
28
|
+
* Check if configuration exists
|
|
29
|
+
*/
|
|
30
|
+
exists(): boolean;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ConfigService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigService.d.ts","sourceRoot":"","sources":["../../../src/services/ConfigService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;;GAGG;AACH,qBAAa,aAAa;IAKxB,OAAO,CAAC,MAAM;IAJf,OAAO,CAAC,UAAU,CAAS;gBAG1B,SAAS,EAAE,MAAM,EACT,MAAM,EAAE,MAAM;IAKvB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,IAAI,IAAI,UAAU;IA8BlB;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAW9B;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAAG,IAAI;IAMzD;;OAEG;IACH,MAAM,IAAI,OAAO;CAGjB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Service responsible for configuration management
|
|
5
|
+
* Handles loading, saving, and validation of edge configuration
|
|
6
|
+
*/
|
|
7
|
+
export class ConfigService {
|
|
8
|
+
logger;
|
|
9
|
+
configPath;
|
|
10
|
+
constructor(cyrusHome, logger) {
|
|
11
|
+
this.logger = logger;
|
|
12
|
+
this.configPath = resolve(cyrusHome, "config.json");
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get the configuration file path
|
|
16
|
+
*/
|
|
17
|
+
getConfigPath() {
|
|
18
|
+
return this.configPath;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Load edge configuration from disk
|
|
22
|
+
*/
|
|
23
|
+
load() {
|
|
24
|
+
let config = { repositories: [] };
|
|
25
|
+
if (existsSync(this.configPath)) {
|
|
26
|
+
try {
|
|
27
|
+
const content = readFileSync(this.configPath, "utf-8");
|
|
28
|
+
config = JSON.parse(content);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
this.logger.error(`Failed to load edge config: ${e.message}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Strip promptTemplatePath from all repositories to ensure built-in template is used
|
|
35
|
+
if (config.repositories) {
|
|
36
|
+
config.repositories = config.repositories.map((repo) => {
|
|
37
|
+
const { promptTemplatePath, ...repoWithoutTemplate } = repo;
|
|
38
|
+
if (promptTemplatePath) {
|
|
39
|
+
this.logger.info(`Ignoring custom prompt template for repository: ${repo.name} (using built-in template)`);
|
|
40
|
+
}
|
|
41
|
+
return repoWithoutTemplate;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return config;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Save edge configuration to disk
|
|
48
|
+
*/
|
|
49
|
+
save(config) {
|
|
50
|
+
const configDir = dirname(this.configPath);
|
|
51
|
+
// Ensure the ~/.cyrus directory exists
|
|
52
|
+
if (!existsSync(configDir)) {
|
|
53
|
+
mkdirSync(configDir, { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
writeFileSync(this.configPath, JSON.stringify(config, null, 2));
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Update a specific field in the configuration
|
|
59
|
+
*/
|
|
60
|
+
update(updater) {
|
|
61
|
+
const config = this.load();
|
|
62
|
+
const updated = updater(config);
|
|
63
|
+
this.save(updated);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Check if configuration exists
|
|
67
|
+
*/
|
|
68
|
+
exists() {
|
|
69
|
+
return existsSync(this.configPath);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=ConfigService.js.map
|
|
@@ -0,0 +1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IAAI,CAAC,MAAM,CAAC,IAAI,CACf,mDAAmD,IAAI,CAAC,IAAI,4BAA4B,CACxF,CAAC;gBACH,CAAC;gBACD,OAAO,mBAAmB,CAAC;YAC5B,CAAC,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,MAAkB;QACtB,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAE3C,uCAAuC;QACvC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5B,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,CAAC;QAED,aAAa,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAA2C;QACjD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,MAAM;QACL,OAAO,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;CACD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Issue } from "@linear/sdk";
|
|
2
|
+
import type { RepositoryConfig } from "cyrus-core";
|
|
3
|
+
import type { Workspace } from "../config/types.js";
|
|
4
|
+
import type { Logger } from "./Logger.js";
|
|
5
|
+
/**
|
|
6
|
+
* Service responsible for Git worktree operations
|
|
7
|
+
*/
|
|
8
|
+
export declare class GitService {
|
|
9
|
+
private logger;
|
|
10
|
+
constructor(logger: Logger);
|
|
11
|
+
/**
|
|
12
|
+
* Check if a branch exists locally or remotely
|
|
13
|
+
*/
|
|
14
|
+
branchExists(branchName: string, repoPath: string): Promise<boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Sanitize branch name by removing backticks to prevent command injection
|
|
17
|
+
*/
|
|
18
|
+
private sanitizeBranchName;
|
|
19
|
+
/**
|
|
20
|
+
* Run a setup script with proper error handling and logging
|
|
21
|
+
*/
|
|
22
|
+
private runSetupScript;
|
|
23
|
+
/**
|
|
24
|
+
* Create a git worktree for an issue
|
|
25
|
+
*/
|
|
26
|
+
createGitWorktree(issue: Issue, repository: RepositoryConfig, globalSetupScript?: string): Promise<Workspace>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=GitService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitService.d.ts","sourceRoot":"","sources":["../../../src/services/GitService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,qBAAa,UAAU;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAClC;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IA0B1E;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;YACW,cAAc;IA4F5B;;OAEG;IACG,iBAAiB,CACtB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,gBAAgB,EAC5B,iBAAiB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,SAAS,CAAC;CAoRrB"}
|