hyntx 1.5.0 → 2.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/README.md +499 -6
- package/dist/api/index.d.ts +665 -0
- package/dist/api/index.js +2851 -0
- package/dist/cli.d.ts +225 -0
- package/dist/cli.js +5770 -0
- package/dist/index-B6r9mP1J.d.ts +394 -0
- package/dist/index.d.ts +3 -251
- package/dist/index.js +2349 -3932
- package/package.json +23 -4
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hyntx - TypeScript Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module contains all shared type definitions for the Hyntx system.
|
|
5
|
+
* All types are designed to be composable and type-safe.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Schema version for Claude Code JSONL logs.
|
|
10
|
+
* Used for graceful degradation when log format changes.
|
|
11
|
+
*/
|
|
12
|
+
type SchemaVersion = {
|
|
13
|
+
readonly major: number;
|
|
14
|
+
readonly minor: number;
|
|
15
|
+
readonly detected: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Message structure in Claude Code JSONL logs.
|
|
19
|
+
* Represents a single entry in the conversation log.
|
|
20
|
+
*/
|
|
21
|
+
type ClaudeMessage = {
|
|
22
|
+
readonly type: 'user' | 'assistant' | 'system';
|
|
23
|
+
readonly message: {
|
|
24
|
+
readonly role: 'user' | 'assistant' | 'system';
|
|
25
|
+
readonly content: string;
|
|
26
|
+
};
|
|
27
|
+
readonly timestamp: string;
|
|
28
|
+
readonly sessionId: string;
|
|
29
|
+
readonly cwd: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Log entry type alias for JSONL files.
|
|
33
|
+
* Used in test utilities and log parsing.
|
|
34
|
+
*/
|
|
35
|
+
type LogEntry = ClaudeMessage;
|
|
36
|
+
/**
|
|
37
|
+
* Data extracted from Claude Code messages.
|
|
38
|
+
* Contains the sanitized prompt and metadata.
|
|
39
|
+
*/
|
|
40
|
+
type ExtractedPrompt = {
|
|
41
|
+
readonly content: string;
|
|
42
|
+
readonly timestamp: string;
|
|
43
|
+
readonly sessionId: string;
|
|
44
|
+
readonly project: string;
|
|
45
|
+
readonly date: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Result of reading logs from the filesystem.
|
|
49
|
+
*/
|
|
50
|
+
type LogReadResult = {
|
|
51
|
+
readonly prompts: readonly ExtractedPrompt[];
|
|
52
|
+
readonly warnings: readonly string[];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Grouping of prompts by day for analysis.
|
|
56
|
+
*/
|
|
57
|
+
type DayGroup = {
|
|
58
|
+
readonly date: string;
|
|
59
|
+
readonly prompts: readonly ExtractedPrompt[];
|
|
60
|
+
readonly projects: readonly string[];
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Before/after rewrite example for a pattern.
|
|
64
|
+
* Shows concrete improvement for a detected issue.
|
|
65
|
+
*/
|
|
66
|
+
type BeforeAfter = {
|
|
67
|
+
readonly before: string;
|
|
68
|
+
readonly after: string;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Severity levels for detected patterns.
|
|
72
|
+
*/
|
|
73
|
+
type PatternSeverity = 'low' | 'medium' | 'high';
|
|
74
|
+
/**
|
|
75
|
+
* Detected improvement pattern from analysis.
|
|
76
|
+
* Each pattern includes concrete examples and actionable suggestions.
|
|
77
|
+
*/
|
|
78
|
+
type AnalysisPattern = {
|
|
79
|
+
readonly id: string;
|
|
80
|
+
readonly name: string;
|
|
81
|
+
readonly frequency: number;
|
|
82
|
+
readonly severity: PatternSeverity;
|
|
83
|
+
readonly examples: readonly string[];
|
|
84
|
+
readonly suggestion: string;
|
|
85
|
+
readonly beforeAfter: BeforeAfter;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Statistics from the analysis.
|
|
89
|
+
*/
|
|
90
|
+
type AnalysisStats = {
|
|
91
|
+
readonly totalPrompts: number;
|
|
92
|
+
readonly promptsWithIssues: number;
|
|
93
|
+
readonly overallScore: number;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Complete analysis result from a provider.
|
|
97
|
+
* Contains patterns, statistics, and top suggestion.
|
|
98
|
+
*/
|
|
99
|
+
type AnalysisResult = {
|
|
100
|
+
readonly date: string;
|
|
101
|
+
readonly patterns: readonly AnalysisPattern[];
|
|
102
|
+
readonly stats: AnalysisStats;
|
|
103
|
+
readonly topSuggestion: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Prompt analysis without the date field.
|
|
107
|
+
* Used for raw provider responses before date context is added.
|
|
108
|
+
*/
|
|
109
|
+
type PromptAnalysis = Omit<AnalysisResult, 'date'>;
|
|
110
|
+
/**
|
|
111
|
+
* Supported AI provider types.
|
|
112
|
+
*/
|
|
113
|
+
type ProviderType = 'ollama' | 'anthropic' | 'google';
|
|
114
|
+
/**
|
|
115
|
+
* Batch strategy type identifier.
|
|
116
|
+
*/
|
|
117
|
+
type BatchStrategyType = 'micro' | 'small' | 'standard';
|
|
118
|
+
/**
|
|
119
|
+
* Batch strategy configuration for different model sizes.
|
|
120
|
+
*/
|
|
121
|
+
type BatchStrategy = {
|
|
122
|
+
readonly maxTokensPerBatch: number;
|
|
123
|
+
readonly maxPromptsPerBatch: number;
|
|
124
|
+
readonly description: string;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Available batch strategies by model size.
|
|
128
|
+
*/
|
|
129
|
+
declare const BATCH_STRATEGIES: Record<BatchStrategyType, BatchStrategy>;
|
|
130
|
+
/**
|
|
131
|
+
* Context limits for each provider.
|
|
132
|
+
* Used for intelligent batching of prompts.
|
|
133
|
+
*/
|
|
134
|
+
type ProviderLimits = {
|
|
135
|
+
readonly maxTokensPerBatch: number;
|
|
136
|
+
readonly maxPromptsPerBatch?: number;
|
|
137
|
+
readonly prioritization: 'longest-first' | 'chronological';
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Provider limits by type.
|
|
141
|
+
*/
|
|
142
|
+
declare const PROVIDER_LIMITS: Record<ProviderType, ProviderLimits>;
|
|
143
|
+
/**
|
|
144
|
+
* Configuration for a single analysis rule.
|
|
145
|
+
* Allows enabling/disabling rules and overriding their severity.
|
|
146
|
+
*/
|
|
147
|
+
type RuleConfig = {
|
|
148
|
+
readonly enabled?: boolean;
|
|
149
|
+
readonly severity?: PatternSeverity;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Configuration for all analysis rules.
|
|
153
|
+
* Maps rule IDs to their configuration.
|
|
154
|
+
*/
|
|
155
|
+
type RulesConfig = Record<string, RuleConfig>;
|
|
156
|
+
/**
|
|
157
|
+
* Project-specific context information.
|
|
158
|
+
* Loaded from .hyntxrc.json files to provide additional context during analysis.
|
|
159
|
+
*/
|
|
160
|
+
type ProjectContext = {
|
|
161
|
+
readonly role?: string;
|
|
162
|
+
readonly techStack?: readonly string[];
|
|
163
|
+
readonly domain?: string;
|
|
164
|
+
readonly guidelines?: readonly string[];
|
|
165
|
+
readonly projectType?: string;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Interface for AI analysis providers.
|
|
169
|
+
* All providers must implement this interface.
|
|
170
|
+
*/
|
|
171
|
+
type AnalysisProvider = {
|
|
172
|
+
readonly name: string;
|
|
173
|
+
isAvailable(): Promise<boolean>;
|
|
174
|
+
analyze(prompts: readonly string[], date: string, context?: ProjectContext): Promise<AnalysisResult>;
|
|
175
|
+
getBatchLimits?(): ProviderLimits;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Ollama provider configuration.
|
|
179
|
+
*/
|
|
180
|
+
type OllamaConfig = {
|
|
181
|
+
readonly model: string;
|
|
182
|
+
readonly host: string;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Anthropic provider configuration.
|
|
186
|
+
*/
|
|
187
|
+
type AnthropicConfig = {
|
|
188
|
+
readonly model: string;
|
|
189
|
+
readonly apiKey: string;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Google provider configuration.
|
|
193
|
+
*/
|
|
194
|
+
type GoogleConfig = {
|
|
195
|
+
readonly model: string;
|
|
196
|
+
readonly apiKey: string;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Complete configuration from environment variables.
|
|
200
|
+
*/
|
|
201
|
+
type EnvConfig = {
|
|
202
|
+
readonly services: readonly ProviderType[];
|
|
203
|
+
readonly reminder: string;
|
|
204
|
+
readonly ollama: OllamaConfig;
|
|
205
|
+
readonly anthropic: AnthropicConfig;
|
|
206
|
+
readonly google: GoogleConfig;
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Default values for environment configuration.
|
|
210
|
+
*/
|
|
211
|
+
declare const ENV_DEFAULTS: {
|
|
212
|
+
readonly reminder: "7d";
|
|
213
|
+
readonly ollama: {
|
|
214
|
+
readonly model: "llama3.2";
|
|
215
|
+
readonly host: "http://localhost:11434";
|
|
216
|
+
};
|
|
217
|
+
readonly anthropic: {
|
|
218
|
+
readonly model: "claude-3-5-haiku-latest";
|
|
219
|
+
};
|
|
220
|
+
readonly google: {
|
|
221
|
+
readonly model: "gemini-2.0-flash-exp";
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Result of shell config file update operation.
|
|
226
|
+
*/
|
|
227
|
+
type ShellConfigResult = {
|
|
228
|
+
readonly success: boolean;
|
|
229
|
+
readonly shellFile: string;
|
|
230
|
+
readonly message: string;
|
|
231
|
+
readonly action: 'created' | 'updated' | 'skipped' | 'failed';
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Supported shell types for auto-configuration.
|
|
235
|
+
*/
|
|
236
|
+
type ShellType = 'zsh' | 'bash' | 'fish' | 'unknown';
|
|
237
|
+
/**
|
|
238
|
+
* Exit codes for the CLI.
|
|
239
|
+
*/
|
|
240
|
+
declare const EXIT_CODES: {
|
|
241
|
+
readonly SUCCESS: 0;
|
|
242
|
+
readonly ERROR: 1;
|
|
243
|
+
readonly NO_DATA: 2;
|
|
244
|
+
readonly PROVIDER_UNAVAILABLE: 3;
|
|
245
|
+
};
|
|
246
|
+
type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];
|
|
247
|
+
/**
|
|
248
|
+
* Options parsed from CLI arguments.
|
|
249
|
+
*/
|
|
250
|
+
type CliOptions = {
|
|
251
|
+
readonly date: string;
|
|
252
|
+
readonly from?: string;
|
|
253
|
+
readonly to?: string;
|
|
254
|
+
readonly project?: string;
|
|
255
|
+
readonly output?: string;
|
|
256
|
+
readonly verbose: boolean;
|
|
257
|
+
readonly dryRun: boolean;
|
|
258
|
+
readonly checkReminder: boolean;
|
|
259
|
+
readonly help: boolean;
|
|
260
|
+
readonly version: boolean;
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Output format for reports.
|
|
264
|
+
*/
|
|
265
|
+
type OutputFormat = 'terminal' | 'markdown' | 'json';
|
|
266
|
+
/**
|
|
267
|
+
* JSON error response structure.
|
|
268
|
+
*/
|
|
269
|
+
type JsonErrorResponse = {
|
|
270
|
+
readonly error: string;
|
|
271
|
+
readonly code: string;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Metadata about the analysis execution.
|
|
275
|
+
*/
|
|
276
|
+
type HistoryMetadata = {
|
|
277
|
+
readonly provider: string;
|
|
278
|
+
readonly promptCount: number;
|
|
279
|
+
readonly projects: readonly string[];
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Complete history entry stored in history files.
|
|
283
|
+
*/
|
|
284
|
+
type HistoryEntry = {
|
|
285
|
+
readonly result: AnalysisResult;
|
|
286
|
+
readonly metadata: HistoryMetadata;
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Options for listing history entries.
|
|
290
|
+
*/
|
|
291
|
+
type ListHistoryOptions = {
|
|
292
|
+
readonly provider?: string;
|
|
293
|
+
readonly project?: string;
|
|
294
|
+
readonly minScore?: number;
|
|
295
|
+
readonly maxScore?: number;
|
|
296
|
+
};
|
|
297
|
+
/**
|
|
298
|
+
* Change detected in a pattern between two analyses.
|
|
299
|
+
*/
|
|
300
|
+
type PatternChange = {
|
|
301
|
+
readonly id: string;
|
|
302
|
+
readonly name: string;
|
|
303
|
+
readonly status: 'new' | 'resolved' | 'changed';
|
|
304
|
+
readonly frequencyBefore?: number;
|
|
305
|
+
readonly frequencyAfter?: number;
|
|
306
|
+
readonly severityBefore?: PatternSeverity;
|
|
307
|
+
readonly severityAfter?: PatternSeverity;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* All detected changes between two analyses.
|
|
311
|
+
*/
|
|
312
|
+
type ComparisonChanges = {
|
|
313
|
+
readonly scoreDelta: number;
|
|
314
|
+
readonly newPatterns: readonly AnalysisPattern[];
|
|
315
|
+
readonly resolvedPatterns: readonly AnalysisPattern[];
|
|
316
|
+
readonly changedPatterns: readonly PatternChange[];
|
|
317
|
+
};
|
|
318
|
+
/**
|
|
319
|
+
* Result of comparing two analysis results.
|
|
320
|
+
*/
|
|
321
|
+
type ComparisonResult = {
|
|
322
|
+
readonly before: AnalysisResult;
|
|
323
|
+
readonly after: AnalysisResult;
|
|
324
|
+
readonly changes: ComparisonChanges;
|
|
325
|
+
};
|
|
326
|
+
/**
|
|
327
|
+
* Event emitted when a new prompt is detected in the logs.
|
|
328
|
+
* Contains the extracted prompt and the file path where it was found.
|
|
329
|
+
*/
|
|
330
|
+
type PromptEvent = {
|
|
331
|
+
readonly prompt: ExtractedPrompt;
|
|
332
|
+
readonly filePath: string;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Options for configuring the log watcher.
|
|
336
|
+
*/
|
|
337
|
+
type WatcherOptions = {
|
|
338
|
+
readonly debounceMs?: number;
|
|
339
|
+
readonly projectFilter?: string;
|
|
340
|
+
readonly signal?: AbortSignal;
|
|
341
|
+
readonly baseDir?: string;
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Tracks the current position in a file for incremental reading.
|
|
345
|
+
* Used to only read new content when files are modified.
|
|
346
|
+
*/
|
|
347
|
+
type FilePosition = {
|
|
348
|
+
readonly path: string;
|
|
349
|
+
readonly size: number;
|
|
350
|
+
readonly lastModified: number;
|
|
351
|
+
};
|
|
352
|
+
/**
|
|
353
|
+
* Interface for the log watcher.
|
|
354
|
+
* Watches Claude Code JSONL files for new prompts in real-time.
|
|
355
|
+
*/
|
|
356
|
+
type LogWatcher = {
|
|
357
|
+
start(): Promise<void>;
|
|
358
|
+
stop(): Promise<void>;
|
|
359
|
+
on(event: 'prompt', callback: (event: PromptEvent) => void): void;
|
|
360
|
+
on(event: 'error', callback: (error: Error) => void): void;
|
|
361
|
+
on(event: 'ready', callback: () => void): void;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Metadata stored with cached analysis results.
|
|
365
|
+
* Used for cache validation and invalidation.
|
|
366
|
+
*/
|
|
367
|
+
type CacheMetadata = {
|
|
368
|
+
readonly cachedAt: number;
|
|
369
|
+
readonly promptCount: number;
|
|
370
|
+
readonly model: string;
|
|
371
|
+
readonly systemPromptHash: string;
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Complete cached batch result including metadata.
|
|
375
|
+
* Stored as JSON files in the cache directory.
|
|
376
|
+
*/
|
|
377
|
+
type CachedBatchResult = {
|
|
378
|
+
readonly result: AnalysisResult;
|
|
379
|
+
readonly metadata: CacheMetadata;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Options for cache operations.
|
|
383
|
+
*/
|
|
384
|
+
type CacheOptions = {
|
|
385
|
+
readonly ttlMs: number;
|
|
386
|
+
};
|
|
387
|
+
/**
|
|
388
|
+
* Default values for cache configuration.
|
|
389
|
+
*/
|
|
390
|
+
declare const CACHE_DEFAULTS: {
|
|
391
|
+
readonly ttlMs: number;
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
export { type AnalysisResult as A, type BeforeAfter as B, type ComparisonResult as C, type DayGroup as D, type ExtractedPrompt as E, type FilePosition as F, type GoogleConfig as G, type HistoryMetadata as H, type ShellConfigResult as I, type JsonErrorResponse as J, EXIT_CODES as K, type LogReadResult as L, ENV_DEFAULTS as M, PROVIDER_LIMITS as N, type OllamaConfig as O, type PatternSeverity as P, BATCH_STRATEGIES as Q, type RulesConfig as R, type SchemaVersion as S, CACHE_DEFAULTS as T, type WatcherOptions as W, type AnalysisProvider as a, type ProjectContext as b, type HistoryEntry as c, type ListHistoryOptions as d, type ProviderType as e, type EnvConfig as f, type CacheOptions as g, type AnalysisPattern as h, type AnalysisStats as i, type PromptAnalysis as j, type ProviderLimits as k, type BatchStrategy as l, type BatchStrategyType as m, type ClaudeMessage as n, type LogEntry as o, type AnthropicConfig as p, type ComparisonChanges as q, type PatternChange as r, type CacheMetadata as s, type CachedBatchResult as t, type LogWatcher as u, type PromptEvent as v, type CliOptions as w, type ExitCode as x, type OutputFormat as y, type ShellType as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,251 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
type ExtractedPrompt = {
|
|
6
|
-
readonly content: string;
|
|
7
|
-
readonly timestamp: string;
|
|
8
|
-
readonly sessionId: string;
|
|
9
|
-
readonly project: string;
|
|
10
|
-
readonly date: string;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Result of reading logs from the filesystem.
|
|
14
|
-
*/
|
|
15
|
-
type LogReadResult = {
|
|
16
|
-
readonly prompts: readonly ExtractedPrompt[];
|
|
17
|
-
readonly warnings: readonly string[];
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Before/after rewrite example for a pattern.
|
|
21
|
-
* Shows concrete improvement for a detected issue.
|
|
22
|
-
*/
|
|
23
|
-
type BeforeAfter = {
|
|
24
|
-
readonly before: string;
|
|
25
|
-
readonly after: string;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Severity levels for detected patterns.
|
|
29
|
-
*/
|
|
30
|
-
type PatternSeverity = 'low' | 'medium' | 'high';
|
|
31
|
-
/**
|
|
32
|
-
* Detected improvement pattern from analysis.
|
|
33
|
-
* Each pattern includes concrete examples and actionable suggestions.
|
|
34
|
-
*/
|
|
35
|
-
type AnalysisPattern = {
|
|
36
|
-
readonly id: string;
|
|
37
|
-
readonly name: string;
|
|
38
|
-
readonly frequency: number;
|
|
39
|
-
readonly severity: PatternSeverity;
|
|
40
|
-
readonly examples: readonly string[];
|
|
41
|
-
readonly suggestion: string;
|
|
42
|
-
readonly beforeAfter: BeforeAfter;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Statistics from the analysis.
|
|
46
|
-
*/
|
|
47
|
-
type AnalysisStats = {
|
|
48
|
-
readonly totalPrompts: number;
|
|
49
|
-
readonly promptsWithIssues: number;
|
|
50
|
-
readonly overallScore: number;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Complete analysis result from a provider.
|
|
54
|
-
* Contains patterns, statistics, and top suggestion.
|
|
55
|
-
*/
|
|
56
|
-
type AnalysisResult = {
|
|
57
|
-
readonly date: string;
|
|
58
|
-
readonly patterns: readonly AnalysisPattern[];
|
|
59
|
-
readonly stats: AnalysisStats;
|
|
60
|
-
readonly topSuggestion: string;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Project-specific context information.
|
|
64
|
-
* Loaded from .hyntxrc.json files to provide additional context during analysis.
|
|
65
|
-
*/
|
|
66
|
-
type ProjectContext = {
|
|
67
|
-
readonly role?: string;
|
|
68
|
-
readonly techStack?: readonly string[];
|
|
69
|
-
readonly domain?: string;
|
|
70
|
-
readonly guidelines?: readonly string[];
|
|
71
|
-
readonly projectType?: string;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* Interface for AI analysis providers.
|
|
75
|
-
* All providers must implement this interface.
|
|
76
|
-
*/
|
|
77
|
-
type AnalysisProvider = {
|
|
78
|
-
readonly name: string;
|
|
79
|
-
isAvailable(): Promise<boolean>;
|
|
80
|
-
analyze(prompts: readonly string[], date: string, context?: ProjectContext): Promise<AnalysisResult>;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Hyntx - CLI Entry Point
|
|
85
|
-
*
|
|
86
|
-
* Main entry point for the Hyntx CLI that analyzes Claude Code prompts
|
|
87
|
-
* and generates improvement suggestions.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Parsed command-line arguments.
|
|
92
|
-
*/
|
|
93
|
-
type ParsedArgs = {
|
|
94
|
-
readonly date: string;
|
|
95
|
-
readonly from?: string;
|
|
96
|
-
readonly to?: string;
|
|
97
|
-
readonly project?: string;
|
|
98
|
-
readonly output?: string;
|
|
99
|
-
readonly dryRun: boolean;
|
|
100
|
-
readonly checkReminder: boolean;
|
|
101
|
-
readonly help: boolean;
|
|
102
|
-
readonly version: boolean;
|
|
103
|
-
readonly verbose: boolean;
|
|
104
|
-
readonly checkConfig: boolean;
|
|
105
|
-
readonly format: 'terminal' | 'json';
|
|
106
|
-
readonly compact: boolean;
|
|
107
|
-
readonly compareWith?: string;
|
|
108
|
-
readonly compareWeek: boolean;
|
|
109
|
-
readonly compareMonth: boolean;
|
|
110
|
-
readonly history: boolean;
|
|
111
|
-
readonly historySummary: boolean;
|
|
112
|
-
readonly noHistory: boolean;
|
|
113
|
-
readonly watch: boolean;
|
|
114
|
-
readonly quiet: boolean;
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Parses command-line arguments.
|
|
118
|
-
*
|
|
119
|
-
* @returns Parsed arguments
|
|
120
|
-
* @throws Error if arguments are invalid
|
|
121
|
-
*/
|
|
122
|
-
declare function parseArguments(): ParsedArgs;
|
|
123
|
-
/**
|
|
124
|
-
* Validates parsed arguments for logical conflicts and requirements.
|
|
125
|
-
*
|
|
126
|
-
* @param args - Parsed arguments to validate
|
|
127
|
-
* @throws Error if arguments are invalid or conflicting
|
|
128
|
-
*/
|
|
129
|
-
declare function validateArguments(args: ParsedArgs): void;
|
|
130
|
-
/**
|
|
131
|
-
* Gets the output file path for a given date.
|
|
132
|
-
* For multi-day scenarios, appends the date to the filename.
|
|
133
|
-
*
|
|
134
|
-
* @param basePath - Base output path from args
|
|
135
|
-
* @param date - Date string (YYYY-MM-DD) or undefined for single-day
|
|
136
|
-
* @returns Adjusted output file path
|
|
137
|
-
*/
|
|
138
|
-
declare function getOutputFilePath(basePath: string, date?: string): string;
|
|
139
|
-
/**
|
|
140
|
-
* Writes a single analysis result to a file.
|
|
141
|
-
*
|
|
142
|
-
* @param filePath - File path to write to
|
|
143
|
-
* @param result - Analysis result
|
|
144
|
-
* @param format - Output format ('md' or 'json')
|
|
145
|
-
* @param compact - Whether to use compact JSON (only for json format)
|
|
146
|
-
* @throws Error if write fails
|
|
147
|
-
*/
|
|
148
|
-
declare function writeOutputFile(filePath: string, result: AnalysisResult, format: 'md' | 'json', compact: boolean): Promise<void>;
|
|
149
|
-
/**
|
|
150
|
-
* Writes multi-day results to a JSON array file.
|
|
151
|
-
*
|
|
152
|
-
* @param filePath - File path to write to
|
|
153
|
-
* @param results - Array of analysis results
|
|
154
|
-
* @param compact - Whether to use compact JSON
|
|
155
|
-
* @throws Error if write fails
|
|
156
|
-
*/
|
|
157
|
-
declare function writeMultiDayJsonOutput(filePath: string, results: readonly AnalysisResult[], compact: boolean): Promise<void>;
|
|
158
|
-
/**
|
|
159
|
-
* Displays a dry-run summary without performing analysis.
|
|
160
|
-
*
|
|
161
|
-
* @param prompts - Array of extracted prompts
|
|
162
|
-
* @param args - Parsed arguments
|
|
163
|
-
*/
|
|
164
|
-
declare function displayDryRunSummary(prompts: readonly ExtractedPrompt[], args: ParsedArgs): void;
|
|
165
|
-
/**
|
|
166
|
-
* Displays reminder status and exits.
|
|
167
|
-
*/
|
|
168
|
-
declare function showReminderStatus(): void;
|
|
169
|
-
/**
|
|
170
|
-
* Displays help message and exits.
|
|
171
|
-
*/
|
|
172
|
-
declare function showHelp(): void;
|
|
173
|
-
/**
|
|
174
|
-
* Displays version information and exits.
|
|
175
|
-
*/
|
|
176
|
-
declare function showVersion(): void;
|
|
177
|
-
/**
|
|
178
|
-
* Runs configuration health check and exits.
|
|
179
|
-
*
|
|
180
|
-
* Validates all configured providers and tests their connectivity.
|
|
181
|
-
* Exits with 0 if all providers are valid, 1 if any issues found.
|
|
182
|
-
*/
|
|
183
|
-
declare function runConfigCheck(): Promise<void>;
|
|
184
|
-
/**
|
|
185
|
-
* Checks if this is the first run and runs setup if needed.
|
|
186
|
-
*
|
|
187
|
-
* @param isJsonMode - Whether JSON output mode is active
|
|
188
|
-
*/
|
|
189
|
-
declare function checkAndRunSetup(isJsonMode: boolean): Promise<void>;
|
|
190
|
-
/**
|
|
191
|
-
* Reads logs with filters from parsed arguments.
|
|
192
|
-
*
|
|
193
|
-
* @param args - Parsed command-line arguments
|
|
194
|
-
* @param isJsonMode - Whether JSON output mode is active
|
|
195
|
-
* @returns Log read result with prompts and warnings
|
|
196
|
-
*/
|
|
197
|
-
declare function readLogsWithSpinner(args: ParsedArgs, isJsonMode: boolean): Promise<LogReadResult>;
|
|
198
|
-
/**
|
|
199
|
-
* Connects to an available provider with automatic fallback.
|
|
200
|
-
*
|
|
201
|
-
* Uses the multi-provider factory to get the first available provider
|
|
202
|
-
* from the configured services list, with fallback support.
|
|
203
|
-
*
|
|
204
|
-
* @param isJsonMode - Whether JSON output mode is active
|
|
205
|
-
* @returns Available provider instance
|
|
206
|
-
*/
|
|
207
|
-
declare function connectProviderWithSpinner(isJsonMode: boolean): Promise<AnalysisProvider>;
|
|
208
|
-
/**
|
|
209
|
-
* Analyzes prompts with progress tracking.
|
|
210
|
-
*
|
|
211
|
-
* @param provider - Analysis provider
|
|
212
|
-
* @param prompts - Array of prompt strings
|
|
213
|
-
* @param date - Date context
|
|
214
|
-
* @param context - Optional project context
|
|
215
|
-
* @param isJsonMode - Whether JSON output mode is active
|
|
216
|
-
* @returns Analysis result
|
|
217
|
-
*/
|
|
218
|
-
declare function analyzeWithProgress(provider: AnalysisProvider, prompts: readonly string[], date: string, context: ProjectContext | undefined, isJsonMode: boolean): Promise<AnalysisResult>;
|
|
219
|
-
/**
|
|
220
|
-
* Runs watch mode for real-time prompt analysis.
|
|
221
|
-
*
|
|
222
|
-
* This function runs indefinitely, monitoring log files for new prompts.
|
|
223
|
-
* It only exits when explicitly terminated (Ctrl+C) or an unhandled error occurs.
|
|
224
|
-
*
|
|
225
|
-
* @param provider - Analysis provider
|
|
226
|
-
* @param args - Parsed arguments
|
|
227
|
-
* @param context - Optional project context
|
|
228
|
-
* @returns Promise that never resolves naturally (runs until terminated)
|
|
229
|
-
*/
|
|
230
|
-
declare function runWatchMode(provider: AnalysisProvider, args: ParsedArgs, context: ProjectContext | undefined): Promise<never>;
|
|
231
|
-
/**
|
|
232
|
-
* Displays analysis results.
|
|
233
|
-
*
|
|
234
|
-
* @param result - Analysis result
|
|
235
|
-
* @param format - Output format
|
|
236
|
-
* @param compact - Whether to use compact JSON (only relevant for JSON format)
|
|
237
|
-
*/
|
|
238
|
-
declare function displayResults(result: AnalysisResult, format: 'terminal' | 'json', compact: boolean): void;
|
|
239
|
-
/**
|
|
240
|
-
* Handles errors and exits with appropriate code.
|
|
241
|
-
*
|
|
242
|
-
* @param error - Error to handle
|
|
243
|
-
* @param isJsonMode - Whether JSON output mode is active
|
|
244
|
-
*/
|
|
245
|
-
declare function handleError(error: Error, isJsonMode: boolean): void;
|
|
246
|
-
/**
|
|
247
|
-
* Main entry point for the CLI.
|
|
248
|
-
*/
|
|
249
|
-
declare function main(): Promise<void>;
|
|
250
|
-
|
|
251
|
-
export { type ParsedArgs, analyzeWithProgress, checkAndRunSetup, connectProviderWithSpinner, displayDryRunSummary, displayResults, getOutputFilePath, handleError, main, parseArguments, readLogsWithSpinner, runConfigCheck, runWatchMode, showHelp, showReminderStatus, showVersion, validateArguments, writeMultiDayJsonOutput, writeOutputFile };
|
|
1
|
+
export { CACHE_ANALYSIS_DIR, CACHE_META_FILE, CLAUDE_PROJECTS_DIR, FallbackCallback, HYNTX_CACHE_DIR, HYNTX_HISTORY_DIR, IssueMetadata, IssueTaxonomy, LAST_RUN_FILE, MinimalResult, ReadLogsOptions, SanitizePromptsResult, SanitizeResult, SchemaType, analyzePrompts, claudeProjectsExist, cleanupExpiredEntries, clearCache, compareResults, createProvider, ensureHistoryDir, extractProjectName, generateCacheKey, getAllProviders, getAvailableProvider, getCachedResult, getDateOneMonthAgo, getDateOneWeekAgo, getEnvConfig, getHistoryDir, groupByDay, hashSystemPrompt, isFirstRun, listAvailableDates, loadAnalysisResult, loadProjectConfig, loadProjectConfigForCwd, mergeConfigs, parseDate, parseServices, readLogs, sanitize, sanitizePrompts, saveAnalysisResult, setCachedResult, validateSystemPrompt } from './api/index.js';
|
|
2
|
+
export { h as AnalysisPattern, a as AnalysisProvider, A as AnalysisResult, i as AnalysisStats, p as AnthropicConfig, Q as BATCH_STRATEGIES, l as BatchStrategy, m as BatchStrategyType, B as BeforeAfter, T as CACHE_DEFAULTS, s as CacheMetadata, g as CacheOptions, t as CachedBatchResult, n as ClaudeMessage, w as CliOptions, q as ComparisonChanges, C as ComparisonResult, D as DayGroup, M as ENV_DEFAULTS, K as EXIT_CODES, f as EnvConfig, x as ExitCode, E as ExtractedPrompt, F as FilePosition, G as GoogleConfig, c as HistoryEntry, H as HistoryMetadata, J as JsonErrorResponse, d as ListHistoryOptions, o as LogEntry, L as LogReadResult, u as LogWatcher, O as OllamaConfig, y as OutputFormat, N as PROVIDER_LIMITS, r as PatternChange, P as PatternSeverity, b as ProjectContext, j as PromptAnalysis, v as PromptEvent, k as ProviderLimits, e as ProviderType, S as SchemaVersion, I as ShellConfigResult, z as ShellType, W as WatcherOptions } from './index-B6r9mP1J.js';
|
|
3
|
+
import 'zod';
|