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,220 @@
|
|
|
1
|
+
import { getSylasAppUrl } from "sylas-cloudflare-tunnel-client";
|
|
2
|
+
import { EdgeWorker } from "sylas-edge-worker";
|
|
3
|
+
import { DEFAULT_SERVER_PORT, parsePort } from "../config/constants.js";
|
|
4
|
+
/**
|
|
5
|
+
* Service responsible for EdgeWorker and Cloudflare tunnel management
|
|
6
|
+
*/
|
|
7
|
+
export class WorkerService {
|
|
8
|
+
configService;
|
|
9
|
+
gitService;
|
|
10
|
+
sylasHome;
|
|
11
|
+
logger;
|
|
12
|
+
version;
|
|
13
|
+
edgeWorker = null;
|
|
14
|
+
setupWaitingServer = null; // SharedApplicationServer instance during setup waiting mode
|
|
15
|
+
isShuttingDown = false;
|
|
16
|
+
constructor(configService, gitService, sylasHome, logger, version) {
|
|
17
|
+
this.configService = configService;
|
|
18
|
+
this.gitService = gitService;
|
|
19
|
+
this.sylasHome = sylasHome;
|
|
20
|
+
this.logger = logger;
|
|
21
|
+
this.version = version;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the EdgeWorker instance
|
|
25
|
+
*/
|
|
26
|
+
getEdgeWorker() {
|
|
27
|
+
return this.edgeWorker;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the server port from EdgeWorker
|
|
31
|
+
*/
|
|
32
|
+
getServerPort() {
|
|
33
|
+
return this.edgeWorker?.getServerPort() || DEFAULT_SERVER_PORT;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Start setup waiting mode - server infrastructure only, no EdgeWorker
|
|
37
|
+
* Used after initial authentication while waiting for server configuration
|
|
38
|
+
*/
|
|
39
|
+
async startSetupWaitingMode() {
|
|
40
|
+
const { SharedApplicationServer } = await import("sylas-edge-worker");
|
|
41
|
+
const { ConfigUpdater } = await import("sylas-config-updater");
|
|
42
|
+
// Determine server configuration
|
|
43
|
+
const isExternalHost = process.env.SYLAS_HOST_EXTERNAL?.toLowerCase().trim() === "true";
|
|
44
|
+
const serverPort = parsePort(process.env.SYLAS_SERVER_PORT, DEFAULT_SERVER_PORT);
|
|
45
|
+
const serverHost = isExternalHost ? "0.0.0.0" : "localhost";
|
|
46
|
+
// Create and start SharedApplicationServer
|
|
47
|
+
this.setupWaitingServer = new SharedApplicationServer(serverPort, serverHost);
|
|
48
|
+
this.setupWaitingServer.initializeFastify();
|
|
49
|
+
// Register ConfigUpdater routes
|
|
50
|
+
const configUpdater = new ConfigUpdater(this.setupWaitingServer.getFastifyInstance(), this.sylasHome, process.env.SYLAS_API_KEY || "");
|
|
51
|
+
configUpdater.register();
|
|
52
|
+
this.logger.info("✅ Config updater registered");
|
|
53
|
+
this.logger.info(" Routes: /api/update/sylas-config, /api/update/sylas-env,");
|
|
54
|
+
this.logger.info(" /api/update/repository, /api/test-mcp, /api/configure-mcp");
|
|
55
|
+
// Start the server (this also starts Cloudflare tunnel if CLOUDFLARE_TOKEN is set)
|
|
56
|
+
await this.setupWaitingServer.start();
|
|
57
|
+
this.logger.raw("");
|
|
58
|
+
this.logger.divider(70);
|
|
59
|
+
this.logger.info("⏳ Waiting for configuration from server...");
|
|
60
|
+
this.logger.info(`🔗 Server running on port ${serverPort}`);
|
|
61
|
+
if (process.env.CLOUDFLARE_TOKEN) {
|
|
62
|
+
this.logger.info("🌩️ Cloudflare tunnel: Active");
|
|
63
|
+
}
|
|
64
|
+
this.logger.info("📡 Config updater: Ready");
|
|
65
|
+
this.logger.raw("");
|
|
66
|
+
this.logger.info("Your Sylas instance is ready to receive configuration.");
|
|
67
|
+
this.logger.info(`Complete setup at: ${getSylasAppUrl()}/onboarding`);
|
|
68
|
+
this.logger.divider(70);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Start idle mode - server infrastructure only, no EdgeWorker
|
|
72
|
+
* Used after onboarding when no repositories are configured
|
|
73
|
+
*/
|
|
74
|
+
async startIdleMode() {
|
|
75
|
+
const { SharedApplicationServer } = await import("sylas-edge-worker");
|
|
76
|
+
const { ConfigUpdater } = await import("sylas-config-updater");
|
|
77
|
+
// Determine server configuration
|
|
78
|
+
const isExternalHost = process.env.SYLAS_HOST_EXTERNAL?.toLowerCase().trim() === "true";
|
|
79
|
+
const serverPort = parsePort(process.env.SYLAS_SERVER_PORT, DEFAULT_SERVER_PORT);
|
|
80
|
+
const serverHost = isExternalHost ? "0.0.0.0" : "localhost";
|
|
81
|
+
// Create and start SharedApplicationServer
|
|
82
|
+
this.setupWaitingServer = new SharedApplicationServer(serverPort, serverHost);
|
|
83
|
+
this.setupWaitingServer.initializeFastify();
|
|
84
|
+
// Register ConfigUpdater routes
|
|
85
|
+
const configUpdater = new ConfigUpdater(this.setupWaitingServer.getFastifyInstance(), this.sylasHome, process.env.SYLAS_API_KEY || "");
|
|
86
|
+
configUpdater.register();
|
|
87
|
+
this.logger.info("✅ Config updater registered");
|
|
88
|
+
this.logger.info(" Routes: /api/update/sylas-config, /api/update/sylas-env,");
|
|
89
|
+
this.logger.info(" /api/update/repository, /api/test-mcp, /api/configure-mcp");
|
|
90
|
+
// Start the server (this also starts Cloudflare tunnel if CLOUDFLARE_TOKEN is set)
|
|
91
|
+
await this.setupWaitingServer.start();
|
|
92
|
+
this.logger.raw("");
|
|
93
|
+
this.logger.divider(70);
|
|
94
|
+
this.logger.info("⏸️ No repositories configured");
|
|
95
|
+
this.logger.info(`🔗 Server running on port ${serverPort}`);
|
|
96
|
+
if (process.env.CLOUDFLARE_TOKEN) {
|
|
97
|
+
this.logger.info("🌩️ Cloudflare tunnel: Active");
|
|
98
|
+
}
|
|
99
|
+
this.logger.info("📡 Config updater: Ready");
|
|
100
|
+
this.logger.raw("");
|
|
101
|
+
const appUrl = getSylasAppUrl();
|
|
102
|
+
this.logger.info(`Waiting for repository configuration from ${appUrl}`);
|
|
103
|
+
this.logger.info(`Add repositories at: ${appUrl}/repos`);
|
|
104
|
+
this.logger.divider(70);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Stop the setup waiting mode or idle mode server
|
|
108
|
+
* Must be called before starting EdgeWorker to avoid port conflicts
|
|
109
|
+
*/
|
|
110
|
+
async stopWaitingServer() {
|
|
111
|
+
if (this.setupWaitingServer) {
|
|
112
|
+
this.logger.info("🛑 Stopping waiting server...");
|
|
113
|
+
await this.setupWaitingServer.stop();
|
|
114
|
+
this.setupWaitingServer = null;
|
|
115
|
+
this.logger.info("✅ Waiting server stopped");
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Start the EdgeWorker with given configuration
|
|
120
|
+
*/
|
|
121
|
+
async startEdgeWorker(params) {
|
|
122
|
+
const { repositories, ngrokAuthToken, onOAuthCallback } = params;
|
|
123
|
+
// Determine if using external host
|
|
124
|
+
const isExternalHost = process.env.SYLAS_HOST_EXTERNAL?.toLowerCase().trim() === "true";
|
|
125
|
+
// Load config once for model defaults
|
|
126
|
+
const edgeConfig = this.configService.load();
|
|
127
|
+
// Create EdgeWorker configuration
|
|
128
|
+
const config = {
|
|
129
|
+
version: this.version,
|
|
130
|
+
repositories,
|
|
131
|
+
sylasHome: this.sylasHome,
|
|
132
|
+
defaultAllowedTools: process.env.ALLOWED_TOOLS?.split(",").map((t) => t.trim()) || [],
|
|
133
|
+
defaultDisallowedTools: process.env.DISALLOWED_TOOLS?.split(",").map((t) => t.trim()) ||
|
|
134
|
+
undefined,
|
|
135
|
+
// Model configuration: environment variables take precedence over config file.
|
|
136
|
+
// Legacy env vars/keys are still accepted for backwards compatibility.
|
|
137
|
+
claudeDefaultModel: process.env.SYLAS_CLAUDE_DEFAULT_MODEL ||
|
|
138
|
+
process.env.SYLAS_DEFAULT_MODEL ||
|
|
139
|
+
edgeConfig.claudeDefaultModel ||
|
|
140
|
+
edgeConfig.defaultModel,
|
|
141
|
+
claudeDefaultFallbackModel: process.env.SYLAS_CLAUDE_DEFAULT_FALLBACK_MODEL ||
|
|
142
|
+
process.env.SYLAS_DEFAULT_FALLBACK_MODEL ||
|
|
143
|
+
edgeConfig.claudeDefaultFallbackModel ||
|
|
144
|
+
edgeConfig.defaultFallbackModel,
|
|
145
|
+
geminiDefaultModel: process.env.SYLAS_GEMINI_DEFAULT_MODEL || edgeConfig.geminiDefaultModel,
|
|
146
|
+
codexDefaultModel: process.env.SYLAS_CODEX_DEFAULT_MODEL || edgeConfig.codexDefaultModel,
|
|
147
|
+
webhookBaseUrl: process.env.SYLAS_BASE_URL,
|
|
148
|
+
serverPort: parsePort(process.env.SYLAS_SERVER_PORT, DEFAULT_SERVER_PORT),
|
|
149
|
+
serverHost: isExternalHost ? "0.0.0.0" : "localhost",
|
|
150
|
+
ngrokAuthToken,
|
|
151
|
+
// User access control configuration
|
|
152
|
+
userAccessControl: edgeConfig.userAccessControl,
|
|
153
|
+
handlers: {
|
|
154
|
+
createWorkspace: async (issue, repository) => {
|
|
155
|
+
return this.gitService.createGitWorktree(issue, repository, edgeConfig.global_setup_script);
|
|
156
|
+
},
|
|
157
|
+
onOAuthCallback,
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
// Create and start EdgeWorker
|
|
161
|
+
this.edgeWorker = new EdgeWorker(config);
|
|
162
|
+
// Set config path for dynamic reloading
|
|
163
|
+
const configPath = this.configService.getConfigPath();
|
|
164
|
+
this.edgeWorker.setConfigPath(configPath);
|
|
165
|
+
// Set up event handlers
|
|
166
|
+
this.setupEventHandlers();
|
|
167
|
+
// Start the worker
|
|
168
|
+
await this.edgeWorker.start();
|
|
169
|
+
this.logger.success("Edge worker started successfully");
|
|
170
|
+
this.logger.info(`Managing ${repositories.length} repositories:`);
|
|
171
|
+
repositories.forEach((repo) => {
|
|
172
|
+
this.logger.info(` - ${repo.name} (${repo.repositoryPath})`);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Set up event handlers for EdgeWorker
|
|
177
|
+
*/
|
|
178
|
+
setupEventHandlers() {
|
|
179
|
+
if (!this.edgeWorker)
|
|
180
|
+
return;
|
|
181
|
+
// Session events
|
|
182
|
+
this.edgeWorker.on("session:started", (issueId, _issue, repositoryId) => {
|
|
183
|
+
this.logger.info(`Started session for issue ${issueId} in repository ${repositoryId}`);
|
|
184
|
+
});
|
|
185
|
+
this.edgeWorker.on("session:ended", (issueId, exitCode, repositoryId) => {
|
|
186
|
+
this.logger.info(`Session for issue ${issueId} ended with exit code ${exitCode} in repository ${repositoryId}`);
|
|
187
|
+
});
|
|
188
|
+
// Connection events
|
|
189
|
+
this.edgeWorker.on("connected", (token) => {
|
|
190
|
+
this.logger.success(`Connected to proxy with token ending in ...${token.slice(-4)}`);
|
|
191
|
+
});
|
|
192
|
+
this.edgeWorker.on("disconnected", (token, reason) => {
|
|
193
|
+
this.logger.error(`Disconnected from proxy (token ...${token.slice(-4)}): ${reason || "Unknown reason"}`);
|
|
194
|
+
});
|
|
195
|
+
// Error events
|
|
196
|
+
this.edgeWorker.on("error", (error) => {
|
|
197
|
+
this.logger.error(`EdgeWorker error: ${error.message}`);
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Stop the EdgeWorker
|
|
202
|
+
*/
|
|
203
|
+
async stop() {
|
|
204
|
+
if (this.isShuttingDown)
|
|
205
|
+
return;
|
|
206
|
+
this.isShuttingDown = true;
|
|
207
|
+
this.logger.info("\nShutting down edge worker...");
|
|
208
|
+
// Stop setup waiting mode server if still running
|
|
209
|
+
if (this.setupWaitingServer) {
|
|
210
|
+
await this.setupWaitingServer.stop();
|
|
211
|
+
this.setupWaitingServer = null;
|
|
212
|
+
}
|
|
213
|
+
// Stop edge worker (includes stopping shared application server and Cloudflare tunnel)
|
|
214
|
+
if (this.edgeWorker) {
|
|
215
|
+
await this.edgeWorker.stop();
|
|
216
|
+
}
|
|
217
|
+
this.logger.info("Shutdown complete");
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=WorkerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerService.js","sourceRoot":"","sources":["../../../src/services/WorkerService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKxE;;GAEG;AACH,MAAM,OAAO,aAAa;IAMhB;IACA;IACA;IACA;IACA;IATD,UAAU,GAAsB,IAAI,CAAC;IACrC,kBAAkB,GAAQ,IAAI,CAAC,CAAC,6DAA6D;IAC7F,cAAc,GAAG,KAAK,CAAC;IAE/B,YACS,aAA4B,EAC5B,UAAsB,EACtB,SAAiB,EACjB,MAAc,EACd,OAAgB;QAJhB,kBAAa,GAAb,aAAa,CAAe;QAC5B,eAAU,GAAV,UAAU,CAAY;QACtB,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAS;IACtB,CAAC;IAEJ;;OAEG;IACH,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,aAAa;QACZ,OAAO,IAAI,CAAC,UAAU,EAAE,aAAa,EAAE,IAAI,mBAAmB,CAAC;IAChE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,qBAAqB;QAC1B,MAAM,EAAE,uBAAuB,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACtE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAE/D,iCAAiC;QACjC,MAAM,cAAc,GACnB,OAAO,CAAC,GAAG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AAE,CAAC,KAAY,EAAE,EAAE;YAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACT,IAAI,IAAI,CAAC,cAAc;YAAE,OAAO;QAChC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAEnD,kDAAkD;QAClD,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;YACrC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAChC,CAAC;QAED,uFAAuF;QACvF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAC9B,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;CACD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility namespace for CLI prompts and user interaction
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace CLIPrompts {
|
|
5
|
+
/**
|
|
6
|
+
* Ask a question and return the user's answer
|
|
7
|
+
*/
|
|
8
|
+
function ask(prompt: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Ask a yes/no question
|
|
11
|
+
*/
|
|
12
|
+
function confirm(prompt: string, defaultValue?: boolean): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Display a menu and get user selection
|
|
15
|
+
*/
|
|
16
|
+
function menu(title: string, options: string[]): Promise<number | null>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=CLIPrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CLIPrompts.d.ts","sourceRoot":"","sources":["../../../src/ui/CLIPrompts.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,yBAAiB,UAAU,CAAC;IAC3B;;OAEG;IACH,SAAsB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYzD;IAED;;OAEG;IACH,SAAsB,OAAO,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,UAAQ,GAClB,OAAO,CAAC,OAAO,CAAC,CASlB;IAED;;OAEG;IACH,SAAsB,IAAI,CACzB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBxB;CACD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import readline from "node:readline";
|
|
2
|
+
/**
|
|
3
|
+
* Utility namespace for CLI prompts and user interaction
|
|
4
|
+
*/
|
|
5
|
+
export var CLIPrompts;
|
|
6
|
+
(function (CLIPrompts) {
|
|
7
|
+
/**
|
|
8
|
+
* Ask a question and return the user's answer
|
|
9
|
+
*/
|
|
10
|
+
async function ask(prompt) {
|
|
11
|
+
const rl = readline.createInterface({
|
|
12
|
+
input: process.stdin,
|
|
13
|
+
output: process.stdout,
|
|
14
|
+
});
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
rl.question(prompt, (answer) => {
|
|
17
|
+
rl.close();
|
|
18
|
+
resolve(answer.trim());
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
CLIPrompts.ask = ask;
|
|
23
|
+
/**
|
|
24
|
+
* Ask a yes/no question
|
|
25
|
+
*/
|
|
26
|
+
async function confirm(prompt, defaultValue = false) {
|
|
27
|
+
const suffix = defaultValue ? " (Y/n): " : " (y/N): ";
|
|
28
|
+
const answer = await CLIPrompts.ask(prompt + suffix);
|
|
29
|
+
if (!answer) {
|
|
30
|
+
return defaultValue;
|
|
31
|
+
}
|
|
32
|
+
return answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
|
|
33
|
+
}
|
|
34
|
+
CLIPrompts.confirm = confirm;
|
|
35
|
+
/**
|
|
36
|
+
* Display a menu and get user selection
|
|
37
|
+
*/
|
|
38
|
+
async function menu(title, options) {
|
|
39
|
+
console.log(`\n${title}`);
|
|
40
|
+
console.log("─".repeat(50));
|
|
41
|
+
options.forEach((option, index) => {
|
|
42
|
+
console.log(`${index + 1}. ${option}`);
|
|
43
|
+
});
|
|
44
|
+
const answer = await CLIPrompts.ask("\nYour choice: ");
|
|
45
|
+
const choice = parseInt(answer, 10);
|
|
46
|
+
if (Number.isNaN(choice) || choice < 1 || choice > options.length) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return choice - 1;
|
|
50
|
+
}
|
|
51
|
+
CLIPrompts.menu = menu;
|
|
52
|
+
})(CLIPrompts || (CLIPrompts = {}));
|
|
53
|
+
//# sourceMappingURL=CLIPrompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CLIPrompts.js","sourceRoot":"","sources":["../../../src/ui/CLIPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC;;GAEG;AACH,MAAM,KAAW,UAAU,CA0D1B;AA1DD,WAAiB,UAAU;IAC1B;;OAEG;IACI,KAAK,UAAU,GAAG,CAAC,MAAc;QACvC,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;YACnC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACtB,CAAC,CAAC;QAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC9B,EAAE,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACxB,CAA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IACnB,CAAC;IAnBqB,eAAI,OAmBzB,CAAA;AACF,CAAC,EA1DgB,UAAU,KAAV,UAAU,QA0D1B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility namespace for CLI prompts and user interaction
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace CLIPrompts {
|
|
5
|
+
/**
|
|
6
|
+
* Ask a question and return the user's answer
|
|
7
|
+
*/
|
|
8
|
+
function ask(prompt: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Ask a yes/no question
|
|
11
|
+
*/
|
|
12
|
+
function confirm(prompt: string, defaultValue?: boolean): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Display a menu and get user selection
|
|
15
|
+
*/
|
|
16
|
+
function menu(title: string, options: string[]): Promise<number | null>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=CLIPrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CLIPrompts.d.ts","sourceRoot":"","sources":["../../src/ui/CLIPrompts.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,yBAAiB,UAAU,CAAC;IAC3B;;OAEG;IACH,SAAsB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYzD;IAED;;OAEG;IACH,SAAsB,OAAO,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,UAAQ,GAClB,OAAO,CAAC,OAAO,CAAC,CASlB;IAED;;OAEG;IACH,SAAsB,IAAI,CACzB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBxB;CACD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import readline from "node:readline";
|
|
2
|
+
/**
|
|
3
|
+
* Utility namespace for CLI prompts and user interaction
|
|
4
|
+
*/
|
|
5
|
+
export var CLIPrompts;
|
|
6
|
+
(function (CLIPrompts) {
|
|
7
|
+
/**
|
|
8
|
+
* Ask a question and return the user's answer
|
|
9
|
+
*/
|
|
10
|
+
async function ask(prompt) {
|
|
11
|
+
const rl = readline.createInterface({
|
|
12
|
+
input: process.stdin,
|
|
13
|
+
output: process.stdout,
|
|
14
|
+
});
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
rl.question(prompt, (answer) => {
|
|
17
|
+
rl.close();
|
|
18
|
+
resolve(answer.trim());
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
CLIPrompts.ask = ask;
|
|
23
|
+
/**
|
|
24
|
+
* Ask a yes/no question
|
|
25
|
+
*/
|
|
26
|
+
async function confirm(prompt, defaultValue = false) {
|
|
27
|
+
const suffix = defaultValue ? " (Y/n): " : " (y/N): ";
|
|
28
|
+
const answer = await CLIPrompts.ask(prompt + suffix);
|
|
29
|
+
if (!answer) {
|
|
30
|
+
return defaultValue;
|
|
31
|
+
}
|
|
32
|
+
return answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
|
|
33
|
+
}
|
|
34
|
+
CLIPrompts.confirm = confirm;
|
|
35
|
+
/**
|
|
36
|
+
* Display a menu and get user selection
|
|
37
|
+
*/
|
|
38
|
+
async function menu(title, options) {
|
|
39
|
+
console.log(`\n${title}`);
|
|
40
|
+
console.log("─".repeat(50));
|
|
41
|
+
options.forEach((option, index) => {
|
|
42
|
+
console.log(`${index + 1}. ${option}`);
|
|
43
|
+
});
|
|
44
|
+
const answer = await CLIPrompts.ask("\nYour choice: ");
|
|
45
|
+
const choice = parseInt(answer, 10);
|
|
46
|
+
if (Number.isNaN(choice) || choice < 1 || choice > options.length) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return choice - 1;
|
|
50
|
+
}
|
|
51
|
+
CLIPrompts.menu = menu;
|
|
52
|
+
})(CLIPrompts || (CLIPrompts = {}));
|
|
53
|
+
//# sourceMappingURL=CLIPrompts.js.map
|
|
@@ -0,0 +1 @@
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EAAE,CAAC,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAE5B,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACjC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAEpC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YACnE,OAAO,IAAI,CAAC;QACb,CAAC;QAED,OAAO,MAAM,GAAG,CAAC,CAAC;IACnB,CAAC;IAnBqB,eAAI,OAmBzB,CAAA;AACF,CAAC,EA1DgB,UAAU,KAAV,UAAU,QA0D1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.d.ts","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":";AAEA,wBAUG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
export default defineConfig({
|
|
3
|
+
test: {
|
|
4
|
+
globals: true,
|
|
5
|
+
environment: "node",
|
|
6
|
+
coverage: {
|
|
7
|
+
provider: "v8",
|
|
8
|
+
reporter: ["text", "lcov"],
|
|
9
|
+
reportsDirectory: "./coverage",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=vitest.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IAC3B,IAAI,EAAE;QACL,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,QAAQ,EAAE;YACT,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;YAC1B,gBAAgB,EAAE,YAAY;SAC9B;KACD;CACD,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sylas-ai",
|
|
3
|
+
"version": "0.2.21",
|
|
4
|
+
"description": "AI-powered Linear issue automation using Claude",
|
|
5
|
+
"main": "dist/src/app.js",
|
|
6
|
+
"types": "dist/src/app.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"sylas": "./dist/src/app.js"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/smilebank7/sylas.git",
|
|
21
|
+
"directory": "apps/cli"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"linear",
|
|
25
|
+
"claude",
|
|
26
|
+
"ai",
|
|
27
|
+
"automation",
|
|
28
|
+
"cli"
|
|
29
|
+
],
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@linear/sdk": "^64.0.0",
|
|
34
|
+
"commander": "^14.0.2",
|
|
35
|
+
"dotenv": "^16.5.0",
|
|
36
|
+
"express": "^5.2.0",
|
|
37
|
+
"fastify": "^5.7.3",
|
|
38
|
+
"file-type": "^21.0.0",
|
|
39
|
+
"fs-extra": "^11.3.0",
|
|
40
|
+
"node-fetch": "^2.7.0",
|
|
41
|
+
"open": "^10.0.0",
|
|
42
|
+
"zod": "^4.3.5",
|
|
43
|
+
"sylas-cloudflare-tunnel-client": "0.2.21",
|
|
44
|
+
"sylas-config-updater": "0.2.21",
|
|
45
|
+
"sylas-core": "0.2.21",
|
|
46
|
+
"sylas-edge-worker": "0.2.21",
|
|
47
|
+
"sylas-claude-runner": "0.2.21"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^20.0.0",
|
|
51
|
+
"nodemon": "^2.0.22",
|
|
52
|
+
"typescript": "^5.3.3"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "tsc",
|
|
56
|
+
"start": "node dist/src/app.js",
|
|
57
|
+
"dev": "tsc --watch",
|
|
58
|
+
"test": "bun test",
|
|
59
|
+
"test:run": "bun test",
|
|
60
|
+
"test:watch": "bun test --watch",
|
|
61
|
+
"typecheck": "tsc --noEmit"
|
|
62
|
+
}
|
|
63
|
+
}
|