hyntx 2.4.0 → 2.6.0
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 +75 -3
- package/dist/api/index.d.ts +460 -64
- package/dist/api/index.js +1 -3078
- package/dist/chunk-TGFHVZHY.js +3329 -0
- package/dist/chunk-TLJ2AIHG.js +389 -0
- package/dist/cli.d.ts +219 -4
- package/dist/cli.js +5266 -4162
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3078
- package/dist/shell-config-VEIMSP5W.js +2 -0
- package/package.json +41 -25
- package/dist/index-B6r9mP1J.d.ts +0 -394
package/README.md
CHANGED
|
@@ -104,6 +104,11 @@ hyntx --watch
|
|
|
104
104
|
|
|
105
105
|
# Watch specific project only
|
|
106
106
|
hyntx --watch --project my-app
|
|
107
|
+
|
|
108
|
+
# Analysis modes - control speed vs accuracy trade-off
|
|
109
|
+
hyntx --analysis-mode batch # Fast (default): ~300-400ms/prompt
|
|
110
|
+
hyntx --analysis-mode individual # Accurate: ~1000-1500ms/prompt
|
|
111
|
+
hyntx -m individual # Short form
|
|
107
112
|
```
|
|
108
113
|
|
|
109
114
|
### Combining Options
|
|
@@ -118,6 +123,45 @@ hyntx --date yesterday --output yesterday-analysis.md
|
|
|
118
123
|
|
|
119
124
|
## Configuration
|
|
120
125
|
|
|
126
|
+
### Analysis Modes
|
|
127
|
+
|
|
128
|
+
Hyntx offers two analysis modes to balance speed and accuracy based on your needs:
|
|
129
|
+
|
|
130
|
+
#### Batch Mode (Default)
|
|
131
|
+
|
|
132
|
+
- **Speed**: ~300-400ms per prompt
|
|
133
|
+
- **Best for**: Daily analysis, quick feedback, large prompt batches
|
|
134
|
+
- **Accuracy**: Good categorization for most use cases
|
|
135
|
+
- **When to use**: Regular check-ins, monitoring prompt quality over time
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
hyntx # Uses batch mode by default
|
|
139
|
+
hyntx --analysis-mode batch # Explicit batch mode
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Individual Mode
|
|
143
|
+
|
|
144
|
+
- **Speed**: ~1000-1500ms per prompt
|
|
145
|
+
- **Best for**: Deep analysis, quality-focused reviews, important prompts
|
|
146
|
+
- **Accuracy**: Better categorization and more nuanced pattern detection
|
|
147
|
+
- **When to use**: Learning sessions, preparing critical prompts, detailed audits
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
hyntx --analysis-mode individual # Use individual mode
|
|
151
|
+
hyntx -m individual # Short form
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
#### Mode Comparison
|
|
155
|
+
|
|
156
|
+
| Mode | Speed/Prompt | Use Case | Accuracy |
|
|
157
|
+
| ---------- | ------------ | -------------- | -------- |
|
|
158
|
+
| Batch | ~300-400ms | Daily analysis | Good |
|
|
159
|
+
| Individual | ~1-1.5s | Deep analysis | Better |
|
|
160
|
+
|
|
161
|
+
**Recommendation**: Use batch mode for daily analysis (faster feedback), switch to individual mode when you need maximum quality or are learning prompt engineering techniques.
|
|
162
|
+
|
|
163
|
+
**Note**: Performance numbers are based on `llama3.2` running on CPU. Actual speed depends on your hardware and model choice.
|
|
164
|
+
|
|
121
165
|
### Rules Configuration
|
|
122
166
|
|
|
123
167
|
Hyntx allows you to customize which analysis rules are enabled and their severity levels through a `.hyntxrc.json` file in your project root.
|
|
@@ -602,8 +646,36 @@ Hyntx takes your privacy seriously:
|
|
|
602
646
|
## Requirements
|
|
603
647
|
|
|
604
648
|
- **Node.js**: 22.0.0 or higher
|
|
605
|
-
- **Claude Code**: Must have Claude Code installed and
|
|
606
|
-
- **AI Provider**:
|
|
649
|
+
- **Claude Code**: Must have Claude Code installed and at least one conversation
|
|
650
|
+
- **AI Provider**: At least one of the following:
|
|
651
|
+
- **Ollama** (recommended for privacy and cost savings)
|
|
652
|
+
- **Anthropic Claude** API key
|
|
653
|
+
- **Google Gemini** API key
|
|
654
|
+
|
|
655
|
+
### Ollama Model Requirements
|
|
656
|
+
|
|
657
|
+
For local analysis with Ollama, you need to have a compatible model installed. See [docs/MINIMUM_VIABLE_MODEL.md](docs/MINIMUM_VIABLE_MODEL.md) for detailed recommendations and performance benchmarks.
|
|
658
|
+
|
|
659
|
+
**Quick picks**:
|
|
660
|
+
|
|
661
|
+
| Use Case | Model | Parameters | Disk Size | Speed (CPU) | Quality |
|
|
662
|
+
| ------------------- | ------------- | ---------- | --------- | -------------- | --------- |
|
|
663
|
+
| **Daily use** | `llama3.2` | 2-3B | ~2GB | ~2-5s/prompt | Good |
|
|
664
|
+
| **Production** | `mistral:7b` | 7B | ~4GB | ~5-10s/prompt | Better |
|
|
665
|
+
| **Maximum quality** | `qwen2.5:14b` | 14B | ~9GB | ~15-30s/prompt | Excellent |
|
|
666
|
+
|
|
667
|
+
**Installation**:
|
|
668
|
+
|
|
669
|
+
```bash
|
|
670
|
+
# Install recommended model (llama3.2)
|
|
671
|
+
ollama pull llama3.2
|
|
672
|
+
|
|
673
|
+
# Or choose a different model
|
|
674
|
+
ollama pull mistral:7b
|
|
675
|
+
ollama pull qwen2.5:14b
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
For complete model comparison, compatibility info, and performance notes, see the [Model Requirements documentation](docs/MINIMUM_VIABLE_MODEL.md).
|
|
607
679
|
|
|
608
680
|
## Troubleshooting
|
|
609
681
|
|
|
@@ -900,7 +972,7 @@ Contributions are welcome! Please:
|
|
|
900
972
|
|
|
901
973
|
## Roadmap
|
|
902
974
|
|
|
903
|
-
For detailed development roadmap, planned features, and implementation status, see [
|
|
975
|
+
For detailed development roadmap, planned features, and implementation status, see [GitHub Issues](https://github.com/jmlweb/hyntx/issues) and [GitHub Projects](https://github.com/jmlweb/hyntx/projects).
|
|
904
976
|
|
|
905
977
|
## License
|
|
906
978
|
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { P as PatternSeverity, a as AnalysisProvider, b as ProjectContext, R as RulesConfig, A as AnalysisResult, L as LogReadResult, E as ExtractedPrompt, D as DayGroup, H as HistoryMetadata, c as HistoryEntry, d as ListHistoryOptions, C as ComparisonResult, e as ProviderType, f as EnvConfig, g as CacheOptions } from '../index-B6r9mP1J.js';
|
|
2
|
-
export { h as AnalysisPattern, 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, t as CachedBatchResult, n as ClaudeMessage, w as CliOptions, q as ComparisonChanges, M as ENV_DEFAULTS, K as EXIT_CODES, x as ExitCode, F as FilePosition, G as GoogleConfig, J as JsonErrorResponse, o as LogEntry, u as LogWatcher, O as OllamaConfig, y as OutputFormat, N as PROVIDER_LIMITS, r as PatternChange, j as PromptAnalysis, v as PromptEvent, k as ProviderLimits, S as SchemaVersion, I as ShellConfigResult, z as ShellType, W as WatcherOptions } from '../index-B6r9mP1J.js';
|
|
3
1
|
import { z } from 'zod';
|
|
4
2
|
|
|
5
3
|
/**
|
|
@@ -32,8 +30,9 @@ type IssueTaxonomy = Record<string, IssueMetadata>;
|
|
|
32
30
|
* - minimal: Lightweight schema for small models (issue IDs + score)
|
|
33
31
|
* - simple: Medium schema with issue objects
|
|
34
32
|
* - full: Complete schema with patterns and stats
|
|
33
|
+
* - individual: Hybrid approach - batch processing with individual result schema
|
|
35
34
|
*/
|
|
36
|
-
type SchemaType = 'minimal' | 'simple' | 'full';
|
|
35
|
+
type SchemaType = 'minimal' | 'simple' | 'full' | 'individual';
|
|
37
36
|
|
|
38
37
|
/**
|
|
39
38
|
* Aggregator for converting minimal analysis results to full AnalysisResult.
|
|
@@ -53,6 +52,400 @@ type MinimalResult = {
|
|
|
53
52
|
readonly score: number;
|
|
54
53
|
};
|
|
55
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Hyntx - TypeScript Type Definitions
|
|
57
|
+
*
|
|
58
|
+
* This module contains all shared type definitions for the Hyntx system.
|
|
59
|
+
* All types are designed to be composable and type-safe.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Schema version for Claude Code JSONL logs.
|
|
64
|
+
* Used for graceful degradation when log format changes.
|
|
65
|
+
*/
|
|
66
|
+
type SchemaVersion = {
|
|
67
|
+
readonly major: number;
|
|
68
|
+
readonly minor: number;
|
|
69
|
+
readonly detected: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Message structure in Claude Code JSONL logs.
|
|
73
|
+
* Represents a single entry in the conversation log.
|
|
74
|
+
*/
|
|
75
|
+
type ClaudeMessage = {
|
|
76
|
+
readonly type: 'user' | 'assistant' | 'system';
|
|
77
|
+
readonly message: {
|
|
78
|
+
readonly role: 'user' | 'assistant' | 'system';
|
|
79
|
+
readonly content: string;
|
|
80
|
+
};
|
|
81
|
+
readonly timestamp: string;
|
|
82
|
+
readonly sessionId: string;
|
|
83
|
+
readonly cwd: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Log entry type alias for JSONL files.
|
|
87
|
+
* Used in test utilities and log parsing.
|
|
88
|
+
*/
|
|
89
|
+
type LogEntry = ClaudeMessage;
|
|
90
|
+
/**
|
|
91
|
+
* Data extracted from Claude Code messages.
|
|
92
|
+
* Contains the sanitized prompt and metadata.
|
|
93
|
+
*/
|
|
94
|
+
type ExtractedPrompt = {
|
|
95
|
+
readonly content: string;
|
|
96
|
+
readonly timestamp: string;
|
|
97
|
+
readonly sessionId: string;
|
|
98
|
+
readonly project: string;
|
|
99
|
+
readonly date: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Result of reading logs from the filesystem.
|
|
103
|
+
*/
|
|
104
|
+
type LogReadResult = {
|
|
105
|
+
readonly prompts: readonly ExtractedPrompt[];
|
|
106
|
+
readonly warnings: readonly string[];
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Grouping of prompts by day for analysis.
|
|
110
|
+
*/
|
|
111
|
+
type DayGroup = {
|
|
112
|
+
readonly date: string;
|
|
113
|
+
readonly prompts: readonly ExtractedPrompt[];
|
|
114
|
+
readonly projects: readonly string[];
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Before/after rewrite example for a pattern.
|
|
118
|
+
* Shows concrete improvement for a detected issue.
|
|
119
|
+
*/
|
|
120
|
+
type BeforeAfter = {
|
|
121
|
+
readonly before: string;
|
|
122
|
+
readonly after: string;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Severity levels for detected patterns.
|
|
126
|
+
*/
|
|
127
|
+
type PatternSeverity = 'low' | 'medium' | 'high';
|
|
128
|
+
/**
|
|
129
|
+
* Detected improvement pattern from analysis.
|
|
130
|
+
* Each pattern includes concrete examples and actionable suggestions.
|
|
131
|
+
*/
|
|
132
|
+
type AnalysisPattern = {
|
|
133
|
+
readonly id: string;
|
|
134
|
+
readonly name: string;
|
|
135
|
+
readonly frequency: number;
|
|
136
|
+
readonly severity: PatternSeverity;
|
|
137
|
+
readonly examples: readonly string[];
|
|
138
|
+
readonly suggestion: string;
|
|
139
|
+
readonly beforeAfter: BeforeAfter;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Statistics from the analysis.
|
|
143
|
+
*/
|
|
144
|
+
type AnalysisStats = {
|
|
145
|
+
readonly totalPrompts: number;
|
|
146
|
+
readonly promptsWithIssues: number;
|
|
147
|
+
readonly overallScore: number;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Complete analysis result from a provider.
|
|
151
|
+
* Contains patterns, statistics, and top suggestion.
|
|
152
|
+
*/
|
|
153
|
+
type AnalysisResult = {
|
|
154
|
+
readonly date: string;
|
|
155
|
+
readonly patterns: readonly AnalysisPattern[];
|
|
156
|
+
readonly stats: AnalysisStats;
|
|
157
|
+
readonly topSuggestion: string;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Prompt analysis without the date field.
|
|
161
|
+
* Used for raw provider responses before date context is added.
|
|
162
|
+
*/
|
|
163
|
+
type PromptAnalysis = Omit<AnalysisResult, 'date'>;
|
|
164
|
+
/**
|
|
165
|
+
* Supported AI provider types.
|
|
166
|
+
*/
|
|
167
|
+
type ProviderType = 'ollama' | 'anthropic' | 'google';
|
|
168
|
+
/**
|
|
169
|
+
* Batch strategy type identifier.
|
|
170
|
+
*/
|
|
171
|
+
type BatchStrategyType = 'micro' | 'small' | 'standard';
|
|
172
|
+
/**
|
|
173
|
+
* Batch strategy configuration for different model sizes.
|
|
174
|
+
*/
|
|
175
|
+
type BatchStrategy = {
|
|
176
|
+
readonly maxTokensPerBatch: number;
|
|
177
|
+
readonly maxPromptsPerBatch: number;
|
|
178
|
+
readonly description: string;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Available batch strategies by model size.
|
|
182
|
+
*/
|
|
183
|
+
declare const BATCH_STRATEGIES: Record<BatchStrategyType, BatchStrategy>;
|
|
184
|
+
/**
|
|
185
|
+
* Context limits for each provider.
|
|
186
|
+
* Used for intelligent batching of prompts.
|
|
187
|
+
*/
|
|
188
|
+
type ProviderLimits = {
|
|
189
|
+
readonly maxTokensPerBatch: number;
|
|
190
|
+
readonly maxPromptsPerBatch?: number;
|
|
191
|
+
readonly prioritization: 'longest-first' | 'chronological';
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Provider limits by type.
|
|
195
|
+
*/
|
|
196
|
+
declare const PROVIDER_LIMITS: Record<ProviderType, ProviderLimits>;
|
|
197
|
+
/**
|
|
198
|
+
* Configuration for a single analysis rule.
|
|
199
|
+
* Allows enabling/disabling rules and overriding their severity.
|
|
200
|
+
*/
|
|
201
|
+
type RuleConfig = {
|
|
202
|
+
readonly enabled?: boolean;
|
|
203
|
+
readonly severity?: PatternSeverity;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Configuration for all analysis rules.
|
|
207
|
+
* Maps rule IDs to their configuration.
|
|
208
|
+
*/
|
|
209
|
+
type RulesConfig = Record<string, RuleConfig>;
|
|
210
|
+
/**
|
|
211
|
+
* Project-specific context information.
|
|
212
|
+
* Loaded from .hyntxrc.json files to provide additional context during analysis.
|
|
213
|
+
*/
|
|
214
|
+
type ProjectContext = {
|
|
215
|
+
readonly role?: string;
|
|
216
|
+
readonly techStack?: readonly string[];
|
|
217
|
+
readonly domain?: string;
|
|
218
|
+
readonly guidelines?: readonly string[];
|
|
219
|
+
readonly projectType?: string;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Interface for AI analysis providers.
|
|
223
|
+
* All providers must implement this interface.
|
|
224
|
+
*/
|
|
225
|
+
type AnalysisProvider = {
|
|
226
|
+
readonly name: string;
|
|
227
|
+
isAvailable(): Promise<boolean>;
|
|
228
|
+
analyze(prompts: readonly string[], date: string, context?: ProjectContext): Promise<AnalysisResult>;
|
|
229
|
+
getBatchLimits?(): ProviderLimits;
|
|
230
|
+
};
|
|
231
|
+
/**
|
|
232
|
+
* Ollama provider configuration.
|
|
233
|
+
*/
|
|
234
|
+
type OllamaConfig = {
|
|
235
|
+
readonly model: string;
|
|
236
|
+
readonly host: string;
|
|
237
|
+
readonly schemaOverride?: 'batch' | 'individual';
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Anthropic provider configuration.
|
|
241
|
+
*/
|
|
242
|
+
type AnthropicConfig = {
|
|
243
|
+
readonly model: string;
|
|
244
|
+
readonly apiKey: string;
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* Google provider configuration.
|
|
248
|
+
*/
|
|
249
|
+
type GoogleConfig = {
|
|
250
|
+
readonly model: string;
|
|
251
|
+
readonly apiKey: string;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* Complete configuration from environment variables.
|
|
255
|
+
*/
|
|
256
|
+
type EnvConfig = {
|
|
257
|
+
readonly services: readonly ProviderType[];
|
|
258
|
+
readonly reminder: string;
|
|
259
|
+
readonly ollama: OllamaConfig;
|
|
260
|
+
readonly anthropic: AnthropicConfig;
|
|
261
|
+
readonly google: GoogleConfig;
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Default values for environment configuration.
|
|
265
|
+
*/
|
|
266
|
+
declare const ENV_DEFAULTS: {
|
|
267
|
+
readonly reminder: "7d";
|
|
268
|
+
readonly ollama: {
|
|
269
|
+
readonly model: "llama3.2";
|
|
270
|
+
readonly host: "http://localhost:11434";
|
|
271
|
+
};
|
|
272
|
+
readonly anthropic: {
|
|
273
|
+
readonly model: "claude-3-5-haiku-latest";
|
|
274
|
+
};
|
|
275
|
+
readonly google: {
|
|
276
|
+
readonly model: "gemini-2.0-flash-exp";
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Result of shell config file update operation.
|
|
281
|
+
*/
|
|
282
|
+
type ShellConfigResult = {
|
|
283
|
+
readonly success: boolean;
|
|
284
|
+
readonly shellFile: string;
|
|
285
|
+
readonly message: string;
|
|
286
|
+
readonly action: 'created' | 'updated' | 'skipped' | 'failed';
|
|
287
|
+
};
|
|
288
|
+
/**
|
|
289
|
+
* Supported shell types for auto-configuration.
|
|
290
|
+
*/
|
|
291
|
+
type ShellType = 'zsh' | 'bash' | 'fish' | 'unknown';
|
|
292
|
+
/**
|
|
293
|
+
* Exit codes for the CLI.
|
|
294
|
+
*/
|
|
295
|
+
declare const EXIT_CODES: {
|
|
296
|
+
readonly SUCCESS: 0;
|
|
297
|
+
readonly ERROR: 1;
|
|
298
|
+
readonly NO_DATA: 2;
|
|
299
|
+
readonly PROVIDER_UNAVAILABLE: 3;
|
|
300
|
+
};
|
|
301
|
+
type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES];
|
|
302
|
+
/**
|
|
303
|
+
* Options parsed from CLI arguments.
|
|
304
|
+
*/
|
|
305
|
+
type CliOptions = {
|
|
306
|
+
readonly date: string;
|
|
307
|
+
readonly from?: string;
|
|
308
|
+
readonly to?: string;
|
|
309
|
+
readonly project?: string;
|
|
310
|
+
readonly output?: string;
|
|
311
|
+
readonly verbose: boolean;
|
|
312
|
+
readonly dryRun: boolean;
|
|
313
|
+
readonly checkReminder: boolean;
|
|
314
|
+
readonly help: boolean;
|
|
315
|
+
readonly version: boolean;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Output format for reports.
|
|
319
|
+
*/
|
|
320
|
+
type OutputFormat = 'terminal' | 'markdown' | 'json';
|
|
321
|
+
/**
|
|
322
|
+
* JSON error response structure.
|
|
323
|
+
*/
|
|
324
|
+
type JsonErrorResponse = {
|
|
325
|
+
readonly error: string;
|
|
326
|
+
readonly code: string;
|
|
327
|
+
};
|
|
328
|
+
/**
|
|
329
|
+
* Metadata about the analysis execution.
|
|
330
|
+
*/
|
|
331
|
+
type HistoryMetadata = {
|
|
332
|
+
readonly provider: string;
|
|
333
|
+
readonly promptCount: number;
|
|
334
|
+
readonly projects: readonly string[];
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Complete history entry stored in history files.
|
|
338
|
+
*/
|
|
339
|
+
type HistoryEntry = {
|
|
340
|
+
readonly result: AnalysisResult;
|
|
341
|
+
readonly metadata: HistoryMetadata;
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* Options for listing history entries.
|
|
345
|
+
*/
|
|
346
|
+
type ListHistoryOptions = {
|
|
347
|
+
readonly provider?: string;
|
|
348
|
+
readonly project?: string;
|
|
349
|
+
readonly minScore?: number;
|
|
350
|
+
readonly maxScore?: number;
|
|
351
|
+
};
|
|
352
|
+
/**
|
|
353
|
+
* Change detected in a pattern between two analyses.
|
|
354
|
+
*/
|
|
355
|
+
type PatternChange = {
|
|
356
|
+
readonly id: string;
|
|
357
|
+
readonly name: string;
|
|
358
|
+
readonly status: 'new' | 'resolved' | 'changed';
|
|
359
|
+
readonly frequencyBefore?: number;
|
|
360
|
+
readonly frequencyAfter?: number;
|
|
361
|
+
readonly severityBefore?: PatternSeverity;
|
|
362
|
+
readonly severityAfter?: PatternSeverity;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* All detected changes between two analyses.
|
|
366
|
+
*/
|
|
367
|
+
type ComparisonChanges = {
|
|
368
|
+
readonly scoreDelta: number;
|
|
369
|
+
readonly newPatterns: readonly AnalysisPattern[];
|
|
370
|
+
readonly resolvedPatterns: readonly AnalysisPattern[];
|
|
371
|
+
readonly changedPatterns: readonly PatternChange[];
|
|
372
|
+
};
|
|
373
|
+
/**
|
|
374
|
+
* Result of comparing two analysis results.
|
|
375
|
+
*/
|
|
376
|
+
type ComparisonResult = {
|
|
377
|
+
readonly before: AnalysisResult;
|
|
378
|
+
readonly after: AnalysisResult;
|
|
379
|
+
readonly changes: ComparisonChanges;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Event emitted when a new prompt is detected in the logs.
|
|
383
|
+
* Contains the extracted prompt and the file path where it was found.
|
|
384
|
+
*/
|
|
385
|
+
type PromptEvent = {
|
|
386
|
+
readonly prompt: ExtractedPrompt;
|
|
387
|
+
readonly filePath: string;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Options for configuring the log watcher.
|
|
391
|
+
*/
|
|
392
|
+
type WatcherOptions = {
|
|
393
|
+
readonly debounceMs?: number;
|
|
394
|
+
readonly projectFilter?: string;
|
|
395
|
+
readonly signal?: AbortSignal;
|
|
396
|
+
readonly baseDir?: string;
|
|
397
|
+
};
|
|
398
|
+
/**
|
|
399
|
+
* Tracks the current position in a file for incremental reading.
|
|
400
|
+
* Used to only read new content when files are modified.
|
|
401
|
+
*/
|
|
402
|
+
type FilePosition = {
|
|
403
|
+
readonly path: string;
|
|
404
|
+
readonly size: number;
|
|
405
|
+
readonly lastModified: number;
|
|
406
|
+
};
|
|
407
|
+
/**
|
|
408
|
+
* Interface for the log watcher.
|
|
409
|
+
* Watches Claude Code JSONL files for new prompts in real-time.
|
|
410
|
+
*/
|
|
411
|
+
type LogWatcher = {
|
|
412
|
+
start(): Promise<void>;
|
|
413
|
+
stop(): Promise<void>;
|
|
414
|
+
on(event: 'prompt', callback: (event: PromptEvent) => void): void;
|
|
415
|
+
on(event: 'error', callback: (error: Error) => void): void;
|
|
416
|
+
on(event: 'ready', callback: () => void): void;
|
|
417
|
+
};
|
|
418
|
+
/**
|
|
419
|
+
* Metadata stored with cached analysis results.
|
|
420
|
+
* Used for cache validation and invalidation.
|
|
421
|
+
*/
|
|
422
|
+
type CacheMetadata = {
|
|
423
|
+
readonly cachedAt: number;
|
|
424
|
+
readonly promptCount: number;
|
|
425
|
+
readonly model: string;
|
|
426
|
+
readonly systemPromptHash: string;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* Complete cached batch result including metadata.
|
|
430
|
+
* Stored as JSON files in the cache directory.
|
|
431
|
+
*/
|
|
432
|
+
type CachedBatchResult = {
|
|
433
|
+
readonly result: AnalysisResult;
|
|
434
|
+
readonly metadata: CacheMetadata;
|
|
435
|
+
};
|
|
436
|
+
/**
|
|
437
|
+
* Options for cache operations.
|
|
438
|
+
*/
|
|
439
|
+
type CacheOptions = {
|
|
440
|
+
readonly ttlMs: number;
|
|
441
|
+
};
|
|
442
|
+
/**
|
|
443
|
+
* Default values for cache configuration.
|
|
444
|
+
*/
|
|
445
|
+
declare const CACHE_DEFAULTS: {
|
|
446
|
+
readonly ttlMs: number;
|
|
447
|
+
};
|
|
448
|
+
|
|
56
449
|
/**
|
|
57
450
|
* Prompt Analyzer for Hyntx
|
|
58
451
|
*
|
|
@@ -122,60 +515,6 @@ type AnalyzePromptsOptions = {
|
|
|
122
515
|
*/
|
|
123
516
|
declare function analyzePrompts(options: AnalyzePromptsOptions): Promise<AnalysisResult>;
|
|
124
517
|
|
|
125
|
-
/**
|
|
126
|
-
* Secret Sanitizer for Hyntx
|
|
127
|
-
*
|
|
128
|
-
* This module provides functionality to automatically redact secrets and sensitive
|
|
129
|
-
* information from prompts before sending them to AI providers.
|
|
130
|
-
*/
|
|
131
|
-
/**
|
|
132
|
-
* Result of sanitizing a single text.
|
|
133
|
-
*/
|
|
134
|
-
type SanitizeResult = {
|
|
135
|
-
readonly text: string;
|
|
136
|
-
readonly redacted: number;
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Result of sanitizing multiple prompts.
|
|
140
|
-
*/
|
|
141
|
-
type SanitizePromptsResult = {
|
|
142
|
-
readonly prompts: readonly string[];
|
|
143
|
-
readonly totalRedacted: number;
|
|
144
|
-
};
|
|
145
|
-
/**
|
|
146
|
-
* Sanitizes a single text by redacting all detected secrets.
|
|
147
|
-
*
|
|
148
|
-
* @param text - Text to sanitize
|
|
149
|
-
* @returns Sanitized text and count of redactions
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* ```typescript
|
|
153
|
-
* const result = sanitize('My API key is sk-1234567890abcdef...');
|
|
154
|
-
* // { text: 'My API key is [REDACTED_OPENAI_KEY]', redacted: 1 }
|
|
155
|
-
* ```
|
|
156
|
-
*/
|
|
157
|
-
declare function sanitize(text: string): SanitizeResult;
|
|
158
|
-
/**
|
|
159
|
-
* Sanitizes an array of prompts and returns sanitized prompts with total redaction count.
|
|
160
|
-
*
|
|
161
|
-
* @param prompts - Array of prompts to sanitize
|
|
162
|
-
* @returns Sanitized prompts and total number of redactions across all prompts
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* ```typescript
|
|
166
|
-
* const prompts = [
|
|
167
|
-
* 'My key is sk-123...',
|
|
168
|
-
* 'Email me at user@example.com'
|
|
169
|
-
* ];
|
|
170
|
-
* const result = sanitizePrompts(prompts);
|
|
171
|
-
* // {
|
|
172
|
-
* // prompts: ['My key is [REDACTED_OPENAI_KEY]', 'Email me at [REDACTED_EMAIL]'],
|
|
173
|
-
* // totalRedacted: 2
|
|
174
|
-
* // }
|
|
175
|
-
* ```
|
|
176
|
-
*/
|
|
177
|
-
declare function sanitizePrompts(prompts: readonly string[]): SanitizePromptsResult;
|
|
178
|
-
|
|
179
518
|
/**
|
|
180
519
|
* Basic JSONL Log Reader for Claude Code logs.
|
|
181
520
|
*
|
|
@@ -279,6 +618,60 @@ declare function groupByDay(prompts: readonly ExtractedPrompt[]): readonly DayGr
|
|
|
279
618
|
*/
|
|
280
619
|
declare function readLogs(options?: ReadLogsOptions): Promise<LogReadResult>;
|
|
281
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Secret Sanitizer for Hyntx
|
|
623
|
+
*
|
|
624
|
+
* This module provides functionality to automatically redact secrets and sensitive
|
|
625
|
+
* information from prompts before sending them to AI providers.
|
|
626
|
+
*/
|
|
627
|
+
/**
|
|
628
|
+
* Result of sanitizing a single text.
|
|
629
|
+
*/
|
|
630
|
+
type SanitizeResult = {
|
|
631
|
+
readonly text: string;
|
|
632
|
+
readonly redacted: number;
|
|
633
|
+
};
|
|
634
|
+
/**
|
|
635
|
+
* Result of sanitizing multiple prompts.
|
|
636
|
+
*/
|
|
637
|
+
type SanitizePromptsResult = {
|
|
638
|
+
readonly prompts: readonly string[];
|
|
639
|
+
readonly totalRedacted: number;
|
|
640
|
+
};
|
|
641
|
+
/**
|
|
642
|
+
* Sanitizes a single text by redacting all detected secrets.
|
|
643
|
+
*
|
|
644
|
+
* @param text - Text to sanitize
|
|
645
|
+
* @returns Sanitized text and count of redactions
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* const result = sanitize('My API key is sk-1234567890abcdef...');
|
|
650
|
+
* // { text: 'My API key is [REDACTED_OPENAI_KEY]', redacted: 1 }
|
|
651
|
+
* ```
|
|
652
|
+
*/
|
|
653
|
+
declare function sanitize(text: string): SanitizeResult;
|
|
654
|
+
/**
|
|
655
|
+
* Sanitizes an array of prompts and returns sanitized prompts with total redaction count.
|
|
656
|
+
*
|
|
657
|
+
* @param prompts - Array of prompts to sanitize
|
|
658
|
+
* @returns Sanitized prompts and total number of redactions across all prompts
|
|
659
|
+
*
|
|
660
|
+
* @example
|
|
661
|
+
* ```typescript
|
|
662
|
+
* const prompts = [
|
|
663
|
+
* 'My key is sk-123...',
|
|
664
|
+
* 'Email me at user@example.com'
|
|
665
|
+
* ];
|
|
666
|
+
* const result = sanitizePrompts(prompts);
|
|
667
|
+
* // {
|
|
668
|
+
* // prompts: ['My key is [REDACTED_OPENAI_KEY]', 'Email me at [REDACTED_EMAIL]'],
|
|
669
|
+
* // totalRedacted: 2
|
|
670
|
+
* // }
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
declare function sanitizePrompts(prompts: readonly string[]): SanitizePromptsResult;
|
|
674
|
+
|
|
282
675
|
/**
|
|
283
676
|
* History management for Hyntx.
|
|
284
677
|
*
|
|
@@ -366,13 +759,14 @@ type FallbackCallback = (from: string, to: string) => void;
|
|
|
366
759
|
*
|
|
367
760
|
* @param type - The provider type to create
|
|
368
761
|
* @param config - Environment configuration with provider settings
|
|
762
|
+
* @param analysisMode - Optional analysis mode override ('batch' or 'individual')
|
|
369
763
|
* @returns The created provider instance
|
|
370
764
|
*
|
|
371
765
|
* @example
|
|
372
766
|
* const config = getEnvConfig();
|
|
373
|
-
* const provider = createProvider('ollama', config);
|
|
767
|
+
* const provider = createProvider('ollama', config, 'individual');
|
|
374
768
|
*/
|
|
375
|
-
declare function createProvider(type: ProviderType, config: EnvConfig): AnalysisProvider;
|
|
769
|
+
declare function createProvider(type: ProviderType, config: EnvConfig, analysisMode?: 'batch' | 'individual'): AnalysisProvider;
|
|
376
770
|
/**
|
|
377
771
|
* Gets the first available provider from the configured services list.
|
|
378
772
|
* Tests each provider in order and returns the first one that is available.
|
|
@@ -380,6 +774,7 @@ declare function createProvider(type: ProviderType, config: EnvConfig): Analysis
|
|
|
380
774
|
*
|
|
381
775
|
* @param config - Environment configuration with services list and provider settings
|
|
382
776
|
* @param onFallback - Optional callback called when falling back to a different provider
|
|
777
|
+
* @param analysisMode - Optional analysis mode override ('batch' or 'individual')
|
|
383
778
|
* @returns Promise resolving to the first available provider
|
|
384
779
|
* @throws Error if no providers are configured or none are available
|
|
385
780
|
*
|
|
@@ -387,23 +782,24 @@ declare function createProvider(type: ProviderType, config: EnvConfig): Analysis
|
|
|
387
782
|
* const config = getEnvConfig();
|
|
388
783
|
* const provider = await getAvailableProvider(config, (from, to) => {
|
|
389
784
|
* console.log(`Falling back from ${from} to ${to}`);
|
|
390
|
-
* });
|
|
785
|
+
* }, 'individual');
|
|
391
786
|
*/
|
|
392
|
-
declare function getAvailableProvider(config: EnvConfig, onFallback?: FallbackCallback): Promise<AnalysisProvider>;
|
|
787
|
+
declare function getAvailableProvider(config: EnvConfig, onFallback?: FallbackCallback, analysisMode?: 'batch' | 'individual'): Promise<AnalysisProvider>;
|
|
393
788
|
/**
|
|
394
789
|
* Gets all configured providers as instances.
|
|
395
790
|
* Returns providers for all types listed in the services configuration.
|
|
396
791
|
*
|
|
397
792
|
* @param config - Environment configuration with services list and provider settings
|
|
793
|
+
* @param analysisMode - Optional analysis mode override ('batch' or 'individual')
|
|
398
794
|
* @returns Array of provider instances
|
|
399
795
|
* @throws Error if no providers are configured
|
|
400
796
|
*
|
|
401
797
|
* @example
|
|
402
798
|
* const config = getEnvConfig();
|
|
403
|
-
* const providers = getAllProviders(config);
|
|
799
|
+
* const providers = getAllProviders(config, 'individual');
|
|
404
800
|
* // [OllamaProvider, AnthropicProvider, ...]
|
|
405
801
|
*/
|
|
406
|
-
declare function getAllProviders(config: EnvConfig): readonly AnalysisProvider[];
|
|
802
|
+
declare function getAllProviders(config: EnvConfig, analysisMode?: 'batch' | 'individual'): readonly AnalysisProvider[];
|
|
407
803
|
|
|
408
804
|
/**
|
|
409
805
|
* Environment variable management for Hyntx.
|
|
@@ -684,4 +1080,4 @@ declare const CACHE_ANALYSIS_DIR: string;
|
|
|
684
1080
|
*/
|
|
685
1081
|
declare const CACHE_META_FILE: string;
|
|
686
1082
|
|
|
687
|
-
export { AnalysisProvider, AnalysisResult, CACHE_ANALYSIS_DIR, CACHE_META_FILE, CLAUDE_PROJECTS_DIR, CacheOptions, ComparisonResult, DayGroup, EnvConfig, ExtractedPrompt, type FallbackCallback, HYNTX_CACHE_DIR, HYNTX_HISTORY_DIR, HistoryEntry, HistoryMetadata, type IssueMetadata, type IssueTaxonomy, LAST_RUN_FILE, ListHistoryOptions, LogReadResult, type MinimalResult, PatternSeverity, ProjectContext, ProviderType, type ReadLogsOptions, type SanitizePromptsResult, type SanitizeResult, type 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 };
|
|
1083
|
+
export { type AnalysisPattern, type AnalysisProvider, type AnalysisResult, type AnalysisStats, type AnthropicConfig, BATCH_STRATEGIES, type BatchStrategy, type BatchStrategyType, type BeforeAfter, CACHE_ANALYSIS_DIR, CACHE_DEFAULTS, CACHE_META_FILE, CLAUDE_PROJECTS_DIR, type CacheMetadata, type CacheOptions, type CachedBatchResult, type ClaudeMessage, type CliOptions, type ComparisonChanges, type ComparisonResult, type DayGroup, ENV_DEFAULTS, EXIT_CODES, type EnvConfig, type ExitCode, type ExtractedPrompt, type FallbackCallback, type FilePosition, type GoogleConfig, HYNTX_CACHE_DIR, HYNTX_HISTORY_DIR, type HistoryEntry, type HistoryMetadata, type IssueMetadata, type IssueTaxonomy, type JsonErrorResponse, LAST_RUN_FILE, type ListHistoryOptions, type LogEntry, type LogReadResult, type LogWatcher, type MinimalResult, type OllamaConfig, type OutputFormat, PROVIDER_LIMITS, type PatternChange, type PatternSeverity, type ProjectContext, type PromptAnalysis, type PromptEvent, type ProviderLimits, type ProviderType, type ReadLogsOptions, type SanitizePromptsResult, type SanitizeResult, type SchemaType, type SchemaVersion, type ShellConfigResult, type ShellType, type WatcherOptions, 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 };
|