hyntx 1.5.0 → 2.0.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 +499 -6
- package/dist/api/index.d.ts +665 -0
- package/dist/api/index.js +2797 -0
- package/dist/cli.d.ts +225 -0
- package/dist/cli.js +5716 -0
- package/dist/index-B6r9mP1J.d.ts +394 -0
- package/dist/index.d.ts +3 -251
- package/dist/index.js +2298 -3935
- package/package.json +23 -4
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { P as PatternSeverity, A as AnalysisResult, E as ExtractedPrompt, R as RulesConfig, L as LogReadResult, a as AnalysisProvider, b as ProjectContext } from './index-B6r9mP1J.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Terminal reporter for analysis results.
|
|
5
|
+
*
|
|
6
|
+
* This module provides formatted terminal output for analysis results,
|
|
7
|
+
* including patterns, statistics, and suggestions.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Entry for a rule in the rules list.
|
|
12
|
+
* Includes metadata about the rule and its current status.
|
|
13
|
+
*/
|
|
14
|
+
type RuleListEntry = {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly defaultSeverity: PatternSeverity;
|
|
19
|
+
readonly currentSeverity: PatternSeverity;
|
|
20
|
+
readonly enabled: boolean;
|
|
21
|
+
readonly overridden: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Hyntx - CLI Entry Point
|
|
26
|
+
*
|
|
27
|
+
* Main entry point for the Hyntx CLI that analyzes Claude Code prompts
|
|
28
|
+
* and generates improvement suggestions.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Parsed command-line arguments.
|
|
33
|
+
*/
|
|
34
|
+
type ParsedArgs = {
|
|
35
|
+
readonly date: string;
|
|
36
|
+
readonly from?: string;
|
|
37
|
+
readonly to?: string;
|
|
38
|
+
readonly project?: string;
|
|
39
|
+
readonly output?: string;
|
|
40
|
+
readonly dryRun: boolean;
|
|
41
|
+
readonly checkReminder: boolean;
|
|
42
|
+
readonly help: boolean;
|
|
43
|
+
readonly version: boolean;
|
|
44
|
+
readonly verbose: boolean;
|
|
45
|
+
readonly checkConfig: boolean;
|
|
46
|
+
readonly format: 'terminal' | 'json';
|
|
47
|
+
readonly compact: boolean;
|
|
48
|
+
readonly compareWith?: string;
|
|
49
|
+
readonly compareWeek: boolean;
|
|
50
|
+
readonly compareMonth: boolean;
|
|
51
|
+
readonly history: boolean;
|
|
52
|
+
readonly historySummary: boolean;
|
|
53
|
+
readonly noHistory: boolean;
|
|
54
|
+
readonly watch: boolean;
|
|
55
|
+
readonly quiet: boolean;
|
|
56
|
+
readonly clearCache: boolean;
|
|
57
|
+
readonly noCache: boolean;
|
|
58
|
+
readonly mcpServer: boolean;
|
|
59
|
+
readonly listRules: boolean;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Parses command-line arguments.
|
|
63
|
+
*
|
|
64
|
+
* @returns Parsed arguments
|
|
65
|
+
* @throws Error if arguments are invalid
|
|
66
|
+
*/
|
|
67
|
+
declare function parseArguments(): ParsedArgs;
|
|
68
|
+
/**
|
|
69
|
+
* Validates parsed arguments for logical conflicts and requirements.
|
|
70
|
+
*
|
|
71
|
+
* @param args - Parsed arguments to validate
|
|
72
|
+
* @throws Error if arguments are invalid or conflicting
|
|
73
|
+
*/
|
|
74
|
+
declare function validateArguments(args: ParsedArgs): void;
|
|
75
|
+
/**
|
|
76
|
+
* Gets the output file path for a given date.
|
|
77
|
+
* For multi-day scenarios, appends the date to the filename.
|
|
78
|
+
*
|
|
79
|
+
* @param basePath - Base output path from args
|
|
80
|
+
* @param date - Date string (YYYY-MM-DD) or undefined for single-day
|
|
81
|
+
* @returns Adjusted output file path
|
|
82
|
+
*/
|
|
83
|
+
declare function getOutputFilePath(basePath: string, date?: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Writes a single analysis result to a file.
|
|
86
|
+
*
|
|
87
|
+
* @param filePath - File path to write to
|
|
88
|
+
* @param result - Analysis result
|
|
89
|
+
* @param format - Output format ('md' or 'json')
|
|
90
|
+
* @param compact - Whether to use compact JSON (only for json format)
|
|
91
|
+
* @throws Error if write fails
|
|
92
|
+
*/
|
|
93
|
+
declare function writeOutputFile(filePath: string, result: AnalysisResult, format: 'md' | 'json', compact: boolean): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Writes multi-day results to a JSON array file.
|
|
96
|
+
*
|
|
97
|
+
* @param filePath - File path to write to
|
|
98
|
+
* @param results - Array of analysis results
|
|
99
|
+
* @param compact - Whether to use compact JSON
|
|
100
|
+
* @throws Error if write fails
|
|
101
|
+
*/
|
|
102
|
+
declare function writeMultiDayJsonOutput(filePath: string, results: readonly AnalysisResult[], compact: boolean): Promise<void>;
|
|
103
|
+
/**
|
|
104
|
+
* Displays a dry-run summary without performing analysis.
|
|
105
|
+
*
|
|
106
|
+
* @param prompts - Array of extracted prompts
|
|
107
|
+
* @param args - Parsed arguments
|
|
108
|
+
*/
|
|
109
|
+
declare function displayDryRunSummary(prompts: readonly ExtractedPrompt[], args: ParsedArgs): void;
|
|
110
|
+
/**
|
|
111
|
+
* Displays reminder status and exits.
|
|
112
|
+
*/
|
|
113
|
+
declare function showReminderStatus(): void;
|
|
114
|
+
/**
|
|
115
|
+
* Builds the list of rule entries with current configuration status.
|
|
116
|
+
*
|
|
117
|
+
* @param rulesConfig - Rules configuration from .hyntxrc.json
|
|
118
|
+
* @returns Array of rule list entries
|
|
119
|
+
*/
|
|
120
|
+
declare function buildRulesList(rulesConfig: RulesConfig | undefined): RuleListEntry[];
|
|
121
|
+
/**
|
|
122
|
+
* Displays available analysis rules and exits.
|
|
123
|
+
*
|
|
124
|
+
* @param format - Output format ('terminal' or 'json')
|
|
125
|
+
* @param compact - Whether to use compact JSON
|
|
126
|
+
* @param rulesConfig - Rules configuration from .hyntxrc.json
|
|
127
|
+
*/
|
|
128
|
+
declare function showRulesList(format: 'terminal' | 'json', compact: boolean, rulesConfig: RulesConfig | undefined): void;
|
|
129
|
+
/**
|
|
130
|
+
* Displays help message and exits.
|
|
131
|
+
*/
|
|
132
|
+
declare function showHelp(): void;
|
|
133
|
+
/**
|
|
134
|
+
* Displays version information and exits.
|
|
135
|
+
*/
|
|
136
|
+
declare function showVersion(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Runs configuration health check and exits.
|
|
139
|
+
*
|
|
140
|
+
* Validates all configured providers and tests their connectivity.
|
|
141
|
+
* Exits with 0 if all providers are valid, 1 if any issues found.
|
|
142
|
+
*/
|
|
143
|
+
declare function runConfigCheck(): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Checks if this is the first run and runs setup if needed.
|
|
146
|
+
*
|
|
147
|
+
* @param isJsonMode - Whether JSON output mode is active
|
|
148
|
+
*/
|
|
149
|
+
declare function checkAndRunSetup(isJsonMode: boolean): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Reads logs with filters from parsed arguments.
|
|
152
|
+
*
|
|
153
|
+
* @param args - Parsed command-line arguments
|
|
154
|
+
* @param isJsonMode - Whether JSON output mode is active
|
|
155
|
+
* @returns Log read result with prompts and warnings
|
|
156
|
+
*/
|
|
157
|
+
declare function readLogsWithSpinner(args: ParsedArgs, isJsonMode: boolean): Promise<LogReadResult>;
|
|
158
|
+
/**
|
|
159
|
+
* Connects to an available provider with automatic fallback.
|
|
160
|
+
*
|
|
161
|
+
* Uses the multi-provider factory to get the first available provider
|
|
162
|
+
* from the configured services list, with fallback support.
|
|
163
|
+
*
|
|
164
|
+
* @param isJsonMode - Whether JSON output mode is active
|
|
165
|
+
* @returns Available provider instance
|
|
166
|
+
*/
|
|
167
|
+
declare function connectProviderWithSpinner(isJsonMode: boolean): Promise<AnalysisProvider>;
|
|
168
|
+
/**
|
|
169
|
+
* Analyzes prompts with progress tracking.
|
|
170
|
+
*
|
|
171
|
+
* @param provider - Analysis provider
|
|
172
|
+
* @param prompts - Array of prompt strings
|
|
173
|
+
* @param date - Date context
|
|
174
|
+
* @param context - Optional project context
|
|
175
|
+
* @param rules - Optional rules configuration
|
|
176
|
+
* @param isJsonMode - Whether JSON output mode is active
|
|
177
|
+
* @param noCache - Whether to bypass cache
|
|
178
|
+
* @returns Analysis result
|
|
179
|
+
*/
|
|
180
|
+
declare function analyzeWithProgress(provider: AnalysisProvider, prompts: readonly string[], date: string, context: ProjectContext | undefined, rules: RulesConfig | undefined, isJsonMode: boolean, noCache?: boolean): Promise<AnalysisResult>;
|
|
181
|
+
/**
|
|
182
|
+
* Runs watch mode for real-time prompt analysis.
|
|
183
|
+
*
|
|
184
|
+
* This function runs indefinitely, monitoring log files for new prompts.
|
|
185
|
+
* It only exits when explicitly terminated (Ctrl+C) or an unhandled error occurs.
|
|
186
|
+
*
|
|
187
|
+
* @param provider - Analysis provider
|
|
188
|
+
* @param args - Parsed arguments
|
|
189
|
+
* @param context - Optional project context
|
|
190
|
+
* @param rules - Optional rules configuration
|
|
191
|
+
* @returns Promise that never resolves naturally (runs until terminated)
|
|
192
|
+
*/
|
|
193
|
+
declare function runWatchMode(provider: AnalysisProvider, args: ParsedArgs, context: ProjectContext | undefined, rules: RulesConfig | undefined): Promise<never>;
|
|
194
|
+
/**
|
|
195
|
+
* Displays analysis results.
|
|
196
|
+
*
|
|
197
|
+
* @param result - Analysis result
|
|
198
|
+
* @param format - Output format
|
|
199
|
+
* @param compact - Whether to use compact JSON (only relevant for JSON format)
|
|
200
|
+
*/
|
|
201
|
+
declare function displayResults(result: AnalysisResult, format: 'terminal' | 'json', compact: boolean): void;
|
|
202
|
+
/**
|
|
203
|
+
* Handles errors and exits with appropriate code.
|
|
204
|
+
*
|
|
205
|
+
* @param error - Error to handle
|
|
206
|
+
* @param isJsonMode - Whether JSON output mode is active
|
|
207
|
+
*/
|
|
208
|
+
declare function handleError(error: Error, isJsonMode: boolean): void;
|
|
209
|
+
/**
|
|
210
|
+
* Runs the MCP server mode.
|
|
211
|
+
*
|
|
212
|
+
* This function initializes and starts the MCP server for stdio-based
|
|
213
|
+
* JSON-RPC communication. It loads configuration, connects to a provider,
|
|
214
|
+
* and starts the server with graceful shutdown handling.
|
|
215
|
+
*
|
|
216
|
+
* CRITICAL: Never write to stdout in this mode - only stderr for logging.
|
|
217
|
+
* Stdout is reserved for JSON-RPC protocol messages.
|
|
218
|
+
*/
|
|
219
|
+
declare function runMcpServer(): Promise<never>;
|
|
220
|
+
/**
|
|
221
|
+
* Main entry point for the CLI.
|
|
222
|
+
*/
|
|
223
|
+
declare function cli(): Promise<void>;
|
|
224
|
+
|
|
225
|
+
export { type ParsedArgs, analyzeWithProgress, buildRulesList, checkAndRunSetup, cli, connectProviderWithSpinner, displayDryRunSummary, displayResults, getOutputFilePath, handleError, parseArguments, readLogsWithSpinner, runConfigCheck, runMcpServer, runWatchMode, showHelp, showReminderStatus, showRulesList, showVersion, validateArguments, writeMultiDayJsonOutput, writeOutputFile };
|