sylas-ai 0.2.21
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.
Potentially problematic release.
This version of sylas-ai might be problematic. Click here for more details.
- package/README.md +52 -0
- package/dist/Application.d.ts +75 -0
- package/dist/Application.d.ts.map +1 -0
- package/dist/Application.js +289 -0
- package/dist/Application.js.map +1 -0
- package/dist/app.d.ts +3 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +93 -0
- package/dist/app.js.map +1 -0
- package/dist/commands/AuthCommand.d.ts +8 -0
- package/dist/commands/AuthCommand.d.ts.map +1 -0
- package/dist/commands/AuthCommand.js +70 -0
- package/dist/commands/AuthCommand.js.map +1 -0
- package/dist/commands/CheckTokensCommand.d.ts +8 -0
- package/dist/commands/CheckTokensCommand.d.ts.map +1 -0
- package/dist/commands/CheckTokensCommand.js +53 -0
- package/dist/commands/CheckTokensCommand.js.map +1 -0
- package/dist/commands/ICommand.d.ts +38 -0
- package/dist/commands/ICommand.d.ts.map +1 -0
- package/dist/commands/ICommand.js +37 -0
- package/dist/commands/ICommand.js.map +1 -0
- package/dist/commands/RefreshTokenCommand.d.ts +8 -0
- package/dist/commands/RefreshTokenCommand.d.ts.map +1 -0
- package/dist/commands/RefreshTokenCommand.js +152 -0
- package/dist/commands/RefreshTokenCommand.js.map +1 -0
- package/dist/commands/SelfAddRepoCommand.d.ts +17 -0
- package/dist/commands/SelfAddRepoCommand.d.ts.map +1 -0
- package/dist/commands/SelfAddRepoCommand.js +164 -0
- package/dist/commands/SelfAddRepoCommand.js.map +1 -0
- package/dist/commands/SelfAuthCommand.d.ts +16 -0
- package/dist/commands/SelfAuthCommand.d.ts.map +1 -0
- package/dist/commands/SelfAuthCommand.js +213 -0
- package/dist/commands/SelfAuthCommand.js.map +1 -0
- package/dist/commands/StartCommand.d.ts +8 -0
- package/dist/commands/StartCommand.d.ts.map +1 -0
- package/dist/commands/StartCommand.js +76 -0
- package/dist/commands/StartCommand.js.map +1 -0
- package/dist/config/constants.d.ts +12 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +19 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/types.d.ts +21 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +2 -0
- package/dist/config/types.js.map +1 -0
- package/dist/services/ConfigService.d.ts +37 -0
- package/dist/services/ConfigService.d.ts.map +1 -0
- package/dist/services/ConfigService.js +121 -0
- package/dist/services/ConfigService.js.map +1 -0
- package/dist/services/Logger.d.ts +77 -0
- package/dist/services/Logger.d.ts.map +1 -0
- package/dist/services/Logger.js +100 -0
- package/dist/services/Logger.js.map +1 -0
- package/dist/services/WorkerService.d.ts +59 -0
- package/dist/services/WorkerService.d.ts.map +1 -0
- package/dist/services/WorkerService.js +220 -0
- package/dist/services/WorkerService.js.map +1 -0
- package/dist/src/Application.d.ts +75 -0
- package/dist/src/Application.d.ts.map +1 -0
- package/dist/src/Application.js +289 -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 +93 -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 +70 -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/SelfAddRepoCommand.d.ts +17 -0
- package/dist/src/commands/SelfAddRepoCommand.d.ts.map +1 -0
- package/dist/src/commands/SelfAddRepoCommand.js +164 -0
- package/dist/src/commands/SelfAddRepoCommand.js.map +1 -0
- package/dist/src/commands/SelfAuthCommand.d.ts +16 -0
- package/dist/src/commands/SelfAuthCommand.d.ts.map +1 -0
- package/dist/src/commands/SelfAuthCommand.js +213 -0
- package/dist/src/commands/SelfAuthCommand.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 +76 -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 +37 -0
- package/dist/src/services/ConfigService.d.ts.map +1 -0
- package/dist/src/services/ConfigService.js +121 -0
- package/dist/src/services/ConfigService.js.map +1 -0
- package/dist/src/services/Logger.d.ts +77 -0
- package/dist/src/services/Logger.d.ts.map +1 -0
- package/dist/src/services/Logger.js +100 -0
- package/dist/src/services/Logger.js.map +1 -0
- package/dist/src/services/WorkerService.d.ts +59 -0
- package/dist/src/services/WorkerService.d.ts.map +1 -0
- package/dist/src/services/WorkerService.js +220 -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/dist/ui/CLIPrompts.d.ts +18 -0
- package/dist/ui/CLIPrompts.d.ts.map +1 -0
- package/dist/ui/CLIPrompts.js +53 -0
- package/dist/ui/CLIPrompts.js.map +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +13 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { LinearClient } from "@linear/sdk";
|
|
4
|
+
import Fastify from "fastify";
|
|
5
|
+
import open from "open";
|
|
6
|
+
import { DEFAULT_CONFIG_FILENAME } from "sylas-core";
|
|
7
|
+
import { BaseCommand } from "./ICommand.js";
|
|
8
|
+
/**
|
|
9
|
+
* Self-auth command - authenticate with Linear OAuth directly from CLI
|
|
10
|
+
* Handles the complete OAuth flow without requiring EdgeWorker
|
|
11
|
+
*/
|
|
12
|
+
export class SelfAuthCommand extends BaseCommand {
|
|
13
|
+
server = null;
|
|
14
|
+
callbackPort = parseInt(process.env.SYLAS_SERVER_PORT || "3456", 10);
|
|
15
|
+
async execute(_args) {
|
|
16
|
+
console.log("\nSylas Linear Self-Authentication");
|
|
17
|
+
this.logDivider();
|
|
18
|
+
// Check required environment variables
|
|
19
|
+
const clientId = process.env.LINEAR_CLIENT_ID;
|
|
20
|
+
const clientSecret = process.env.LINEAR_CLIENT_SECRET;
|
|
21
|
+
const baseUrl = process.env.SYLAS_BASE_URL;
|
|
22
|
+
if (!clientId || !clientSecret || !baseUrl) {
|
|
23
|
+
this.logError("Missing required environment variables:");
|
|
24
|
+
if (!clientId)
|
|
25
|
+
console.log(" - LINEAR_CLIENT_ID");
|
|
26
|
+
if (!clientSecret)
|
|
27
|
+
console.log(" - LINEAR_CLIENT_SECRET");
|
|
28
|
+
if (!baseUrl)
|
|
29
|
+
console.log(" - SYLAS_BASE_URL");
|
|
30
|
+
console.log("\nSet these in your shell profile (.zshrc):");
|
|
31
|
+
console.log(" export LINEAR_CLIENT_ID='your-client-id'");
|
|
32
|
+
console.log(" export LINEAR_CLIENT_SECRET='your-client-secret'");
|
|
33
|
+
console.log(" export SYLAS_BASE_URL='https://your-tunnel-domain.com'");
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
// Check config file exists
|
|
37
|
+
const configPath = resolve(this.app.sylasHome, DEFAULT_CONFIG_FILENAME);
|
|
38
|
+
let config;
|
|
39
|
+
try {
|
|
40
|
+
config = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
this.logError(`Config file not found: ${configPath}`);
|
|
44
|
+
console.log("Run 'sylas' first to create initial configuration.");
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
console.log("Configuration:");
|
|
48
|
+
console.log(` Client ID: ${clientId.substring(0, 20)}...`);
|
|
49
|
+
console.log(` Base URL: ${baseUrl}`);
|
|
50
|
+
console.log(` Config: ${configPath}`);
|
|
51
|
+
console.log(` Callback port: ${this.callbackPort}`);
|
|
52
|
+
console.log();
|
|
53
|
+
try {
|
|
54
|
+
// Start temporary server to receive OAuth callback
|
|
55
|
+
const authCode = await this.waitForCallback(clientId);
|
|
56
|
+
// Exchange code for tokens
|
|
57
|
+
console.log("Exchanging code for tokens...");
|
|
58
|
+
const tokens = await this.exchangeCodeForTokens(authCode, clientId, clientSecret);
|
|
59
|
+
this.logSuccess(`Got access token: ${tokens.accessToken.substring(0, 30)}...`);
|
|
60
|
+
// Fetch workspace info
|
|
61
|
+
console.log("Fetching workspace info...");
|
|
62
|
+
const workspace = await this.fetchWorkspaceInfo(tokens.accessToken);
|
|
63
|
+
this.logSuccess(`Workspace: ${workspace.name} (${workspace.id})`);
|
|
64
|
+
// Update config.json
|
|
65
|
+
console.log("Saving tokens to config.json...");
|
|
66
|
+
this.overwriteRepoConfigTokens(config, configPath, tokens, workspace);
|
|
67
|
+
const updatedCount = config.repositories.filter((r) => r.linearWorkspaceId === workspace.id).length;
|
|
68
|
+
this.logSuccess(`Updated ${updatedCount} repository/repositories`);
|
|
69
|
+
console.log();
|
|
70
|
+
this.logSuccess("Authentication complete! Restart sylas to use the new tokens.");
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
this.logError(`Authentication failed: ${error.message}`);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
// One of the key guarantees of finally — it runs regardless of how the try block exits (return, throw, or normal completion).
|
|
79
|
+
await this.cleanup();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async waitForCallback(clientId) {
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
const baseUrl = process.env.SYLAS_BASE_URL;
|
|
85
|
+
if (!baseUrl) {
|
|
86
|
+
reject(new Error("SYLAS_BASE_URL environment variable is required"));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const redirectUri = `${baseUrl}/callback`;
|
|
90
|
+
// https://linear.app/developers/oauth-2-0-authentication
|
|
91
|
+
// https://linear.app/developers/oauth-actor-authorization
|
|
92
|
+
const oauthUrl = `https://linear.app/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=write,app:assignable,app:mentionable&actor=app`;
|
|
93
|
+
this.server = Fastify({ logger: false });
|
|
94
|
+
this.server.get("/callback", async (request, reply) => {
|
|
95
|
+
const query = request.query;
|
|
96
|
+
const code = query.code;
|
|
97
|
+
const error = query.error;
|
|
98
|
+
if (error) {
|
|
99
|
+
reply
|
|
100
|
+
.type("text/html; charset=utf-8")
|
|
101
|
+
.code(400)
|
|
102
|
+
.send(`<!DOCTYPE html>
|
|
103
|
+
<html><head><meta charset="utf-8"></head>
|
|
104
|
+
<body style="font-family: system-ui; padding: 40px; text-align: center;">
|
|
105
|
+
<h2>Authorization failed</h2>
|
|
106
|
+
<p>${error}</p>
|
|
107
|
+
</body></html>`);
|
|
108
|
+
reject(new Error(`OAuth error: ${error}`));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (code) {
|
|
112
|
+
reply
|
|
113
|
+
.type("text/html; charset=utf-8")
|
|
114
|
+
.code(200)
|
|
115
|
+
.send(`<!DOCTYPE html>
|
|
116
|
+
<html><head><meta charset="utf-8"></head>
|
|
117
|
+
<body style="font-family: system-ui; padding: 40px; text-align: center;">
|
|
118
|
+
<h2>Sylas authorized successfully</h2>
|
|
119
|
+
<p>You can close this window and return to the terminal.</p>
|
|
120
|
+
</body></html>`);
|
|
121
|
+
resolve(code);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
reply
|
|
125
|
+
.type("text/html; charset=utf-8")
|
|
126
|
+
.code(400)
|
|
127
|
+
.send(`<!DOCTYPE html>
|
|
128
|
+
<html><head><meta charset="utf-8"></head>
|
|
129
|
+
<body style="font-family: system-ui; padding: 40px; text-align: center;">
|
|
130
|
+
<h2>Missing authorization code</h2>
|
|
131
|
+
</body></html>`);
|
|
132
|
+
reject(new Error("Missing authorization code"));
|
|
133
|
+
});
|
|
134
|
+
this.server
|
|
135
|
+
.listen({ port: this.callbackPort, host: "0.0.0.0" })
|
|
136
|
+
.then(() => {
|
|
137
|
+
console.log(`Waiting for authorization on port ${this.callbackPort}...`);
|
|
138
|
+
console.log();
|
|
139
|
+
console.log("Opening browser for Linear authorization...");
|
|
140
|
+
console.log();
|
|
141
|
+
console.log("If browser doesn't open, visit:");
|
|
142
|
+
console.log(oauthUrl);
|
|
143
|
+
console.log();
|
|
144
|
+
open(oauthUrl).catch(() => {
|
|
145
|
+
console.log("Could not open browser automatically.");
|
|
146
|
+
});
|
|
147
|
+
})
|
|
148
|
+
.catch((err) => {
|
|
149
|
+
reject(new Error(`Server error: ${err.message}`));
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async exchangeCodeForTokens(code, clientId, clientSecret) {
|
|
154
|
+
const baseUrl = process.env.SYLAS_BASE_URL;
|
|
155
|
+
const redirectUri = `${baseUrl}/callback`;
|
|
156
|
+
// https://linear.app/developers/oauth-2-0-authentication
|
|
157
|
+
const response = await fetch("https://api.linear.app/oauth/token", {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers: {
|
|
160
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
161
|
+
},
|
|
162
|
+
body: new URLSearchParams({
|
|
163
|
+
code,
|
|
164
|
+
redirect_uri: redirectUri,
|
|
165
|
+
client_id: clientId,
|
|
166
|
+
client_secret: clientSecret,
|
|
167
|
+
grant_type: "authorization_code",
|
|
168
|
+
}).toString(),
|
|
169
|
+
});
|
|
170
|
+
if (!response.ok) {
|
|
171
|
+
const errorText = await response.text();
|
|
172
|
+
throw new Error(`Token exchange failed: ${errorText}`);
|
|
173
|
+
}
|
|
174
|
+
const data = (await response.json());
|
|
175
|
+
if (!data.access_token || !data.access_token.startsWith("lin_oauth_")) {
|
|
176
|
+
throw new Error("Invalid access token received");
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
accessToken: data.access_token,
|
|
180
|
+
refreshToken: data.refresh_token,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
async fetchWorkspaceInfo(accessToken) {
|
|
184
|
+
const linearClient = new LinearClient({ accessToken });
|
|
185
|
+
const viewer = await linearClient.viewer;
|
|
186
|
+
const organization = await viewer.organization;
|
|
187
|
+
if (!organization?.id) {
|
|
188
|
+
throw new Error("Failed to get workspace info from Linear");
|
|
189
|
+
}
|
|
190
|
+
return { id: organization.id, name: organization.name || organization.id };
|
|
191
|
+
}
|
|
192
|
+
overwriteRepoConfigTokens(config, configPath, tokens, workspace) {
|
|
193
|
+
// Update all repositories matching this workspace (or unset workspace)
|
|
194
|
+
for (const repo of config.repositories) {
|
|
195
|
+
if (repo.linearWorkspaceId === workspace.id ||
|
|
196
|
+
!repo.linearWorkspaceId ||
|
|
197
|
+
repo.linearWorkspaceId === "") {
|
|
198
|
+
repo.linearToken = tokens.accessToken;
|
|
199
|
+
repo.linearRefreshToken = tokens.refreshToken;
|
|
200
|
+
repo.linearWorkspaceId = workspace.id;
|
|
201
|
+
repo.linearWorkspaceName = workspace.name;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
writeFileSync(configPath, JSON.stringify(config, null, "\t"), "utf-8");
|
|
205
|
+
}
|
|
206
|
+
async cleanup() {
|
|
207
|
+
if (this.server) {
|
|
208
|
+
await this.server.close();
|
|
209
|
+
this.server = null;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=SelfAuthCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfAuthCommand.js","sourceRoot":"","sources":["../../src/commands/SelfAuthCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,OAAiC,MAAM,SAAS,CAAC;AACxD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAmB,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,WAAW;IACvC,MAAM,GAA2B,IAAI,CAAC;IACtC,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;IAE7E,KAAK,CAAC,OAAO,CAAC,KAAe;QAC5B,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,uCAAuC;QACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAA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I,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAEO,KAAK,CAAC,OAAO;QACpB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACpB,CAAC;IACF,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":"AAEA,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;CAsF7C"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getSylasAppUrl } from "sylas-cloudflare-tunnel-client";
|
|
2
|
+
import { BaseCommand } from "./ICommand.js";
|
|
3
|
+
/**
|
|
4
|
+
* Start command - main entry point for starting the edge worker
|
|
5
|
+
*/
|
|
6
|
+
export class StartCommand extends BaseCommand {
|
|
7
|
+
async execute(_args) {
|
|
8
|
+
try {
|
|
9
|
+
// Load edge configuration
|
|
10
|
+
const edgeConfig = this.app.config.load();
|
|
11
|
+
const repositories = edgeConfig.repositories || [];
|
|
12
|
+
// Check if we're in setup waiting mode (no repositories + SYLAS_SETUP_PENDING flag)
|
|
13
|
+
if (repositories.length === 0 &&
|
|
14
|
+
process.env.SYLAS_SETUP_PENDING === "true") {
|
|
15
|
+
// Enable setup waiting mode and start config watcher
|
|
16
|
+
this.app.enableSetupWaitingMode();
|
|
17
|
+
// Start setup waiting mode - server only, no EdgeWorker
|
|
18
|
+
await this.app.worker.startSetupWaitingMode();
|
|
19
|
+
// Setup signal handlers for graceful shutdown
|
|
20
|
+
this.app.setupSignalHandlers();
|
|
21
|
+
// Keep process alive and wait for configuration
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Check if we're in idle mode (no repositories, post-onboarding)
|
|
25
|
+
if (repositories.length === 0) {
|
|
26
|
+
// Enable idle mode and start config watcher
|
|
27
|
+
this.app.enableIdleMode();
|
|
28
|
+
// Start idle mode - server infrastructure only, no EdgeWorker
|
|
29
|
+
await this.app.worker.startIdleMode();
|
|
30
|
+
// Setup signal handlers for graceful shutdown
|
|
31
|
+
this.app.setupSignalHandlers();
|
|
32
|
+
// Keep process alive and wait for configuration
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Start the edge worker (SharedApplicationServer will start Cloudflare tunnel if CLOUDFLARE_TOKEN is set)
|
|
36
|
+
await this.app.worker.startEdgeWorker({
|
|
37
|
+
repositories,
|
|
38
|
+
});
|
|
39
|
+
// Display server information
|
|
40
|
+
const serverPort = this.app.worker.getServerPort();
|
|
41
|
+
this.logger.raw("");
|
|
42
|
+
this.logger.divider(70);
|
|
43
|
+
this.logger.success("Edge worker started successfully");
|
|
44
|
+
this.logger.info(`📌 Version: ${this.app.version}`);
|
|
45
|
+
this.logger.info(`🔗 Server running on port ${serverPort}`);
|
|
46
|
+
if (process.env.CLOUDFLARE_TOKEN) {
|
|
47
|
+
this.logger.info("🌩️ Cloudflare tunnel: Active");
|
|
48
|
+
}
|
|
49
|
+
this.logger.info(`\n📦 Managing ${repositories.length} repositories:`);
|
|
50
|
+
repositories.forEach((repo) => {
|
|
51
|
+
this.logger.info(` • ${repo.name} (${repo.repositoryPath})`);
|
|
52
|
+
});
|
|
53
|
+
this.logger.divider(70);
|
|
54
|
+
// Setup signal handlers for graceful shutdown
|
|
55
|
+
this.app.setupSignalHandlers();
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
this.logger.error(`Failed to start edge application: ${error.message}`);
|
|
59
|
+
// Provide helpful error guidance
|
|
60
|
+
if (error.message?.includes("CLOUDFLARE_TOKEN")) {
|
|
61
|
+
this.logger.info("\n💡 Cloudflare tunnel requires:");
|
|
62
|
+
this.logger.info(" - CLOUDFLARE_TOKEN environment variable");
|
|
63
|
+
this.logger.info(` - Get your token from: ${getSylasAppUrl()}/onboarding`);
|
|
64
|
+
}
|
|
65
|
+
else if (error.message?.includes("Failed to connect")) {
|
|
66
|
+
this.logger.info("\n💡 Connection issues can occur when:");
|
|
67
|
+
this.logger.info(" - Linear OAuth tokens have expired");
|
|
68
|
+
this.logger.info(" - The Linear API is temporarily unavailable");
|
|
69
|
+
this.logger.info(" - Your network connection is having issues");
|
|
70
|
+
}
|
|
71
|
+
await this.app.shutdown();
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=StartCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StartCommand.js","sourceRoot":"","sources":["../../src/commands/StartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC5C,KAAK,CAAC,OAAO,CAAC,KAAe;QAC5B,IAAI,CAAC;YACJ,0BAA0B;YAC1B,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1C,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,EAAE,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,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 "sylas-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 sylas-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,37 @@
|
|
|
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(sylasHome: 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
|
+
* Run migrations on config to ensure it's up to date
|
|
21
|
+
* Persists changes to disk if any migrations were applied
|
|
22
|
+
*/
|
|
23
|
+
private migrateConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Save edge configuration to disk
|
|
26
|
+
*/
|
|
27
|
+
save(config: EdgeConfig): void;
|
|
28
|
+
/**
|
|
29
|
+
* Update a specific field in the configuration
|
|
30
|
+
*/
|
|
31
|
+
update(updater: (config: EdgeConfig) => EdgeConfig): void;
|
|
32
|
+
/**
|
|
33
|
+
* Check if configuration exists
|
|
34
|
+
*/
|
|
35
|
+
exists(): boolean;
|
|
36
|
+
}
|
|
37
|
+
//# 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;IAmClB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAuDrB;;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,121 @@
|
|
|
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(sylasHome, logger) {
|
|
11
|
+
this.logger = logger;
|
|
12
|
+
this.configPath = resolve(sylasHome, "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
|
+
// Run migrations on loaded config
|
|
45
|
+
config = this.migrateConfig(config);
|
|
46
|
+
return config;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Run migrations on config to ensure it's up to date
|
|
50
|
+
* Persists changes to disk if any migrations were applied
|
|
51
|
+
*/
|
|
52
|
+
migrateConfig(config) {
|
|
53
|
+
let configModified = false;
|
|
54
|
+
// Migration: Rename legacy global model fields to Claude-specific names
|
|
55
|
+
// Keep old values but move them to the new keys and remove deprecated fields.
|
|
56
|
+
if (config.defaultModel !== undefined) {
|
|
57
|
+
if (!config.claudeDefaultModel) {
|
|
58
|
+
config.claudeDefaultModel = config.defaultModel;
|
|
59
|
+
this.logger.info(`[Migration] Moved "defaultModel" to "claudeDefaultModel"`);
|
|
60
|
+
}
|
|
61
|
+
delete config.defaultModel;
|
|
62
|
+
configModified = true;
|
|
63
|
+
}
|
|
64
|
+
if (config.defaultFallbackModel !== undefined) {
|
|
65
|
+
if (!config.claudeDefaultFallbackModel) {
|
|
66
|
+
config.claudeDefaultFallbackModel = config.defaultFallbackModel;
|
|
67
|
+
this.logger.info(`[Migration] Moved "defaultFallbackModel" to "claudeDefaultFallbackModel"`);
|
|
68
|
+
}
|
|
69
|
+
delete config
|
|
70
|
+
.defaultFallbackModel;
|
|
71
|
+
configModified = true;
|
|
72
|
+
}
|
|
73
|
+
// Migration: Add "Skill" to allowedTools arrays that don't have it
|
|
74
|
+
// This enables Claude Skills functionality for existing configurations
|
|
75
|
+
// See: https://code.claude.com/docs/en/skills
|
|
76
|
+
// See: https://platform.claude.com/docs/en/agent-sdk/skills
|
|
77
|
+
if (config.repositories) {
|
|
78
|
+
for (const repo of config.repositories) {
|
|
79
|
+
if (repo.allowedTools && Array.isArray(repo.allowedTools)) {
|
|
80
|
+
if (!repo.allowedTools.includes("Skill")) {
|
|
81
|
+
repo.allowedTools.push("Skill");
|
|
82
|
+
configModified = true;
|
|
83
|
+
this.logger.info(`[Migration] Added "Skill" to allowedTools for repository: ${repo.name}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Persist changes if any migrations were applied
|
|
89
|
+
if (configModified) {
|
|
90
|
+
this.save(config);
|
|
91
|
+
this.logger.info("[Migration] Configuration updated and saved to disk");
|
|
92
|
+
}
|
|
93
|
+
return config;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Save edge configuration to disk
|
|
97
|
+
*/
|
|
98
|
+
save(config) {
|
|
99
|
+
const configDir = dirname(this.configPath);
|
|
100
|
+
// Ensure the ~/.sylas directory exists
|
|
101
|
+
if (!existsSync(configDir)) {
|
|
102
|
+
mkdirSync(configDir, { recursive: true });
|
|
103
|
+
}
|
|
104
|
+
writeFileSync(this.configPath, JSON.stringify(config, null, 2));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Update a specific field in the configuration
|
|
108
|
+
*/
|
|
109
|
+
update(updater) {
|
|
110
|
+
const config = this.load();
|
|
111
|
+
const updated = updater(config);
|
|
112
|
+
this.save(updated);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Check if configuration exists
|
|
116
|
+
*/
|
|
117
|
+
exists() {
|
|
118
|
+
return existsSync(this.configPath);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=ConfigService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigService.js","sourceRoot":"","sources":["../../src/services/ConfigService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAI7C;;;GAGG;AACH,MAAM,OAAO,aAAa;IAKhB;IAJD,UAAU,CAAS;IAE3B,YACC,SAAiB,EACT,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAEtB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACH,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI;QACH,IAAI,MAAM,GAAe,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;QAE9C,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC;gBACJ,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;gBACvD,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACZ,IAAI,CAAC,MAAM,CAAC,KAAK,C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C,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,77 @@
|
|
|
1
|
+
import { type ILogger, type LogContext, type LogLevel } from "sylas-core";
|
|
2
|
+
export { LogLevel } from "sylas-core";
|
|
3
|
+
/**
|
|
4
|
+
* Logger configuration options
|
|
5
|
+
*/
|
|
6
|
+
export interface LoggerOptions {
|
|
7
|
+
/** Minimum log level to output */
|
|
8
|
+
level?: LogLevel;
|
|
9
|
+
/** Prefix to add to all log messages (used as component name) */
|
|
10
|
+
prefix?: string;
|
|
11
|
+
/** Whether to include timestamps */
|
|
12
|
+
timestamps?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* CLI-specific logger that wraps the core ILogger.
|
|
16
|
+
*
|
|
17
|
+
* Provides CLI-presentation features (emoji formatting, raw output,
|
|
18
|
+
* dividers, child loggers) on top of the standard core logging interface.
|
|
19
|
+
*
|
|
20
|
+
* Implements ILogger so it can be passed to packages that expect the core interface.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Logger implements ILogger {
|
|
23
|
+
private coreLogger;
|
|
24
|
+
private prefix;
|
|
25
|
+
private timestamps;
|
|
26
|
+
constructor(options?: LoggerOptions);
|
|
27
|
+
/**
|
|
28
|
+
* Debug log (lowest priority)
|
|
29
|
+
*/
|
|
30
|
+
debug(message: string, ...args: any[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* Info log (normal priority)
|
|
33
|
+
*/
|
|
34
|
+
info(message: string, ...args: any[]): void;
|
|
35
|
+
/**
|
|
36
|
+
* Success log - maps to info level with check mark prefix
|
|
37
|
+
*/
|
|
38
|
+
success(message: string, ...args: any[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* Warning log
|
|
41
|
+
*/
|
|
42
|
+
warn(message: string, ...args: any[]): void;
|
|
43
|
+
/**
|
|
44
|
+
* Error log (highest priority)
|
|
45
|
+
*/
|
|
46
|
+
error(message: string, ...args: any[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* Raw output without formatting (always outputs regardless of level)
|
|
49
|
+
*/
|
|
50
|
+
raw(message: string, ...args: any[]): void;
|
|
51
|
+
/**
|
|
52
|
+
* Create a child logger with a prefix
|
|
53
|
+
*/
|
|
54
|
+
child(prefix: string): Logger;
|
|
55
|
+
/**
|
|
56
|
+
* Print a divider line
|
|
57
|
+
*/
|
|
58
|
+
divider(length?: number): void;
|
|
59
|
+
/**
|
|
60
|
+
* Create a new logger with additional context.
|
|
61
|
+
* Delegates to the core logger's withContext.
|
|
62
|
+
*/
|
|
63
|
+
withContext(context: LogContext): ILogger;
|
|
64
|
+
/**
|
|
65
|
+
* Set log level dynamically
|
|
66
|
+
*/
|
|
67
|
+
setLevel(level: LogLevel): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get current log level
|
|
70
|
+
*/
|
|
71
|
+
getLevel(): LogLevel;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Default logger instance
|
|
75
|
+
*/
|
|
76
|
+
export declare const logger: Logger;
|
|
77
|
+
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/services/Logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;GAEG;AACH,MAAM,WAAW,aAAa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