hyntx 0.0.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/index.js ADDED
@@ -0,0 +1,1778 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
3
+ import { homedir } from 'os';
4
+ import { join, dirname, basename } from 'path';
5
+ import { parseArgs } from 'util';
6
+ import { fileURLToPath } from 'url';
7
+ import chalk3 from 'chalk';
8
+ import ora from 'ora';
9
+ import { readFile } from 'fs/promises';
10
+ import { glob } from 'glob';
11
+ import { isAfter, parseISO, startOfDay, isSameDay, isBefore } from 'date-fns';
12
+ import prompts from 'prompts';
13
+ import boxen2 from 'boxen';
14
+ import Table from 'cli-table3';
15
+ import figlet from 'figlet';
16
+
17
+ var __defProp = Object.defineProperty;
18
+ var __getOwnPropNames = Object.getOwnPropertyNames;
19
+ var __esm = (fn, res) => function __init() {
20
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
21
+ };
22
+ var __export = (target, all) => {
23
+ for (var name in all)
24
+ __defProp(target, name, { get: all[name], enumerable: true });
25
+ };
26
+
27
+ // src/utils/shell-config.ts
28
+ var shell_config_exports = {};
29
+ __export(shell_config_exports, {
30
+ detectShellConfigFile: () => detectShellConfigFile,
31
+ generateEnvExports: () => generateEnvExports,
32
+ getManualInstructions: () => getManualInstructions,
33
+ saveConfigToShell: () => saveConfigToShell,
34
+ updateShellConfig: () => updateShellConfig
35
+ });
36
+ function detectShellConfigFile() {
37
+ const home = homedir();
38
+ const shell = process.env["SHELL"] ?? "";
39
+ if (shell.includes("zsh")) {
40
+ return {
41
+ shellType: "zsh",
42
+ configFile: join(home, ".zshrc")
43
+ };
44
+ }
45
+ if (shell.includes("bash")) {
46
+ return {
47
+ shellType: "bash",
48
+ configFile: join(home, ".bashrc")
49
+ };
50
+ }
51
+ if (shell.includes("fish")) {
52
+ return {
53
+ shellType: "fish",
54
+ configFile: join(home, ".config", "fish", "config.fish")
55
+ };
56
+ }
57
+ const defaultShell = process.platform === "darwin" ? "zsh" : "bash";
58
+ return {
59
+ shellType: defaultShell,
60
+ configFile: join(home, `.${defaultShell}rc`)
61
+ };
62
+ }
63
+ function generateEnvExports(config) {
64
+ const lines = [];
65
+ if (config.services.length > 0) {
66
+ lines.push(`export HYNTX_SERVICES=${config.services.join(",")}`);
67
+ }
68
+ if (config.reminder) {
69
+ lines.push(`export HYNTX_REMINDER=${config.reminder}`);
70
+ }
71
+ if (config.services.includes("ollama")) {
72
+ if (config.ollama.model) {
73
+ lines.push(`export HYNTX_OLLAMA_MODEL=${config.ollama.model}`);
74
+ }
75
+ if (config.ollama.host) {
76
+ lines.push(`export HYNTX_OLLAMA_HOST=${config.ollama.host}`);
77
+ }
78
+ }
79
+ if (config.services.includes("anthropic") && config.anthropic.apiKey) {
80
+ lines.push(`export HYNTX_ANTHROPIC_MODEL=${config.anthropic.model}`);
81
+ lines.push(`export HYNTX_ANTHROPIC_KEY=${config.anthropic.apiKey}`);
82
+ }
83
+ if (config.services.includes("google") && config.google.apiKey) {
84
+ lines.push(`export HYNTX_GOOGLE_MODEL=${config.google.model}`);
85
+ lines.push(`export HYNTX_GOOGLE_KEY=${config.google.apiKey}`);
86
+ }
87
+ return lines;
88
+ }
89
+ function updateShellConfig(configFile, exports$1) {
90
+ const startMarker = "# >>> hyntx config >>>";
91
+ const endMarker = "# <<< hyntx config <<<";
92
+ const exportLines = exports$1.map((line) => ` ${line}`).join("\n");
93
+ const configBlock = `${startMarker}
94
+ ${exportLines}
95
+
96
+ # Uncomment to enable periodic reminders:
97
+ # hyntx --check-reminder 2>/dev/null
98
+ ${endMarker}
99
+ `;
100
+ try {
101
+ let content = "";
102
+ let action = "created";
103
+ if (existsSync(configFile)) {
104
+ content = readFileSync(configFile, "utf-8");
105
+ action = "updated";
106
+ }
107
+ const hasStartMarker = content.includes(startMarker);
108
+ const hasEndMarker = content.includes(endMarker);
109
+ if (hasStartMarker && hasEndMarker) {
110
+ const startIndex = content.indexOf(startMarker);
111
+ const endIndex = content.indexOf(endMarker) + endMarker.length;
112
+ const before = content.slice(0, startIndex);
113
+ const after = content.slice(endIndex);
114
+ const beforeTrimmed = before.endsWith("\n") ? before.slice(0, -1) : before;
115
+ content = `${beforeTrimmed}
116
+ ${configBlock}${after}`.trim() + "\n";
117
+ } else if (hasStartMarker || hasEndMarker) {
118
+ const startIndex = hasStartMarker ? content.indexOf(startMarker) : content.indexOf(endMarker);
119
+ const endIndex = hasEndMarker ? content.indexOf(endMarker) + endMarker.length : content.indexOf(startMarker) + startMarker.length;
120
+ const before = content.slice(0, startIndex);
121
+ const after = content.slice(endIndex);
122
+ const beforeTrimmed = before.endsWith("\n") ? before.slice(0, -1) : before;
123
+ content = `${beforeTrimmed}
124
+ ${configBlock}${after}`.trim() + "\n";
125
+ } else {
126
+ const separator = content && !content.endsWith("\n") ? "\n\n" : "\n";
127
+ content = `${content}${separator}${configBlock}`;
128
+ }
129
+ try {
130
+ mkdirSync(dirname(configFile), { recursive: true });
131
+ } catch {
132
+ }
133
+ writeFileSync(configFile, content, "utf-8");
134
+ return {
135
+ success: true,
136
+ shellFile: configFile,
137
+ message: `Configuration ${action === "created" ? "saved to" : "updated in"} ${configFile}`,
138
+ action
139
+ };
140
+ } catch (error) {
141
+ return {
142
+ success: false,
143
+ shellFile: configFile,
144
+ message: `Failed to update ${configFile}: ${error instanceof Error ? error.message : String(error)}`,
145
+ action: "failed"
146
+ };
147
+ }
148
+ }
149
+ function saveConfigToShell(config) {
150
+ const { configFile } = detectShellConfigFile();
151
+ const exports$1 = generateEnvExports(config);
152
+ return updateShellConfig(configFile, exports$1);
153
+ }
154
+ function getManualInstructions(config) {
155
+ const { configFile } = detectShellConfigFile();
156
+ const exports$1 = generateEnvExports(config);
157
+ const instructions = [
158
+ `Add this to your ${configFile}:`,
159
+ "",
160
+ ...exports$1.map((line) => ` ${line}`),
161
+ "",
162
+ "# Uncomment to enable periodic reminders:",
163
+ "# hyntx --check-reminder 2>/dev/null",
164
+ "",
165
+ `Then reload your shell:`,
166
+ ` source ${configFile}`
167
+ ];
168
+ return instructions.join("\n");
169
+ }
170
+ var init_shell_config = __esm({
171
+ "src/utils/shell-config.ts"() {
172
+ }
173
+ });
174
+
175
+ // src/types/index.ts
176
+ var PROVIDER_LIMITS = {
177
+ ollama: { maxTokensPerBatch: 3e4, prioritization: "longest-first" },
178
+ anthropic: { maxTokensPerBatch: 1e5, prioritization: "chronological" },
179
+ google: { maxTokensPerBatch: 5e5, prioritization: "chronological" }
180
+ };
181
+ var ENV_DEFAULTS = {
182
+ reminder: "7d",
183
+ ollama: {
184
+ model: "llama3.2",
185
+ host: "http://localhost:11434"
186
+ },
187
+ anthropic: {
188
+ model: "claude-3-5-haiku-latest"
189
+ },
190
+ google: {
191
+ model: "gemini-2.0-flash-exp"
192
+ }
193
+ };
194
+ var EXIT_CODES = {
195
+ SUCCESS: 0,
196
+ ERROR: 1,
197
+ NO_DATA: 2,
198
+ PROVIDER_UNAVAILABLE: 3
199
+ };
200
+
201
+ // src/utils/env.ts
202
+ var VALID_PROVIDERS = [
203
+ "ollama",
204
+ "anthropic",
205
+ "google"
206
+ ];
207
+ function isFirstRun() {
208
+ return !process.env["HYNTX_SERVICES"];
209
+ }
210
+ function parseServices(services) {
211
+ if (!services || services.trim() === "") {
212
+ return [];
213
+ }
214
+ return services.split(",").map((s) => s.trim().toLowerCase()).filter(
215
+ (s) => VALID_PROVIDERS.includes(s)
216
+ );
217
+ }
218
+ function getEnvConfig() {
219
+ return {
220
+ services: parseServices(process.env["HYNTX_SERVICES"]),
221
+ reminder: process.env["HYNTX_REMINDER"] ?? ENV_DEFAULTS.reminder,
222
+ ollama: {
223
+ model: process.env["HYNTX_OLLAMA_MODEL"] ?? ENV_DEFAULTS.ollama.model,
224
+ host: process.env["HYNTX_OLLAMA_HOST"] ?? ENV_DEFAULTS.ollama.host
225
+ },
226
+ anthropic: {
227
+ model: process.env["HYNTX_ANTHROPIC_MODEL"] ?? ENV_DEFAULTS.anthropic.model,
228
+ apiKey: process.env["HYNTX_ANTHROPIC_KEY"] ?? ""
229
+ },
230
+ google: {
231
+ model: process.env["HYNTX_GOOGLE_MODEL"] ?? ENV_DEFAULTS.google.model,
232
+ apiKey: process.env["HYNTX_GOOGLE_KEY"] ?? ""
233
+ }
234
+ };
235
+ }
236
+ var HOME = homedir();
237
+ var CLAUDE_PROJECTS_DIR = join(HOME, ".claude", "projects");
238
+ join(HOME, ".hyntx-last-run");
239
+
240
+ // src/core/schema-validator.ts
241
+ var SUPPORTED_VERSIONS = ["1.0"];
242
+ var CURRENT_VERSION = {
243
+ major: 1,
244
+ minor: 0,
245
+ detected: "1.0"
246
+ };
247
+ var V1_0_REQUIRED_FIELDS = [
248
+ "type",
249
+ "message",
250
+ "timestamp",
251
+ "sessionId",
252
+ "cwd"
253
+ ];
254
+ var V1_0_MESSAGE_FIELDS = ["role", "content"];
255
+ var V1_0_MESSAGE_TYPES = ["user", "assistant", "system"];
256
+ function isObject(value) {
257
+ return typeof value === "object" && value !== null && !Array.isArray(value);
258
+ }
259
+ function hasRequiredFields(obj, fields) {
260
+ return fields.every((field) => field in obj);
261
+ }
262
+ function isValidV1Message(message) {
263
+ if (!isObject(message)) {
264
+ return false;
265
+ }
266
+ if (!hasRequiredFields(message, V1_0_MESSAGE_FIELDS)) {
267
+ return false;
268
+ }
269
+ const role = message["role"];
270
+ if (typeof role !== "string" || !V1_0_MESSAGE_TYPES.includes(role)) {
271
+ return false;
272
+ }
273
+ const content = message["content"];
274
+ if (typeof content !== "string") {
275
+ return false;
276
+ }
277
+ return true;
278
+ }
279
+ function isValidV1Type(type) {
280
+ return typeof type === "string" && V1_0_MESSAGE_TYPES.includes(type);
281
+ }
282
+ function detectSchemaVersion(entry) {
283
+ if (!isObject(entry)) {
284
+ return null;
285
+ }
286
+ if (!hasRequiredFields(entry, V1_0_REQUIRED_FIELDS)) {
287
+ return null;
288
+ }
289
+ if (!isValidV1Type(entry["type"])) {
290
+ return null;
291
+ }
292
+ if (!isValidV1Message(entry["message"])) {
293
+ return null;
294
+ }
295
+ if (typeof entry["timestamp"] !== "string") {
296
+ return null;
297
+ }
298
+ if (typeof entry["sessionId"] !== "string") {
299
+ return null;
300
+ }
301
+ if (typeof entry["cwd"] !== "string") {
302
+ return null;
303
+ }
304
+ return CURRENT_VERSION;
305
+ }
306
+ function isSchemaSupported(version) {
307
+ return SUPPORTED_VERSIONS.includes(version.detected);
308
+ }
309
+ function getSchemaWarning(version, context) {
310
+ const contextSuffix = "";
311
+ if (version === null) {
312
+ return `Unknown log format detected${contextSuffix}. The log entry structure does not match any known Claude Code schema. This entry will be skipped.`;
313
+ }
314
+ if (!isSchemaSupported(version)) {
315
+ return `Unsupported schema version ${version.detected}${contextSuffix}. Supported versions: ${SUPPORTED_VERSIONS.join(", ")}. This entry may not be processed correctly.`;
316
+ }
317
+ return "";
318
+ }
319
+ function validateLogEntry(entry) {
320
+ const version = detectSchemaVersion(entry);
321
+ if (version === null) {
322
+ return {
323
+ isValid: false,
324
+ version: null,
325
+ warning: getSchemaWarning(null)
326
+ };
327
+ }
328
+ if (!isSchemaSupported(version)) {
329
+ return {
330
+ isValid: false,
331
+ version,
332
+ warning: getSchemaWarning(version)
333
+ };
334
+ }
335
+ return {
336
+ isValid: true,
337
+ version,
338
+ warning: null
339
+ };
340
+ }
341
+
342
+ // src/core/log-reader.ts
343
+ function claudeProjectsExist() {
344
+ return existsSync(CLAUDE_PROJECTS_DIR);
345
+ }
346
+ function extractProjectName(filePath) {
347
+ const parts = filePath.split("/");
348
+ const projectIndex = parts.findIndex((p) => p === "projects");
349
+ const projectHash = parts[projectIndex + 1];
350
+ if (projectIndex !== -1 && projectHash !== void 0) {
351
+ return projectHash;
352
+ }
353
+ return basename(filePath, ".jsonl");
354
+ }
355
+ function parseDate(dateStr) {
356
+ const normalized = dateStr.trim().toLowerCase();
357
+ if (normalized === "today") {
358
+ return startOfDay(/* @__PURE__ */ new Date());
359
+ }
360
+ if (normalized === "yesterday") {
361
+ const yesterday = /* @__PURE__ */ new Date();
362
+ yesterday.setDate(yesterday.getDate() - 1);
363
+ return startOfDay(yesterday);
364
+ }
365
+ try {
366
+ const parsed = parseISO(dateStr);
367
+ if (isNaN(parsed.getTime())) {
368
+ throw new Error(`Invalid date format: ${dateStr}`);
369
+ }
370
+ return startOfDay(parsed);
371
+ } catch {
372
+ throw new Error(
373
+ `Invalid date format: ${dateStr}. Expected 'today', 'yesterday', or YYYY-MM-DD`
374
+ );
375
+ }
376
+ }
377
+ function extractDate(timestamp) {
378
+ try {
379
+ const date = parseISO(timestamp);
380
+ const dateStr = date.toISOString().split("T")[0];
381
+ return dateStr ?? "unknown";
382
+ } catch {
383
+ return "unknown";
384
+ }
385
+ }
386
+ function parseLine(line) {
387
+ if (!line.trim()) {
388
+ return null;
389
+ }
390
+ try {
391
+ const parsed = JSON.parse(line);
392
+ const validation = validateLogEntry(parsed);
393
+ if (!validation.isValid) {
394
+ return null;
395
+ }
396
+ return parsed;
397
+ } catch {
398
+ return null;
399
+ }
400
+ }
401
+ function isUserMessage(message) {
402
+ return message.type === "user" && message.message.role === "user";
403
+ }
404
+ function extractContent(message) {
405
+ const content = message.message.content;
406
+ if (typeof content === "string") {
407
+ return content;
408
+ }
409
+ return "";
410
+ }
411
+ async function readJsonlFile(filePath) {
412
+ const prompts2 = [];
413
+ const warnings = [];
414
+ const projectName = extractProjectName(filePath);
415
+ try {
416
+ const content = await readFile(filePath, "utf-8");
417
+ const lines = content.split("\n");
418
+ for (let i = 0; i < lines.length; i++) {
419
+ const line = lines[i] ?? "";
420
+ const message = parseLine(line);
421
+ if (message === null) {
422
+ if (line.trim()) {
423
+ warnings.push(`Skipped invalid line ${String(i + 1)} in ${filePath}`);
424
+ }
425
+ continue;
426
+ }
427
+ if (!isUserMessage(message)) {
428
+ continue;
429
+ }
430
+ const extractedContent = extractContent(message);
431
+ if (!extractedContent.trim()) {
432
+ continue;
433
+ }
434
+ prompts2.push({
435
+ content: extractedContent,
436
+ timestamp: message.timestamp,
437
+ sessionId: message.sessionId,
438
+ project: projectName,
439
+ date: extractDate(message.timestamp)
440
+ });
441
+ }
442
+ } catch (error) {
443
+ const errorMessage = error instanceof Error ? error.message : "Unknown error";
444
+ warnings.push(`Failed to read ${filePath}: ${errorMessage}`);
445
+ }
446
+ return { prompts: prompts2, warnings };
447
+ }
448
+ function filterByDateRange(prompts2, fromDate, toDate) {
449
+ return prompts2.filter((prompt) => {
450
+ try {
451
+ const promptDate = parseISO(prompt.timestamp);
452
+ const promptDay = startOfDay(promptDate);
453
+ return (isSameDay(promptDay, fromDate) || isAfter(promptDay, fromDate)) && (isSameDay(promptDay, toDate) || isBefore(promptDay, toDate));
454
+ } catch {
455
+ return false;
456
+ }
457
+ });
458
+ }
459
+ function filterByDate(prompts2, targetDate) {
460
+ return prompts2.filter((prompt) => {
461
+ try {
462
+ const promptDate = parseISO(prompt.timestamp);
463
+ return isSameDay(startOfDay(promptDate), targetDate);
464
+ } catch {
465
+ return false;
466
+ }
467
+ });
468
+ }
469
+ function filterByProject(prompts2, projectName) {
470
+ const normalizedProject = projectName.toLowerCase().trim();
471
+ return prompts2.filter(
472
+ (prompt) => prompt.project.toLowerCase().includes(normalizedProject)
473
+ );
474
+ }
475
+ async function readLogs(options) {
476
+ if (!claudeProjectsExist()) {
477
+ return {
478
+ prompts: [],
479
+ warnings: [
480
+ `Claude projects directory not found at ${CLAUDE_PROJECTS_DIR}`
481
+ ]
482
+ };
483
+ }
484
+ const pattern = `${CLAUDE_PROJECTS_DIR}/**/*.jsonl`;
485
+ const files = await glob(pattern);
486
+ if (files.length === 0) {
487
+ return {
488
+ prompts: [],
489
+ warnings: ["No JSONL files found in Claude projects directory"]
490
+ };
491
+ }
492
+ const allPrompts = [];
493
+ const allWarnings = [];
494
+ for (const file of files) {
495
+ const { prompts: prompts2, warnings } = await readJsonlFile(file);
496
+ allPrompts.push(...prompts2);
497
+ allWarnings.push(...warnings);
498
+ }
499
+ let filteredPrompts = allPrompts;
500
+ if (options) {
501
+ if (options.from && options.to) {
502
+ try {
503
+ const fromDate = parseDate(options.from);
504
+ const toDate = parseDate(options.to);
505
+ if (isAfter(fromDate, toDate)) {
506
+ return {
507
+ prompts: [],
508
+ warnings: [
509
+ ...allWarnings,
510
+ `Invalid date range: --from (${options.from}) must be before or equal to --to (${options.to})`
511
+ ]
512
+ };
513
+ }
514
+ filteredPrompts = filterByDateRange(filteredPrompts, fromDate, toDate);
515
+ } catch (error) {
516
+ const errorMessage = error instanceof Error ? error.message : "Invalid date range";
517
+ return {
518
+ prompts: [],
519
+ warnings: [...allWarnings, errorMessage]
520
+ };
521
+ }
522
+ } else if (options.date) {
523
+ try {
524
+ const targetDate = parseDate(options.date);
525
+ filteredPrompts = filterByDate(filteredPrompts, targetDate);
526
+ } catch (error) {
527
+ const errorMessage = error instanceof Error ? error.message : "Invalid date";
528
+ return {
529
+ prompts: [],
530
+ warnings: [...allWarnings, errorMessage]
531
+ };
532
+ }
533
+ }
534
+ if (options.project) {
535
+ filteredPrompts = filterByProject(filteredPrompts, options.project);
536
+ }
537
+ }
538
+ const sortedPrompts = filteredPrompts.sort((a, b) => {
539
+ try {
540
+ const dateA = parseISO(a.timestamp);
541
+ const dateB = parseISO(b.timestamp);
542
+ return dateA.getTime() - dateB.getTime();
543
+ } catch {
544
+ return 0;
545
+ }
546
+ });
547
+ return {
548
+ prompts: sortedPrompts,
549
+ warnings: allWarnings
550
+ };
551
+ }
552
+ init_shell_config();
553
+ var PROVIDER_OPTIONS = [
554
+ {
555
+ title: "ollama",
556
+ description: "Local - requires Ollama installed",
557
+ value: "ollama"
558
+ },
559
+ {
560
+ title: "anthropic",
561
+ description: "Claude Haiku - requires API key",
562
+ value: "anthropic"
563
+ },
564
+ {
565
+ title: "google",
566
+ description: "Gemini Flash - requires API key",
567
+ value: "google"
568
+ }
569
+ ];
570
+ var REMINDER_OPTIONS = [
571
+ { title: "Never", value: "never" },
572
+ { title: "Every 7 days", value: "7d" },
573
+ { title: "Every 14 days", value: "14d" },
574
+ { title: "Every 30 days", value: "30d" }
575
+ ];
576
+ async function configureProvider(provider, config) {
577
+ if (provider === "ollama") {
578
+ const response2 = await prompts({
579
+ type: "text",
580
+ name: "model",
581
+ message: "Ollama model to use:",
582
+ initial: ENV_DEFAULTS.ollama.model
583
+ });
584
+ const hostResponse = await prompts({
585
+ type: "text",
586
+ name: "host",
587
+ message: "Ollama host:",
588
+ initial: ENV_DEFAULTS.ollama.host
589
+ });
590
+ return {
591
+ ...config,
592
+ ollama: {
593
+ model: response2.model ?? ENV_DEFAULTS.ollama.model,
594
+ host: hostResponse.host ?? ENV_DEFAULTS.ollama.host
595
+ }
596
+ };
597
+ }
598
+ if (provider === "anthropic") {
599
+ const response2 = await prompts({
600
+ type: "text",
601
+ name: "model",
602
+ message: "Anthropic model to use:",
603
+ initial: ENV_DEFAULTS.anthropic.model
604
+ });
605
+ const apiKeyResponse2 = await prompts({
606
+ type: "password",
607
+ name: "apiKey",
608
+ message: "Anthropic API key:",
609
+ validate: (value) => value.trim() !== "" || "API key is required"
610
+ });
611
+ return {
612
+ ...config,
613
+ anthropic: {
614
+ model: response2.model ?? ENV_DEFAULTS.anthropic.model,
615
+ apiKey: apiKeyResponse2.apiKey ?? ""
616
+ }
617
+ };
618
+ }
619
+ const response = await prompts({
620
+ type: "text",
621
+ name: "model",
622
+ message: "Google model to use:",
623
+ initial: ENV_DEFAULTS.google.model
624
+ });
625
+ const apiKeyResponse = await prompts({
626
+ type: "password",
627
+ name: "apiKey",
628
+ message: "Google API key:",
629
+ validate: (value) => value.trim() !== "" || "API key is required"
630
+ });
631
+ return {
632
+ ...config,
633
+ google: {
634
+ model: response.model ?? ENV_DEFAULTS.google.model,
635
+ apiKey: apiKeyResponse.apiKey ?? ""
636
+ }
637
+ };
638
+ }
639
+ function showManualInstructions(config) {
640
+ const instructions = getManualInstructions(config);
641
+ console.log("\n" + chalk3.green("\u2705 Setup complete!"));
642
+ console.log("\n" + instructions + "\n");
643
+ }
644
+ async function runSetup() {
645
+ console.log(
646
+ boxen2(chalk3.bold("\u{1F44B} Welcome to Hyntx!"), {
647
+ padding: 1,
648
+ borderColor: "cyan"
649
+ })
650
+ );
651
+ const providerResponse = await prompts({
652
+ type: "multiselect",
653
+ name: "providers",
654
+ message: "Select providers (space to select, enter to confirm):",
655
+ choices: PROVIDER_OPTIONS,
656
+ min: 1,
657
+ hint: "- Space to select. Return to submit"
658
+ });
659
+ const providers = providerResponse.providers;
660
+ if (!providers || providers.length === 0) {
661
+ console.log(chalk3.red("No providers selected. Setup cancelled."));
662
+ process.exit(1);
663
+ }
664
+ let config = {
665
+ services: providers,
666
+ reminder: ENV_DEFAULTS.reminder,
667
+ ollama: ENV_DEFAULTS.ollama,
668
+ anthropic: {
669
+ model: ENV_DEFAULTS.anthropic.model,
670
+ apiKey: ""
671
+ },
672
+ google: {
673
+ model: ENV_DEFAULTS.google.model,
674
+ apiKey: ""
675
+ }
676
+ };
677
+ for (const provider of providers) {
678
+ config = await configureProvider(provider, config);
679
+ }
680
+ const reminderResponse = await prompts({
681
+ type: "select",
682
+ name: "reminder",
683
+ message: "Reminder frequency:",
684
+ choices: REMINDER_OPTIONS,
685
+ initial: 1
686
+ // Default to 7d
687
+ });
688
+ const reminder = reminderResponse.reminder;
689
+ if (reminder && reminder !== "never") {
690
+ config = { ...config, reminder };
691
+ }
692
+ process.env["HYNTX_SERVICES"] = config.services.join(",");
693
+ process.env["HYNTX_REMINDER"] = config.reminder;
694
+ if (config.services.includes("ollama")) {
695
+ process.env["HYNTX_OLLAMA_MODEL"] = config.ollama.model;
696
+ process.env["HYNTX_OLLAMA_HOST"] = config.ollama.host;
697
+ }
698
+ if (config.services.includes("anthropic") && config.anthropic.apiKey) {
699
+ process.env["HYNTX_ANTHROPIC_MODEL"] = config.anthropic.model;
700
+ process.env["HYNTX_ANTHROPIC_KEY"] = config.anthropic.apiKey;
701
+ }
702
+ if (config.services.includes("google") && config.google.apiKey) {
703
+ process.env["HYNTX_GOOGLE_MODEL"] = config.google.model;
704
+ process.env["HYNTX_GOOGLE_KEY"] = config.google.apiKey;
705
+ }
706
+ const { detectShellConfigFile: detectShellConfigFile2 } = await Promise.resolve().then(() => (init_shell_config(), shell_config_exports));
707
+ const { configFile } = detectShellConfigFile2();
708
+ const saveToShellResponse = await prompts({
709
+ type: "confirm",
710
+ name: "saveToShell",
711
+ message: `Save configuration to ${configFile}?`,
712
+ initial: true
713
+ });
714
+ const saveToShell = saveToShellResponse.saveToShell ?? false;
715
+ if (saveToShell) {
716
+ const result = saveConfigToShell(config);
717
+ if (result.success) {
718
+ console.log("\n" + chalk3.green("\u2705 " + result.message));
719
+ console.log(
720
+ chalk3.dim(
721
+ " Run 'source " + result.shellFile + "' or open a new terminal to apply."
722
+ )
723
+ );
724
+ } else {
725
+ console.log("\n" + chalk3.yellow("\u26A0\uFE0F " + result.message));
726
+ showManualInstructions(config);
727
+ }
728
+ } else {
729
+ showManualInstructions(config);
730
+ }
731
+ return config;
732
+ }
733
+
734
+ // src/core/sanitizer.ts
735
+ function redactOpenAIKeys(text) {
736
+ return text.replace(/sk-[a-zA-Z0-9]{48,}/g, "[REDACTED_OPENAI_KEY]");
737
+ }
738
+ function redactAnthropicKeys(text) {
739
+ return text.replace(/sk-ant-[a-zA-Z0-9-]+/g, "[REDACTED_ANTHROPIC_KEY]");
740
+ }
741
+ function redactAWSCredentials(text) {
742
+ return text.replace(/AKIA[0-9A-Z]{16}/g, "[REDACTED_AWS_KEY]");
743
+ }
744
+ function redactBearerTokens(text) {
745
+ return text.replace(
746
+ /Bearer(?:\s+token)?:?\s+[a-zA-Z0-9._-]{20,}/gi,
747
+ "Bearer [REDACTED_TOKEN]"
748
+ );
749
+ }
750
+ function redactURLCredentials(text) {
751
+ return text.replace(
752
+ /(https?:\/\/)([^:\s@]+)(?::([^\s@]+))?@/g,
753
+ (match, protocol, _user, _pass) => {
754
+ return `${protocol}[REDACTED_URL_CREDENTIAL]@`;
755
+ }
756
+ );
757
+ }
758
+ function redactEmails(text) {
759
+ return text.replace(
760
+ /[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,
761
+ "[REDACTED_EMAIL]"
762
+ );
763
+ }
764
+ function redactPEMKeys(text) {
765
+ return text.replace(
766
+ /-----BEGIN\s+[A-Z\s]+PRIVATE\s+KEY-----[\s\S]*?-----END\s+[A-Z\s]+PRIVATE\s+KEY-----/g,
767
+ "[REDACTED_PEM_KEY]"
768
+ );
769
+ }
770
+ function redactNames(text) {
771
+ return text.replace(
772
+ /\b(?:Hi|Hello|Hey|Dear|Greetings|Good\s+(?:morning|afternoon|evening))\s+([A-Z][a-z]+(?:\s+[A-Z][a-z]+)?(?:\s+[A-Z][a-z]+)?)\b/gi,
773
+ (match, name) => {
774
+ const commonWords = /\b(?:there|everyone|all|team|guys|folks|people)\b/i;
775
+ if (name && name.length >= 2 && !commonWords.test(name)) {
776
+ return match.replace(name, "[REDACTED_NAME]");
777
+ }
778
+ return match;
779
+ }
780
+ );
781
+ }
782
+ function redactPhoneNumbers(text) {
783
+ return text.replace(
784
+ /(?:\+?1[-.\s]?)?\(?([0-9]{3})\)?[-.\s]?([0-9]{3})[-.\s]?([0-9]{4})\b/g,
785
+ "[REDACTED_PHONE]"
786
+ );
787
+ }
788
+ function redactCreditCards(text) {
789
+ return text.replace(
790
+ /\b(?:(?:4\d{3}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{1,4})|(?:5[1-5]\d{2}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4})|(?:3[47]\d{2}[\s-]?\d{6}[\s-]?\d{5})|(?:3[068]\d[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}))\b/g,
791
+ "[REDACTED_CREDIT_CARD]"
792
+ );
793
+ }
794
+ function redactSSN(text) {
795
+ return text.replace(
796
+ /\b(?!000|666|9\d{2})([0-9]{3})[-.\s]?(?!00)([0-9]{2})[-.\s]?(?!0000)([0-9]{4})\b/g,
797
+ "[REDACTED_SSN]"
798
+ );
799
+ }
800
+ function redactSpanishDNI(text) {
801
+ return text.replace(/\b\d{8}[A-Z]\b/gi, "[REDACTED_SPANISH_DNI]");
802
+ }
803
+ function redactSpanishNIE(text) {
804
+ return text.replace(/\b[XYZ]\d{7}[A-Z]\b/gi, "[REDACTED_SPANISH_NIE]");
805
+ }
806
+ function redactMexicanCURP(text) {
807
+ return text.replace(
808
+ /\b[A-Z]{4}\d{6}[HM][A-Z]{5}[0-9A-Z]{2}\b/gi,
809
+ "[REDACTED_MEXICAN_CURP]"
810
+ );
811
+ }
812
+ function redactBrazilianCPF(text) {
813
+ return text.replace(
814
+ /\b\d{3}\.?\d{3}\.?\d{3}-?\d{2}\b/g,
815
+ "[REDACTED_BRAZILIAN_CPF]"
816
+ );
817
+ }
818
+ function redactUKNINO(text) {
819
+ return text.replace(
820
+ /\b[A-Z]{2}\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-Z]\b/gi,
821
+ "[REDACTED_UK_NINO]"
822
+ );
823
+ }
824
+ function redactChileanRUN(text) {
825
+ return text.replace(/\b\d{7,8}-?[0-9K]\b/gi, "[REDACTED_CHILEAN_RUN]");
826
+ }
827
+ function redactArgentineDNI(text) {
828
+ return text.replace(
829
+ /\b(?:DNI|dni)[\s:]*(\d{8})\b/gi,
830
+ (match, dni) => {
831
+ return match.replace(dni, "[REDACTED_ARGENTINE_DNI]");
832
+ }
833
+ );
834
+ }
835
+ function redactIPv4(text) {
836
+ return text.replace(
837
+ /\b(?!(?:127\.0\.0\.1|0\.0\.0\.0|255\.255\.255\.255))(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b/g,
838
+ "[REDACTED_IPV4]"
839
+ );
840
+ }
841
+ function redactIPv6(text) {
842
+ return text.replace(
843
+ /\b(?!(?:::1|::))(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}\b|\b(?:[0-9a-fA-F]{1,4}:){1,7}::\b|\b::(?:[0-9a-fA-F]{1,4}:){1,7}[0-9a-fA-F]{1,4}\b/g,
844
+ "[REDACTED_IPV6]"
845
+ );
846
+ }
847
+ function redactMACAddresses(text) {
848
+ return text.replace(
849
+ /\b(?:[0-9A-Fa-f]{2}[:-]){5}(?:[0-9A-Fa-f]{2})\b/g,
850
+ "[REDACTED_MAC_ADDRESS]"
851
+ );
852
+ }
853
+ function redactPassportNumbers(text) {
854
+ return text.replace(
855
+ /\b(?:passport|pasaporte)[\s:]*([A-Z0-9]{6,9})\b/gi,
856
+ (match, passport) => {
857
+ return match.replace(passport, "[REDACTED_PASSPORT]");
858
+ }
859
+ );
860
+ }
861
+ function redactDriverLicenseNumbers(text) {
862
+ return text.replace(
863
+ /\b(?:driver\s*license|licencia\s*de\s*conducir|DL|D\.L\.)[\s:]*([A-Z0-9]{8,16})\b/gi,
864
+ (match, license) => {
865
+ return match.replace(license, "[REDACTED_DRIVER_LICENSE]");
866
+ }
867
+ );
868
+ }
869
+ function redactAddresses(text) {
870
+ let sanitized = text;
871
+ sanitized = sanitized.replace(/\b\d{5}(?:-\d{4})?\b/g, "[REDACTED_ZIP_CODE]");
872
+ sanitized = sanitized.replace(
873
+ /\b[A-Z]{1,2}\d{1,2}[A-Z]?\s?\d[A-Z]{2}\b/gi,
874
+ "[REDACTED_POSTCODE]"
875
+ );
876
+ sanitized = sanitized.replace(
877
+ /\b[A-Z]\d[A-Z]\s?\d[A-Z]\d\b/gi,
878
+ "[REDACTED_POSTAL_CODE]"
879
+ );
880
+ sanitized = sanitized.replace(
881
+ /\b(?:address|direcci[oó]n|street|calle|avenue|ave)[\s:]*(\d+\s+[A-Za-z\s]+(?:street|st|avenue|ave|road|rd|boulevard|blvd|drive|dr|lane|ln|way|circle|cir))?\b/gi,
882
+ (match) => {
883
+ return match.replace(
884
+ /\d+\s+[A-Za-z\s]+(?:street|st|avenue|ave|road|rd|boulevard|blvd|drive|dr|lane|ln|way|circle|cir)/gi,
885
+ "[REDACTED_ADDRESS]"
886
+ );
887
+ }
888
+ );
889
+ return sanitized;
890
+ }
891
+ function redactBirthDates(text) {
892
+ return text.replace(
893
+ /\b(?:DOB|date\s+of\s+birth|fecha\s+de\s+nacimiento|born)[\s:]*(\d{1,2}[-/.]\d{1,2}[-/.]\d{2,4})\b/gi,
894
+ (match, date) => {
895
+ return match.replace(date, "[REDACTED_BIRTH_DATE]");
896
+ }
897
+ );
898
+ }
899
+ function countRedactions(original, sanitized) {
900
+ const redactionPattern = /\[REDACTED_[^\]]+\]/g;
901
+ const matches = sanitized.match(redactionPattern);
902
+ return matches ? matches.length : 0;
903
+ }
904
+ function sanitize(text) {
905
+ if (!text || text.trim().length === 0) {
906
+ return { text, redacted: 0 };
907
+ }
908
+ let sanitized = text;
909
+ sanitized = redactOpenAIKeys(sanitized);
910
+ sanitized = redactAnthropicKeys(sanitized);
911
+ sanitized = redactAWSCredentials(sanitized);
912
+ sanitized = redactBearerTokens(sanitized);
913
+ sanitized = redactURLCredentials(sanitized);
914
+ sanitized = redactPEMKeys(sanitized);
915
+ sanitized = redactEmails(sanitized);
916
+ sanitized = redactPhoneNumbers(sanitized);
917
+ sanitized = redactCreditCards(sanitized);
918
+ sanitized = redactSSN(sanitized);
919
+ sanitized = redactSpanishDNI(sanitized);
920
+ sanitized = redactSpanishNIE(sanitized);
921
+ sanitized = redactMexicanCURP(sanitized);
922
+ sanitized = redactBrazilianCPF(sanitized);
923
+ sanitized = redactUKNINO(sanitized);
924
+ sanitized = redactChileanRUN(sanitized);
925
+ sanitized = redactArgentineDNI(sanitized);
926
+ sanitized = redactIPv4(sanitized);
927
+ sanitized = redactIPv6(sanitized);
928
+ sanitized = redactMACAddresses(sanitized);
929
+ sanitized = redactPassportNumbers(sanitized);
930
+ sanitized = redactDriverLicenseNumbers(sanitized);
931
+ sanitized = redactAddresses(sanitized);
932
+ sanitized = redactBirthDates(sanitized);
933
+ sanitized = redactNames(sanitized);
934
+ const redacted = countRedactions(text, sanitized);
935
+ return {
936
+ text: sanitized,
937
+ redacted
938
+ };
939
+ }
940
+ function sanitizePrompts(prompts2) {
941
+ if (prompts2.length === 0) {
942
+ return { prompts: [], totalRedacted: 0 };
943
+ }
944
+ const sanitizedPrompts = [];
945
+ let totalRedacted = 0;
946
+ for (const prompt of prompts2) {
947
+ const result = sanitize(prompt);
948
+ sanitizedPrompts.push(result.text);
949
+ totalRedacted += result.redacted;
950
+ }
951
+ return {
952
+ prompts: sanitizedPrompts,
953
+ totalRedacted
954
+ };
955
+ }
956
+
957
+ // src/core/analyzer.ts
958
+ var SYSTEM_OVERHEAD_TOKENS = 2e3;
959
+ var SEVERITY_RANK = {
960
+ high: 3,
961
+ medium: 2,
962
+ low: 1
963
+ };
964
+ var MAX_PATTERNS = 5;
965
+ var MAX_EXAMPLES_PER_PATTERN = 3;
966
+ var CHARS_PER_TOKEN = 4;
967
+ function average(numbers) {
968
+ if (numbers.length === 0) return 0;
969
+ return sum(numbers) / numbers.length;
970
+ }
971
+ function sum(numbers) {
972
+ return numbers.reduce((acc, n) => acc + n, 0);
973
+ }
974
+ function flattenAll(arrays) {
975
+ const result = [];
976
+ for (const arr of arrays) {
977
+ for (const item of arr) {
978
+ result.push(item);
979
+ }
980
+ }
981
+ return result;
982
+ }
983
+ function limitExamples(examples, max) {
984
+ return examples.slice(0, max);
985
+ }
986
+ function inferProviderType(providerName) {
987
+ const nameLower = providerName.toLowerCase();
988
+ if (nameLower.includes("ollama")) return "ollama";
989
+ if (nameLower.includes("anthropic") || nameLower.includes("claude"))
990
+ return "anthropic";
991
+ if (nameLower.includes("google") || nameLower.includes("gemini"))
992
+ return "google";
993
+ return "ollama";
994
+ }
995
+ function maxSeverity(severities) {
996
+ if (severities.length === 0) return "low";
997
+ let max = "low";
998
+ let maxRank = SEVERITY_RANK.low;
999
+ for (const severity of severities) {
1000
+ const rank = SEVERITY_RANK[severity];
1001
+ if (rank > maxRank) {
1002
+ max = severity;
1003
+ maxRank = rank;
1004
+ }
1005
+ }
1006
+ return max;
1007
+ }
1008
+ function estimateTokens(text) {
1009
+ if (!text || text.length === 0) return 0;
1010
+ return Math.ceil(text.length / CHARS_PER_TOKEN);
1011
+ }
1012
+ function batchPrompts(options) {
1013
+ const { prompts: prompts2, maxTokensPerBatch, prioritization } = options;
1014
+ if (prompts2.length === 0) {
1015
+ return [];
1016
+ }
1017
+ const effectiveLimit = maxTokensPerBatch - SYSTEM_OVERHEAD_TOKENS;
1018
+ const promptsWithTokens = prompts2.map((prompt) => ({
1019
+ prompt,
1020
+ tokens: estimateTokens(prompt)
1021
+ }));
1022
+ const sorted = prioritization === "longest-first" ? [...promptsWithTokens].sort((a, b) => b.tokens - a.tokens) : promptsWithTokens;
1023
+ const batches = [];
1024
+ let currentBatch = [];
1025
+ let currentTokens = 0;
1026
+ for (const { prompt, tokens } of sorted) {
1027
+ if (tokens > effectiveLimit) {
1028
+ if (currentBatch.length > 0) {
1029
+ batches.push({ prompts: currentBatch, tokens: currentTokens });
1030
+ currentBatch = [];
1031
+ currentTokens = 0;
1032
+ }
1033
+ batches.push({ prompts: [prompt], tokens });
1034
+ continue;
1035
+ }
1036
+ if (currentTokens + tokens > effectiveLimit && currentBatch.length > 0) {
1037
+ batches.push({ prompts: currentBatch, tokens: currentTokens });
1038
+ currentBatch = [prompt];
1039
+ currentTokens = tokens;
1040
+ } else {
1041
+ currentBatch.push(prompt);
1042
+ currentTokens += tokens;
1043
+ }
1044
+ }
1045
+ if (currentBatch.length > 0) {
1046
+ batches.push({ prompts: currentBatch, tokens: currentTokens });
1047
+ }
1048
+ return batches;
1049
+ }
1050
+ function mergeBatchResults(options) {
1051
+ const { results, date } = options;
1052
+ if (results.length === 0) {
1053
+ throw new Error("Cannot merge empty results array");
1054
+ }
1055
+ if (results.length === 1) {
1056
+ const result = results[0];
1057
+ if (!result) {
1058
+ throw new Error("Results array is empty");
1059
+ }
1060
+ const limitedPatterns = result.patterns.map((p) => ({
1061
+ ...p,
1062
+ examples: limitExamples(p.examples, MAX_EXAMPLES_PER_PATTERN)
1063
+ })).sort((a, b) => {
1064
+ const severityDiff = SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity];
1065
+ if (severityDiff !== 0) return severityDiff;
1066
+ return b.frequency - a.frequency;
1067
+ }).slice(0, MAX_PATTERNS);
1068
+ const topSuggestion2 = limitedPatterns.length > 0 && limitedPatterns[0] ? limitedPatterns[0].suggestion : result.topSuggestion;
1069
+ return {
1070
+ ...result,
1071
+ date,
1072
+ patterns: limitedPatterns,
1073
+ topSuggestion: topSuggestion2
1074
+ };
1075
+ }
1076
+ const allPatterns = flattenAll(results.map((r) => r.patterns));
1077
+ const patternGroups = /* @__PURE__ */ new Map();
1078
+ for (const pattern of allPatterns) {
1079
+ const group = patternGroups.get(pattern.id) ?? [];
1080
+ group.push(pattern);
1081
+ patternGroups.set(pattern.id, group);
1082
+ }
1083
+ const mergedPatterns = [];
1084
+ for (const group of patternGroups.values()) {
1085
+ if (group.length === 0) continue;
1086
+ const firstPattern = group[0];
1087
+ if (!firstPattern) continue;
1088
+ if (group.length === 1) {
1089
+ mergedPatterns.push({
1090
+ ...firstPattern,
1091
+ examples: limitExamples(
1092
+ firstPattern.examples,
1093
+ MAX_EXAMPLES_PER_PATTERN
1094
+ )
1095
+ });
1096
+ } else {
1097
+ const frequencies = group.map((p) => p.frequency);
1098
+ const severities = group.map((p) => p.severity);
1099
+ const allExamples = group.flatMap((p) => Array.from(p.examples));
1100
+ const mergedFrequency = Math.round(average(frequencies));
1101
+ const mergedSeverity = maxSeverity(severities);
1102
+ const mergedExamples = limitExamples(
1103
+ allExamples,
1104
+ MAX_EXAMPLES_PER_PATTERN
1105
+ );
1106
+ mergedPatterns.push({
1107
+ ...firstPattern,
1108
+ frequency: mergedFrequency,
1109
+ severity: mergedSeverity,
1110
+ examples: mergedExamples
1111
+ });
1112
+ }
1113
+ }
1114
+ const sortedPatterns = mergedPatterns.sort((a, b) => {
1115
+ const severityDiff = SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity];
1116
+ if (severityDiff !== 0) return severityDiff;
1117
+ return b.frequency - a.frequency;
1118
+ });
1119
+ const topPatterns = sortedPatterns.slice(0, MAX_PATTERNS);
1120
+ const totalPrompts = sum(results.map((r) => r.stats.totalPrompts));
1121
+ const promptsWithIssues = sum(results.map((r) => r.stats.promptsWithIssues));
1122
+ const avgScore = Math.round(
1123
+ average(results.map((r) => r.stats.overallScore))
1124
+ );
1125
+ const topSuggestion = topPatterns.length > 0 && topPatterns[0] ? topPatterns[0].suggestion : results[0]?.topSuggestion ?? "No suggestions available";
1126
+ return {
1127
+ date,
1128
+ patterns: topPatterns,
1129
+ stats: {
1130
+ totalPrompts,
1131
+ promptsWithIssues,
1132
+ overallScore: avgScore
1133
+ },
1134
+ topSuggestion
1135
+ };
1136
+ }
1137
+ async function analyzePrompts(options) {
1138
+ const { provider, prompts: prompts2, date, onProgress } = options;
1139
+ if (prompts2.length === 0) {
1140
+ throw new Error("Cannot analyze empty prompts array");
1141
+ }
1142
+ const { prompts: sanitizedPrompts } = sanitizePrompts(prompts2);
1143
+ const providerType = inferProviderType(provider.name);
1144
+ const limits = PROVIDER_LIMITS[providerType];
1145
+ const batches = batchPrompts({
1146
+ prompts: sanitizedPrompts,
1147
+ maxTokensPerBatch: limits.maxTokensPerBatch,
1148
+ prioritization: limits.prioritization
1149
+ });
1150
+ if (batches.length === 1) {
1151
+ const batch = batches[0];
1152
+ if (!batch) {
1153
+ throw new Error("Failed to create batches");
1154
+ }
1155
+ if (onProgress) {
1156
+ onProgress(0, 1);
1157
+ }
1158
+ const result = await provider.analyze(batch.prompts, date);
1159
+ if (onProgress) {
1160
+ onProgress(1, 1);
1161
+ }
1162
+ return result;
1163
+ }
1164
+ const results = [];
1165
+ const totalBatches = batches.length;
1166
+ for (let i = 0; i < batches.length; i++) {
1167
+ const batch = batches[i];
1168
+ if (!batch) continue;
1169
+ if (onProgress) {
1170
+ onProgress(i, totalBatches);
1171
+ }
1172
+ const result = await provider.analyze(batch.prompts, date);
1173
+ results.push(result);
1174
+ }
1175
+ if (onProgress) {
1176
+ onProgress(totalBatches, totalBatches);
1177
+ }
1178
+ return mergeBatchResults({ results, date });
1179
+ }
1180
+ function severityIcon(severity) {
1181
+ const icons = {
1182
+ high: "\u{1F534}",
1183
+ medium: "\u{1F7E1}",
1184
+ low: "\u{1F7E2}"
1185
+ };
1186
+ return icons[severity];
1187
+ }
1188
+ function scoreColor(score, text) {
1189
+ if (score >= 8) {
1190
+ return chalk3.green(text);
1191
+ }
1192
+ if (score >= 6) {
1193
+ return chalk3.yellow(text);
1194
+ }
1195
+ return chalk3.red(text);
1196
+ }
1197
+ function truncateText(text, maxLength) {
1198
+ if (text.length <= maxLength) {
1199
+ return text;
1200
+ }
1201
+ const truncated = text.slice(0, maxLength);
1202
+ const lastSpace = truncated.lastIndexOf(" ");
1203
+ if (lastSpace > 0) {
1204
+ return truncated.slice(0, lastSpace) + "...";
1205
+ }
1206
+ return truncated + "...";
1207
+ }
1208
+ function formatHeader(title) {
1209
+ const headerText = "Hyntx Analysis";
1210
+ try {
1211
+ const ascii = figlet.textSync(headerText, {
1212
+ font: "Standard",
1213
+ horizontalLayout: "default"
1214
+ });
1215
+ return chalk3.cyan(ascii);
1216
+ } catch {
1217
+ return chalk3.cyan.bold(`
1218
+ ${headerText}
1219
+ `);
1220
+ }
1221
+ }
1222
+ function formatStats(stats, projectCount) {
1223
+ const table = new Table({
1224
+ head: [chalk3.bold("Metric"), chalk3.bold("Value")],
1225
+ colWidths: [30, 20]
1226
+ });
1227
+ table.push(
1228
+ ["Total Prompts", String(stats.totalPrompts)],
1229
+ ["Prompts with Issues", String(stats.promptsWithIssues)],
1230
+ [
1231
+ "Overall Score",
1232
+ scoreColor(stats.overallScore, `${String(stats.overallScore)}/10`)
1233
+ ]
1234
+ );
1235
+ return table.toString();
1236
+ }
1237
+ function formatPattern(pattern, index) {
1238
+ const lines = [];
1239
+ lines.push(
1240
+ chalk3.bold(
1241
+ `${String(index + 1)}. ${severityIcon(pattern.severity)} ${pattern.name}`
1242
+ )
1243
+ );
1244
+ lines.push(
1245
+ chalk3.dim(
1246
+ ` Frequency: ${String(pattern.frequency)} | Severity: ${pattern.severity}`
1247
+ )
1248
+ );
1249
+ lines.push("");
1250
+ if (pattern.examples.length > 0) {
1251
+ lines.push(chalk3.yellow(" Examples:"));
1252
+ for (const example of pattern.examples) {
1253
+ lines.push(chalk3.dim(` \u2022 ${example}`));
1254
+ }
1255
+ lines.push("");
1256
+ }
1257
+ lines.push(chalk3.green(" Suggestion:"));
1258
+ lines.push(chalk3.dim(` ${pattern.suggestion}`));
1259
+ return boxen2(lines.join("\n"), {
1260
+ padding: 1,
1261
+ borderColor: pattern.severity === "high" ? "red" : "yellow",
1262
+ borderStyle: "round"
1263
+ });
1264
+ }
1265
+ function formatBeforeAfter(beforeAfter) {
1266
+ const sections = [];
1267
+ const beforeBox = boxen2(chalk3.red(beforeAfter.before), {
1268
+ padding: 1,
1269
+ borderColor: "red",
1270
+ borderStyle: "round",
1271
+ title: "\u274C Before"
1272
+ });
1273
+ sections.push(beforeBox);
1274
+ const afterBox = boxen2(chalk3.green(beforeAfter.after), {
1275
+ padding: 1,
1276
+ borderColor: "green",
1277
+ borderStyle: "round",
1278
+ title: "\u2705 After"
1279
+ });
1280
+ sections.push(afterBox);
1281
+ return sections.join("\n\n");
1282
+ }
1283
+ function formatTopSuggestion(suggestion) {
1284
+ return boxen2(chalk3.cyan.bold(suggestion), {
1285
+ padding: 1,
1286
+ borderColor: "cyan",
1287
+ borderStyle: "double",
1288
+ title: "\u{1F4A1} Top Suggestion"
1289
+ });
1290
+ }
1291
+ function printReport(result, options) {
1292
+ const opts = {
1293
+ maxTextLength: 200
1294
+ };
1295
+ const output = [];
1296
+ {
1297
+ output.push(formatHeader());
1298
+ output.push("");
1299
+ }
1300
+ output.push(chalk3.bold("\u{1F4CA} Statistics"));
1301
+ output.push("");
1302
+ output.push(formatStats(result.stats));
1303
+ output.push("");
1304
+ if (result.topSuggestion) {
1305
+ output.push(formatTopSuggestion(result.topSuggestion));
1306
+ output.push("");
1307
+ }
1308
+ if (result.patterns.length > 0) {
1309
+ output.push(chalk3.bold("\u{1F50D} Detected Patterns"));
1310
+ output.push("");
1311
+ for (const [index, pattern] of result.patterns.entries()) {
1312
+ const truncatedPattern = {
1313
+ ...pattern,
1314
+ examples: pattern.examples.map(
1315
+ (ex) => truncateText(ex, opts.maxTextLength)
1316
+ ),
1317
+ suggestion: truncateText(pattern.suggestion, opts.maxTextLength)
1318
+ };
1319
+ output.push(formatPattern(truncatedPattern, index));
1320
+ output.push("");
1321
+ if (index === 0) {
1322
+ const truncatedBeforeAfter = {
1323
+ before: truncateText(pattern.beforeAfter.before, opts.maxTextLength),
1324
+ after: truncateText(pattern.beforeAfter.after, opts.maxTextLength)
1325
+ };
1326
+ output.push(formatBeforeAfter(truncatedBeforeAfter));
1327
+ output.push("");
1328
+ }
1329
+ }
1330
+ } else {
1331
+ output.push(chalk3.green("\u2705 No issues detected!"));
1332
+ output.push("");
1333
+ }
1334
+ output.push(chalk3.dim(`Analysis Date: ${result.date}`));
1335
+ console.log(output.join("\n"));
1336
+ }
1337
+
1338
+ // src/providers/base.ts
1339
+ var SYSTEM_PROMPT = `You are an AI prompt quality analyzer. Your task is to analyze user prompts to Claude Code and identify patterns that could be improved for clarity, specificity, and effectiveness.
1340
+
1341
+ Analyze the provided prompts and return a JSON object with the following structure:
1342
+
1343
+ {
1344
+ "patterns": [
1345
+ {
1346
+ "id": "unique-kebab-case-id",
1347
+ "name": "Pattern Name",
1348
+ "frequency": <number of occurrences>,
1349
+ "severity": "low" | "medium" | "high",
1350
+ "examples": ["example prompt 1", "example prompt 2"],
1351
+ "suggestion": "Clear, actionable suggestion for improvement",
1352
+ "beforeAfter": {
1353
+ "before": "Example of current prompt",
1354
+ "after": "Example of improved prompt"
1355
+ }
1356
+ }
1357
+ ],
1358
+ "stats": {
1359
+ "totalPrompts": <total number of prompts analyzed>,
1360
+ "promptsWithIssues": <number of prompts with detected issues>,
1361
+ "overallScore": <score from 0-100, where 100 is perfect>
1362
+ },
1363
+ "topSuggestion": "Most important single improvement to make"
1364
+ }
1365
+
1366
+ Guidelines:
1367
+ - Focus on patterns that appear multiple times (frequency >= 2)
1368
+ - Severity: "high" for clarity issues, "medium" for specificity, "low" for style
1369
+ - Examples should be actual quotes from the prompts (or close paraphrases)
1370
+ - beforeAfter should show concrete, realistic improvements
1371
+ - topSuggestion should be the most impactful single change
1372
+ - If no issues found, return empty patterns array with score 100
1373
+ - Be constructive and specific in suggestions`;
1374
+ function buildUserPrompt(prompts2, date) {
1375
+ if (prompts2.length === 0) {
1376
+ throw new Error("Cannot build prompt from empty array");
1377
+ }
1378
+ const promptsList = prompts2.map((prompt, index) => `${String(index + 1)}. ${prompt}`).join("\n\n");
1379
+ const count = String(prompts2.length);
1380
+ const plural = prompts2.length === 1 ? "" : "s";
1381
+ return `Analyze the following ${count} prompt${plural} from ${date}:
1382
+
1383
+ ${promptsList}
1384
+
1385
+ Please provide your analysis as a JSON object following the specified schema.`;
1386
+ }
1387
+ function parseResponse(response, date) {
1388
+ const codeBlockRegex = /```(?:json)?\s*\n?([\s\S]*?)\n?```/;
1389
+ const jsonMatch = codeBlockRegex.exec(response);
1390
+ const jsonString = jsonMatch?.[1]?.trim() ?? response.trim();
1391
+ let parsed;
1392
+ try {
1393
+ parsed = JSON.parse(jsonString);
1394
+ } catch (error) {
1395
+ throw new Error(
1396
+ `Failed to parse response as JSON: ${error instanceof Error ? error.message : "Unknown error"}`
1397
+ );
1398
+ }
1399
+ if (!isValidAnalysisResponse(parsed)) {
1400
+ throw new Error("Response does not match expected schema");
1401
+ }
1402
+ return {
1403
+ date,
1404
+ patterns: parsed.patterns,
1405
+ stats: parsed.stats,
1406
+ topSuggestion: parsed.topSuggestion
1407
+ };
1408
+ }
1409
+ function isValidAnalysisResponse(value) {
1410
+ if (typeof value !== "object" || value === null) {
1411
+ return false;
1412
+ }
1413
+ const obj = value;
1414
+ if (!Array.isArray(obj["patterns"])) {
1415
+ return false;
1416
+ }
1417
+ for (const pattern of obj["patterns"]) {
1418
+ if (!isValidPattern(pattern)) {
1419
+ return false;
1420
+ }
1421
+ }
1422
+ if (typeof obj["stats"] !== "object" || obj["stats"] === null) {
1423
+ return false;
1424
+ }
1425
+ const stats = obj["stats"];
1426
+ if (typeof stats["totalPrompts"] !== "number" || typeof stats["promptsWithIssues"] !== "number" || typeof stats["overallScore"] !== "number") {
1427
+ return false;
1428
+ }
1429
+ if (typeof obj["topSuggestion"] !== "string") {
1430
+ return false;
1431
+ }
1432
+ return true;
1433
+ }
1434
+ function isValidPattern(value) {
1435
+ if (typeof value !== "object" || value === null) {
1436
+ return false;
1437
+ }
1438
+ const obj = value;
1439
+ if (typeof obj["id"] !== "string" || typeof obj["name"] !== "string" || typeof obj["frequency"] !== "number" || typeof obj["suggestion"] !== "string") {
1440
+ return false;
1441
+ }
1442
+ if (obj["severity"] !== "low" && obj["severity"] !== "medium" && obj["severity"] !== "high") {
1443
+ return false;
1444
+ }
1445
+ if (!Array.isArray(obj["examples"]) || !obj["examples"].every((e) => typeof e === "string")) {
1446
+ return false;
1447
+ }
1448
+ if (typeof obj["beforeAfter"] !== "object" || obj["beforeAfter"] === null) {
1449
+ return false;
1450
+ }
1451
+ const beforeAfter = obj["beforeAfter"];
1452
+ if (typeof beforeAfter["before"] !== "string" || typeof beforeAfter["after"] !== "string") {
1453
+ return false;
1454
+ }
1455
+ return true;
1456
+ }
1457
+
1458
+ // src/providers/ollama.ts
1459
+ var MAX_RETRIES = 2;
1460
+ var AVAILABILITY_TIMEOUT_MS = 3e3;
1461
+ var ANALYSIS_TIMEOUT_MS = 6e4;
1462
+ var BASE_RETRY_DELAY_MS = 1e3;
1463
+ var OllamaProvider = class {
1464
+ name = "Ollama";
1465
+ config;
1466
+ /**
1467
+ * Creates a new OllamaProvider instance.
1468
+ *
1469
+ * @param config - Ollama configuration with model and host
1470
+ */
1471
+ constructor(config) {
1472
+ this.config = config;
1473
+ }
1474
+ /**
1475
+ * Checks if the Ollama service is available and has the required model.
1476
+ * Uses a 3-second timeout to avoid hanging on unreachable services.
1477
+ *
1478
+ * @returns Promise that resolves to true if available, false otherwise
1479
+ */
1480
+ async isAvailable() {
1481
+ try {
1482
+ const controller = new AbortController();
1483
+ const timeoutId = setTimeout(() => {
1484
+ controller.abort();
1485
+ }, AVAILABILITY_TIMEOUT_MS);
1486
+ const response = await fetch(`${this.config.host}/api/tags`, {
1487
+ signal: controller.signal
1488
+ });
1489
+ clearTimeout(timeoutId);
1490
+ if (!response.ok) {
1491
+ return false;
1492
+ }
1493
+ const data = await response.json();
1494
+ if (!data.models || !Array.isArray(data.models)) {
1495
+ return false;
1496
+ }
1497
+ return data.models.some(
1498
+ (model) => model.name.includes(this.config.model)
1499
+ );
1500
+ } catch {
1501
+ return false;
1502
+ }
1503
+ }
1504
+ /**
1505
+ * Analyzes prompts using the Ollama service.
1506
+ * Implements retry logic with exponential backoff for network errors.
1507
+ *
1508
+ * @param prompts - Array of prompt strings to analyze
1509
+ * @param date - Date context for the analysis
1510
+ * @returns Promise resolving to AnalysisResult
1511
+ * @throws Error if analysis fails after retries or if response is invalid
1512
+ */
1513
+ async analyze(prompts2, date) {
1514
+ if (prompts2.length === 0) {
1515
+ throw new Error("Cannot analyze empty prompts array");
1516
+ }
1517
+ const userPrompt = buildUserPrompt(prompts2, date);
1518
+ let lastError;
1519
+ for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
1520
+ try {
1521
+ const controller = new AbortController();
1522
+ const timeoutId = setTimeout(() => {
1523
+ controller.abort();
1524
+ }, ANALYSIS_TIMEOUT_MS);
1525
+ const response = await fetch(`${this.config.host}/api/generate`, {
1526
+ method: "POST",
1527
+ headers: {
1528
+ "Content-Type": "application/json"
1529
+ },
1530
+ body: JSON.stringify({
1531
+ model: this.config.model,
1532
+ prompt: userPrompt,
1533
+ system: SYSTEM_PROMPT,
1534
+ stream: false,
1535
+ options: {
1536
+ temperature: 0.3
1537
+ }
1538
+ }),
1539
+ signal: controller.signal
1540
+ });
1541
+ clearTimeout(timeoutId);
1542
+ if (!response.ok) {
1543
+ const status = String(response.status);
1544
+ throw new Error(
1545
+ `Ollama API request failed: ${status} ${response.statusText}`
1546
+ );
1547
+ }
1548
+ const data = await response.json();
1549
+ if (typeof data.response !== "string") {
1550
+ throw new Error("Invalid response format from Ollama API");
1551
+ }
1552
+ return parseResponse(data.response, date);
1553
+ } catch (error) {
1554
+ lastError = error instanceof Error ? error : new Error(String(error));
1555
+ if (lastError.message.includes("parse") || lastError.message.includes("schema")) {
1556
+ throw lastError;
1557
+ }
1558
+ if (attempt === MAX_RETRIES) {
1559
+ break;
1560
+ }
1561
+ const delay = BASE_RETRY_DELAY_MS * Math.pow(2, attempt);
1562
+ await sleep(delay);
1563
+ }
1564
+ }
1565
+ const attempts = String(MAX_RETRIES + 1);
1566
+ throw new Error(
1567
+ `Ollama analysis failed after ${attempts} attempts: ${lastError?.message ?? "Unknown error"}`
1568
+ );
1569
+ }
1570
+ };
1571
+ function sleep(ms) {
1572
+ return new Promise((resolve) => setTimeout(resolve, ms));
1573
+ }
1574
+
1575
+ // src/index.ts
1576
+ var currentDir = dirname(fileURLToPath(import.meta.url));
1577
+ var packageJson = JSON.parse(
1578
+ readFileSync(join(currentDir, "../package.json"), "utf-8")
1579
+ );
1580
+ var VERSION = packageJson.version;
1581
+ function parseArguments() {
1582
+ try {
1583
+ const { values } = parseArgs({
1584
+ options: {
1585
+ date: {
1586
+ type: "string",
1587
+ default: "today"
1588
+ },
1589
+ help: {
1590
+ type: "boolean",
1591
+ short: "h",
1592
+ default: false
1593
+ },
1594
+ version: {
1595
+ type: "boolean",
1596
+ default: false
1597
+ }
1598
+ },
1599
+ strict: true,
1600
+ allowPositionals: false
1601
+ });
1602
+ return {
1603
+ date: values.date || "today",
1604
+ help: values.help || false,
1605
+ version: values.version || false
1606
+ };
1607
+ } catch (error) {
1608
+ const errorMessage = error instanceof Error ? error.message : String(error);
1609
+ throw new Error(`Invalid arguments: ${errorMessage}`);
1610
+ }
1611
+ }
1612
+ function showHelp() {
1613
+ const helpText = `
1614
+ ${chalk3.bold("Usage:")} hyntx [options]
1615
+
1616
+ ${chalk3.bold("Options:")}
1617
+ --date <date> Date to analyze (today, yesterday, YYYY-MM-DD) [default: today]
1618
+ -h, --help Show help
1619
+ --version Show version
1620
+
1621
+ ${chalk3.bold("Exit codes:")}
1622
+ ${String(EXIT_CODES.SUCCESS)} - Success
1623
+ ${String(EXIT_CODES.ERROR)} - Error
1624
+ ${String(EXIT_CODES.NO_DATA)} - No data found
1625
+ ${String(EXIT_CODES.PROVIDER_UNAVAILABLE)} - Provider unavailable
1626
+
1627
+ ${chalk3.bold("Examples:")}
1628
+ hyntx # Analyze today's prompts
1629
+ hyntx --date yesterday # Analyze yesterday
1630
+ hyntx --date 2025-01-20 # Specific date
1631
+ `;
1632
+ console.log(helpText);
1633
+ process.exit(EXIT_CODES.SUCCESS);
1634
+ }
1635
+ function showVersion() {
1636
+ console.log(`hyntx v${VERSION}`);
1637
+ process.exit(EXIT_CODES.SUCCESS);
1638
+ }
1639
+ async function checkAndRunSetup() {
1640
+ if (isFirstRun()) {
1641
+ const spinner = ora("Running first-time setup...").start();
1642
+ spinner.stop();
1643
+ await runSetup();
1644
+ }
1645
+ }
1646
+ async function readLogsWithSpinner(date) {
1647
+ if (!claudeProjectsExist()) {
1648
+ console.error(chalk3.red("Error: Claude Code logs directory not found"));
1649
+ console.error(chalk3.dim(`Expected location: ${CLAUDE_PROJECTS_DIR}`));
1650
+ console.error(
1651
+ chalk3.dim(
1652
+ "\nMake sure Claude Code is installed and has been used at least once."
1653
+ )
1654
+ );
1655
+ process.exit(EXIT_CODES.NO_DATA);
1656
+ }
1657
+ const spinner = ora(`Reading Claude Code logs for ${date}...`).start();
1658
+ try {
1659
+ const result = await readLogs({ date });
1660
+ if (result.prompts.length === 0) {
1661
+ spinner.fail(chalk3.yellow(`No prompts found for ${date}`));
1662
+ console.error(
1663
+ chalk3.dim(
1664
+ "\nTry a different date or check that Claude Code has been used recently."
1665
+ )
1666
+ );
1667
+ process.exit(EXIT_CODES.NO_DATA);
1668
+ }
1669
+ spinner.succeed(
1670
+ chalk3.green(`Found ${String(result.prompts.length)} prompts for ${date}`)
1671
+ );
1672
+ if (result.warnings.length > 0) {
1673
+ for (const warning of result.warnings) {
1674
+ console.warn(chalk3.yellow(`Warning: ${warning}`));
1675
+ }
1676
+ }
1677
+ return result.prompts.map((p) => p.content);
1678
+ } catch (error) {
1679
+ const errorMessage = error instanceof Error ? error.message : String(error);
1680
+ spinner.fail(chalk3.red(`Failed to read logs: ${errorMessage}`));
1681
+ process.exit(EXIT_CODES.ERROR);
1682
+ }
1683
+ }
1684
+ async function connectProviderWithSpinner() {
1685
+ const config = getEnvConfig();
1686
+ if (!config.services.includes("ollama")) {
1687
+ console.error(chalk3.red("Error: Ollama provider not configured"));
1688
+ console.error(
1689
+ chalk3.dim("\nRun setup again to configure Ollama as a provider.")
1690
+ );
1691
+ process.exit(EXIT_CODES.PROVIDER_UNAVAILABLE);
1692
+ }
1693
+ const spinner = ora("Connecting to Ollama...").start();
1694
+ try {
1695
+ const provider = new OllamaProvider(config.ollama);
1696
+ const isAvailable = await provider.isAvailable();
1697
+ if (!isAvailable) {
1698
+ spinner.fail(chalk3.red("Ollama service not available"));
1699
+ console.error(
1700
+ chalk3.dim(
1701
+ `
1702
+ Make sure Ollama is running: ${chalk3.bold("ollama serve")}`
1703
+ )
1704
+ );
1705
+ console.error(
1706
+ chalk3.dim(
1707
+ `And the model "${config.ollama.model}" is installed: ${chalk3.bold(`ollama pull ${config.ollama.model}`)}`
1708
+ )
1709
+ );
1710
+ process.exit(EXIT_CODES.PROVIDER_UNAVAILABLE);
1711
+ }
1712
+ spinner.succeed(
1713
+ chalk3.green(`Connected to Ollama (${config.ollama.model})`)
1714
+ );
1715
+ return provider;
1716
+ } catch (error) {
1717
+ const errorMessage = error instanceof Error ? error.message : String(error);
1718
+ spinner.fail(chalk3.red(`Failed to connect: ${errorMessage}`));
1719
+ process.exit(EXIT_CODES.ERROR);
1720
+ }
1721
+ }
1722
+ async function analyzeWithProgress(provider, prompts2, date) {
1723
+ const spinner = ora(`Analyzing ${String(prompts2.length)} prompts...`).start();
1724
+ try {
1725
+ const result = await analyzePrompts({
1726
+ provider,
1727
+ prompts: prompts2,
1728
+ date,
1729
+ onProgress: (current, total) => {
1730
+ if (total > 1) {
1731
+ spinner.text = `Analyzing ${String(prompts2.length)} prompts (batch ${String(current + 1)}/${String(total)})...`;
1732
+ }
1733
+ }
1734
+ });
1735
+ spinner.succeed(chalk3.green("Analysis complete"));
1736
+ return result;
1737
+ } catch (error) {
1738
+ const errorMessage = error instanceof Error ? error.message : String(error);
1739
+ spinner.fail(chalk3.red(`Analysis failed: ${errorMessage}`));
1740
+ process.exit(EXIT_CODES.ERROR);
1741
+ }
1742
+ }
1743
+ function displayResults(result) {
1744
+ console.log("");
1745
+ printReport(result);
1746
+ }
1747
+ function handleError(error) {
1748
+ console.error(chalk3.red(`
1749
+ Error: ${error.message}`));
1750
+ process.exit(EXIT_CODES.ERROR);
1751
+ }
1752
+ async function main() {
1753
+ try {
1754
+ const args = parseArguments();
1755
+ if (args.help) {
1756
+ showHelp();
1757
+ }
1758
+ if (args.version) {
1759
+ showVersion();
1760
+ }
1761
+ await checkAndRunSetup();
1762
+ const prompts2 = await readLogsWithSpinner(args.date);
1763
+ const provider = await connectProviderWithSpinner();
1764
+ const result = await analyzeWithProgress(provider, prompts2, args.date);
1765
+ displayResults(result);
1766
+ process.exit(EXIT_CODES.SUCCESS);
1767
+ } catch (error) {
1768
+ handleError(error instanceof Error ? error : new Error(String(error)));
1769
+ }
1770
+ }
1771
+ var isMainModule = process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1];
1772
+ if (isMainModule) {
1773
+ void main();
1774
+ }
1775
+
1776
+ export { analyzeWithProgress, checkAndRunSetup, connectProviderWithSpinner, displayResults, handleError, main, parseArguments, readLogsWithSpinner, showHelp, showVersion };
1777
+ //# sourceMappingURL=index.js.map
1778
+ //# sourceMappingURL=index.js.map