@defai.digital/ax-cli 3.14.18 → 3.15.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.
Files changed (63) hide show
  1. package/README.md +24 -2
  2. package/dist/mcp/client-v2.d.ts +103 -2
  3. package/dist/mcp/client-v2.js +299 -7
  4. package/dist/mcp/client-v2.js.map +1 -1
  5. package/dist/mcp/content-length-transport.d.ts +2 -0
  6. package/dist/mcp/content-length-transport.js +4 -1
  7. package/dist/mcp/content-length-transport.js.map +1 -1
  8. package/dist/mcp/index.d.ts +2 -0
  9. package/dist/mcp/index.js +4 -0
  10. package/dist/mcp/index.js.map +1 -1
  11. package/dist/mcp/schema-validator.d.ts +77 -0
  12. package/dist/mcp/schema-validator.js +125 -0
  13. package/dist/mcp/schema-validator.js.map +1 -0
  14. package/dist/mcp/subscriptions.d.ts +164 -0
  15. package/dist/mcp/subscriptions.js +242 -0
  16. package/dist/mcp/subscriptions.js.map +1 -0
  17. package/dist/mcp/transports.d.ts +3 -0
  18. package/dist/mcp/transports.js +11 -2
  19. package/dist/mcp/transports.js.map +1 -1
  20. package/dist/mcp/zai-templates.js +4 -0
  21. package/dist/mcp/zai-templates.js.map +1 -1
  22. package/dist/schemas/settings-schemas.js +7 -0
  23. package/dist/schemas/settings-schemas.js.map +1 -1
  24. package/package.json +1 -1
  25. package/.ax-cli/CUSTOM.md +0 -97
  26. package/.ax-cli/auto-accept-audit.json +0 -1302
  27. package/.ax-cli/index.json +0 -43
  28. package/.ax-cli/memory.json +0 -62
  29. package/.ax-cli/settings.json +0 -39
  30. package/ax.config.json +0 -304
  31. package/dist/analyzers/ast/tree-sitter-parser.d.ts +0 -134
  32. package/dist/analyzers/ast/tree-sitter-parser.js +0 -730
  33. package/dist/analyzers/ast/tree-sitter-parser.js.map +0 -1
  34. package/dist/mcp/config-detector-v2.d.ts +0 -83
  35. package/dist/mcp/config-detector-v2.js +0 -328
  36. package/dist/mcp/config-detector-v2.js.map +0 -1
  37. package/dist/mcp/config-migrator-v2.d.ts +0 -89
  38. package/dist/mcp/config-migrator-v2.js +0 -288
  39. package/dist/mcp/config-migrator-v2.js.map +0 -1
  40. package/dist/mcp/config-v2.d.ts +0 -111
  41. package/dist/mcp/config-v2.js +0 -443
  42. package/dist/mcp/config-v2.js.map +0 -1
  43. package/dist/mcp/transports-v2.d.ts +0 -152
  44. package/dist/mcp/transports-v2.js +0 -481
  45. package/dist/mcp/transports-v2.js.map +0 -1
  46. package/dist/utils/error-sanitizer.d.ts +0 -119
  47. package/dist/utils/error-sanitizer.js +0 -253
  48. package/dist/utils/error-sanitizer.js.map +0 -1
  49. package/dist/utils/errors.d.ts +0 -74
  50. package/dist/utils/errors.js +0 -139
  51. package/dist/utils/errors.js.map +0 -1
  52. package/dist/utils/incremental-analyzer.d.ts +0 -134
  53. package/dist/utils/incremental-analyzer.js +0 -377
  54. package/dist/utils/incremental-analyzer.js.map +0 -1
  55. package/dist/utils/math.d.ts +0 -1
  56. package/dist/utils/math.js +0 -4
  57. package/dist/utils/math.js.map +0 -1
  58. package/dist/utils/settings.d.ts +0 -1
  59. package/dist/utils/settings.js +0 -4
  60. package/dist/utils/settings.js.map +0 -1
  61. package/dist/utils/streaming-analyzer.d.ts +0 -160
  62. package/dist/utils/streaming-analyzer.js +0 -214
  63. package/dist/utils/streaming-analyzer.js.map +0 -1
@@ -1,377 +0,0 @@
1
- /**
2
- * Incremental Analyzer
3
- *
4
- * Analyzes only changed files and their dependencies using git integration.
5
- * Provides 10-50x speedup by avoiding analysis of unchanged files.
6
- *
7
- * Quick Win #2: Git-Based Incremental Analysis (Est. time: 1 hour)
8
- * Impact: 10-50x reduction in files to analyze
9
- */
10
- import { execSync } from 'child_process';
11
- import { existsSync } from 'fs';
12
- import { resolve, dirname, join } from 'path';
13
- import { readFile } from 'fs/promises';
14
- /**
15
- * Check if directory is a git repository
16
- */
17
- export function isGitRepo(dir = process.cwd()) {
18
- try {
19
- execSync('git rev-parse --git-dir', {
20
- cwd: dir,
21
- stdio: 'ignore',
22
- });
23
- return true;
24
- }
25
- catch {
26
- return false;
27
- }
28
- }
29
- /**
30
- * Get changed files from git
31
- *
32
- * @param config - Configuration options
33
- * @returns Array of changed files
34
- *
35
- * @example
36
- * ```typescript
37
- * const changed = await getChangedFiles({
38
- * compareWith: 'main',
39
- * include: ['*.ts', '*.tsx'],
40
- * });
41
- *
42
- * console.log(`${changed.length} files changed`);
43
- * ```
44
- */
45
- export async function getChangedFiles(config = {}) {
46
- const baseDir = config.baseDir || process.cwd();
47
- // Check if git repo
48
- if (!isGitRepo(baseDir)) {
49
- throw new Error('Not a git repository');
50
- }
51
- const changedFiles = [];
52
- try {
53
- // Get staged and unstaged changes
54
- const statusOutput = execSync(`git status --porcelain ${config.includeUntracked ? '--untracked-files=all' : '--untracked-files=no'}`, {
55
- cwd: baseDir,
56
- encoding: 'utf-8',
57
- });
58
- // Parse git status output
59
- for (const line of statusOutput.split('\n')) {
60
- if (!line.trim())
61
- continue;
62
- const status = line.substring(0, 2);
63
- const filePath = line.substring(3);
64
- // Parse status codes
65
- let changeType;
66
- if (status.includes('M')) {
67
- changeType = 'modified';
68
- }
69
- else if (status.includes('A')) {
70
- changeType = 'added';
71
- }
72
- else if (status.includes('D')) {
73
- changeType = 'deleted';
74
- }
75
- else if (status.includes('R')) {
76
- changeType = 'renamed';
77
- }
78
- else if (status.includes('?')) {
79
- changeType = 'untracked';
80
- }
81
- else {
82
- continue;
83
- }
84
- // Apply filters - convert glob patterns to proper regex
85
- const globToRegex = (pattern) => {
86
- // Escape special regex chars except * and ?, then convert glob wildcards
87
- // SECURITY FIX: Use [^/]* instead of .* to prevent ReDoS attacks
88
- // .* can cause exponential time complexity on patterns like "a*b*c*d*"
89
- const escaped = pattern
90
- .replace(/[.+^${}()|[\]\\]/g, '\\$&') // Escape regex special chars
91
- .replace(/\*/g, '[^/]*') // * -> [^/]* (non-greedy, no directory crossing)
92
- .replace(/\?/g, '[^/]'); // ? -> [^/] (single char, no directory crossing)
93
- return new RegExp(`^${escaped}$`);
94
- };
95
- if (config.include && config.include.length > 0) {
96
- const matches = config.include.some((pattern) => globToRegex(pattern).test(filePath));
97
- if (!matches)
98
- continue;
99
- }
100
- if (config.exclude && config.exclude.length > 0) {
101
- const excluded = config.exclude.some((pattern) => globToRegex(pattern).test(filePath));
102
- if (excluded)
103
- continue;
104
- }
105
- changedFiles.push({
106
- path: filePath,
107
- status: changeType,
108
- });
109
- }
110
- // Get diff against specific commit/branch if specified
111
- if (config.compareWith) {
112
- const diffOutput = execSync(`git diff --name-status ${config.compareWith}...HEAD`, {
113
- cwd: baseDir,
114
- encoding: 'utf-8',
115
- });
116
- for (const line of diffOutput.split('\n')) {
117
- if (!line.trim())
118
- continue;
119
- const [status, ...paths] = line.split('\t');
120
- const filePath = paths[0];
121
- // Skip if no file path found
122
- if (!filePath)
123
- continue;
124
- // Skip if already in changed files
125
- if (changedFiles.some((f) => f.path === filePath)) {
126
- continue;
127
- }
128
- let changeType;
129
- if (status === 'M') {
130
- changeType = 'modified';
131
- }
132
- else if (status === 'A') {
133
- changeType = 'added';
134
- }
135
- else if (status === 'D') {
136
- changeType = 'deleted';
137
- }
138
- else if (status.startsWith('R')) {
139
- changeType = 'renamed';
140
- }
141
- else {
142
- continue;
143
- }
144
- changedFiles.push({
145
- path: filePath,
146
- status: changeType,
147
- oldPath: paths.length > 1 ? paths[1] : undefined,
148
- });
149
- }
150
- }
151
- }
152
- catch (error) {
153
- throw new Error(`Failed to get changed files: ${error.message}`);
154
- }
155
- return changedFiles;
156
- }
157
- /**
158
- * Get files to analyze incrementally
159
- *
160
- * Returns only files that need analysis based on git changes.
161
- *
162
- * @param allFiles - All files in project
163
- * @param config - Configuration options
164
- * @returns Incremental analysis result
165
- *
166
- * @example
167
- * ```typescript
168
- * const allFiles = await glob('src/** /*.ts');
169
- * const result = await getFilesToAnalyze(allFiles);
170
- *
171
- * console.log(`Analyzing ${result.filesToAnalyze.length} of ${result.totalFiles} files`);
172
- * console.log(`Speedup: ${result.speedup.toFixed(1)}x`);
173
- * ```
174
- */
175
- export async function getFilesToAnalyze(allFiles, config = {}) {
176
- const baseDir = config.baseDir || process.cwd();
177
- // Check if git repo
178
- if (!isGitRepo(baseDir)) {
179
- // Not a git repo - analyze all files
180
- return {
181
- filesToAnalyze: allFiles,
182
- cachedFiles: [],
183
- changedFiles: [],
184
- totalFiles: allFiles.length,
185
- speedup: 1.0,
186
- };
187
- }
188
- // Get changed files
189
- const changedFiles = await getChangedFiles(config);
190
- if (changedFiles.length === 0) {
191
- // No changes - all files can use cache
192
- return {
193
- filesToAnalyze: [],
194
- cachedFiles: allFiles,
195
- changedFiles: [],
196
- totalFiles: allFiles.length,
197
- speedup: allFiles.length > 0 ? Infinity : 1.0,
198
- };
199
- }
200
- // Convert changed file paths to absolute paths
201
- const changedPaths = new Set(changedFiles.map((f) => resolve(baseDir, f.path)));
202
- // Filter all files to only those that changed
203
- const filesToAnalyze = allFiles.filter((file) => {
204
- const absPath = resolve(file);
205
- return changedPaths.has(absPath);
206
- });
207
- const cachedFiles = allFiles.filter((file) => {
208
- const absPath = resolve(file);
209
- return !changedPaths.has(absPath);
210
- });
211
- const speedup = allFiles.length / Math.max(filesToAnalyze.length, 1);
212
- return {
213
- filesToAnalyze,
214
- cachedFiles,
215
- changedFiles,
216
- totalFiles: allFiles.length,
217
- speedup,
218
- };
219
- }
220
- /**
221
- * Get git repository info
222
- *
223
- * @param baseDir - Base directory (default: cwd)
224
- * @returns Repository information
225
- */
226
- export function getGitInfo(baseDir = process.cwd()) {
227
- if (!isGitRepo(baseDir)) {
228
- return null;
229
- }
230
- try {
231
- const branch = execSync('git rev-parse --abbrev-ref HEAD', {
232
- cwd: baseDir,
233
- encoding: 'utf-8',
234
- }).trim();
235
- const commit = execSync('git rev-parse --short HEAD', {
236
- cwd: baseDir,
237
- encoding: 'utf-8',
238
- }).trim();
239
- const statusOutput = execSync('git status --porcelain', {
240
- cwd: baseDir,
241
- encoding: 'utf-8',
242
- });
243
- const isDirty = statusOutput.trim().length > 0;
244
- // Get ahead/behind counts
245
- let ahead = 0;
246
- let behind = 0;
247
- try {
248
- const aheadBehind = execSync('git rev-list --left-right --count HEAD...@{u}', {
249
- cwd: baseDir,
250
- encoding: 'utf-8',
251
- }).trim();
252
- const splitParts = aheadBehind.split('\t');
253
- if (splitParts.length >= 2) {
254
- const [aheadStr, behindStr] = splitParts;
255
- ahead = parseInt(aheadStr, 10);
256
- behind = parseInt(behindStr, 10);
257
- }
258
- }
259
- catch {
260
- // No upstream branch
261
- }
262
- return {
263
- branch,
264
- commit,
265
- isDirty,
266
- ahead,
267
- behind,
268
- };
269
- }
270
- catch (error) {
271
- return null;
272
- }
273
- }
274
- /**
275
- * Simple dependency tracker (for future use)
276
- *
277
- * Parses import/require statements to build a dependency graph.
278
- */
279
- export class DependencyTracker {
280
- graph = new Map();
281
- reverseGraph = new Map();
282
- /**
283
- * Add a file and its dependencies
284
- */
285
- async addFile(filePath) {
286
- const content = await readFile(filePath, 'utf-8');
287
- const imports = this.parseImports(content);
288
- // Resolve imports to absolute paths
289
- const resolvedImports = imports
290
- .map((imp) => this.resolveImport(imp, filePath))
291
- .filter((imp) => imp !== null);
292
- // Add to graph
293
- this.graph.set(filePath, new Set(resolvedImports));
294
- // Add to reverse graph
295
- for (const imp of resolvedImports) {
296
- if (!this.reverseGraph.has(imp)) {
297
- this.reverseGraph.set(imp, new Set());
298
- }
299
- this.reverseGraph.get(imp).add(filePath);
300
- }
301
- }
302
- /**
303
- * Get files that depend on the given file
304
- */
305
- getDependents(filePath) {
306
- return Array.from(this.reverseGraph.get(filePath) || []);
307
- }
308
- /**
309
- * Get all affected files (transitive dependencies)
310
- */
311
- getAffectedFiles(changedFiles) {
312
- const affected = new Set(changedFiles);
313
- const queue = [...changedFiles];
314
- while (queue.length > 0) {
315
- const file = queue.shift();
316
- const dependents = this.getDependents(file);
317
- for (const dep of dependents) {
318
- if (!affected.has(dep)) {
319
- affected.add(dep);
320
- queue.push(dep);
321
- }
322
- }
323
- }
324
- return Array.from(affected);
325
- }
326
- /**
327
- * Parse import statements from file content
328
- */
329
- parseImports(content) {
330
- const imports = [];
331
- // ES6 imports
332
- const es6Regex = /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g;
333
- let match;
334
- while ((match = es6Regex.exec(content)) !== null) {
335
- imports.push(match[1]);
336
- }
337
- // CommonJS requires
338
- const cjsRegex = /require\(['"]([^'"]+)['"]\)/g;
339
- while ((match = cjsRegex.exec(content)) !== null) {
340
- imports.push(match[1]);
341
- }
342
- // Dynamic imports
343
- const dynamicRegex = /import\(['"]([^'"]+)['"]\)/g;
344
- while ((match = dynamicRegex.exec(content)) !== null) {
345
- imports.push(match[1]);
346
- }
347
- return imports;
348
- }
349
- /**
350
- * Resolve import path to absolute path
351
- */
352
- resolveImport(importPath, fromFile) {
353
- // Skip node_modules
354
- if (!importPath.startsWith('.')) {
355
- return null;
356
- }
357
- const dir = dirname(fromFile);
358
- let resolved = resolve(dir, importPath);
359
- // Try with common extensions
360
- const extensions = ['', '.ts', '.tsx', '.js', '.jsx'];
361
- for (const ext of extensions) {
362
- const withExt = resolved + ext;
363
- if (existsSync(withExt)) {
364
- return withExt;
365
- }
366
- }
367
- // Try index files
368
- for (const ext of extensions.slice(1)) {
369
- const indexPath = join(resolved, `index${ext}`);
370
- if (existsSync(indexPath)) {
371
- return indexPath;
372
- }
373
- }
374
- return null;
375
- }
376
- }
377
- //# sourceMappingURL=incremental-analyzer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"incremental-analyzer.js","sourceRoot":"","sources":["../../src/utils/incremental-analyzer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EA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}
@@ -1 +0,0 @@
1
- export declare function add(a: number, b: number): number;
@@ -1,4 +0,0 @@
1
- export function add(a, b) {
2
- return a + b;
3
- }
4
- //# sourceMappingURL=math.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"math.js","sourceRoot":"","sources":["../../src/utils/math.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,GAAG,CAAC,CAAS,EAAE,CAAS;IACtC,OAAO,CAAC,GAAG,CAAC,CAAC;AACf,CAAC"}
@@ -1 +0,0 @@
1
- export { getSettingsManager, UserSettings, ProjectSettings } from './settings-manager.js';
@@ -1,4 +0,0 @@
1
- // This file is kept for potential future convenience functions
2
- // All settings management should use getSettingsManager() from './settings-manager.js'
3
- export { getSettingsManager } from './settings-manager.js';
4
- //# sourceMappingURL=settings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,uFAAuF;AAEvF,OAAO,EAAE,kBAAkB,EAAiC,MAAM,uBAAuB,CAAC"}
@@ -1,160 +0,0 @@
1
- /**
2
- * Streaming Analyzer
3
- *
4
- * Emits analysis results as they're found instead of waiting for all files.
5
- * Provides better user experience with immediate feedback.
6
- *
7
- * Quick Win #3: Streaming Results (Est. time: 30 minutes)
8
- * Impact: Better UX, perceived 2-5x faster
9
- */
10
- import { EventEmitter } from 'events';
11
- import { formatDuration } from '../ui/utils/tool-grouper.js';
12
- /**
13
- * Analysis result for a single file
14
- */
15
- export interface FileAnalysisResult<T = unknown> {
16
- /** File path */
17
- file: string;
18
- /** Analysis result */
19
- result?: T;
20
- /** Error if analysis failed */
21
- error?: Error;
22
- /** Analysis duration in ms */
23
- duration: number;
24
- /** Whether result was from cache */
25
- cached: boolean;
26
- }
27
- /**
28
- * Progress update
29
- */
30
- export interface AnalysisProgress {
31
- /** Number of files completed */
32
- completed: number;
33
- /** Total number of files */
34
- total: number;
35
- /** Current file being analyzed */
36
- currentFile?: string;
37
- /** Percentage complete (0-100) */
38
- percentage: number;
39
- /** Estimated time remaining in ms */
40
- estimatedTimeRemaining?: number;
41
- }
42
- /**
43
- * Analysis summary
44
- */
45
- export interface AnalysisSummary<T = unknown> {
46
- /** All results */
47
- results: FileAnalysisResult<T>[];
48
- /** Number of successful analyses */
49
- successCount: number;
50
- /** Number of failed analyses */
51
- errorCount: number;
52
- /** Number of cached results */
53
- cachedCount: number;
54
- /** Total duration in ms */
55
- totalDuration: number;
56
- /** Average duration per file in ms */
57
- avgDuration: number;
58
- /** Cache hit rate (0-1) */
59
- cacheHitRate: number;
60
- }
61
- /**
62
- * Streaming analyzer events
63
- */
64
- export interface StreamingAnalyzerEvents<T = unknown> {
65
- /** Emitted when a file analysis starts */
66
- start: (file: string) => void;
67
- /** Emitted when a file analysis completes */
68
- result: (result: FileAnalysisResult<T>) => void;
69
- /** Emitted on progress updates */
70
- progress: (progress: AnalysisProgress) => void;
71
- /** Emitted when all files are analyzed */
72
- complete: (summary: AnalysisSummary<T>) => void;
73
- /** Emitted on error */
74
- error: (file: string, error: Error) => void;
75
- }
76
- /**
77
- * Streaming Analyzer
78
- *
79
- * Analyzes files and emits results as they're completed.
80
- *
81
- * @example
82
- * ```typescript
83
- * const analyzer = new StreamingAnalyzer();
84
- *
85
- * analyzer.on('result', (result) => {
86
- * if (result.error) {
87
- * console.error(`Error in ${result.file}: ${result.error.message}`);
88
- * } else {
89
- * console.log(`✓ ${result.file} (${result.duration}ms)`);
90
- * }
91
- * });
92
- *
93
- * analyzer.on('progress', (progress) => {
94
- * console.log(`Progress: ${progress.percentage}%`);
95
- * });
96
- *
97
- * analyzer.on('complete', (summary) => {
98
- * console.log(`Done! ${summary.successCount} files analyzed`);
99
- * });
100
- *
101
- * await analyzer.analyze(files, analyzeFile);
102
- * ```
103
- */
104
- export declare class StreamingAnalyzer<T = unknown> extends EventEmitter {
105
- private results;
106
- private startTime;
107
- private completed;
108
- private total;
109
- /**
110
- * Analyze files and emit results as they complete
111
- *
112
- * @param files - Array of file paths to analyze
113
- * @param analyzer - Analysis function
114
- * @returns Promise that resolves when all files are analyzed
115
- */
116
- analyze(files: string[], analyzer: (file: string) => Promise<T>): Promise<AnalysisSummary<T>>;
117
- /**
118
- * Analyze files in parallel and emit results as they complete
119
- *
120
- * @param files - Array of file paths to analyze
121
- * @param analyzer - Analysis function
122
- * @param concurrency - Maximum concurrent analyses (default: 4)
123
- * @returns Promise that resolves when all files are analyzed
124
- */
125
- analyzeParallel(files: string[], analyzer: (file: string) => Promise<T>, concurrency?: number): Promise<AnalysisSummary<T>>;
126
- /**
127
- * Get current progress
128
- */
129
- getProgress(): AnalysisProgress;
130
- /**
131
- * Analyze a single file and emit events
132
- */
133
- private analyzeFile;
134
- /**
135
- * Create analysis summary
136
- */
137
- private createSummary;
138
- }
139
- /**
140
- * Helper function to create a progress bar string
141
- *
142
- * @param progress - Progress info
143
- * @param width - Width of progress bar (default: 40)
144
- * @returns Progress bar string
145
- *
146
- * @example
147
- * ```typescript
148
- * const bar = createProgressBar({ completed: 50, total: 100, percentage: 50 });
149
- * console.log(bar); // [#################### ] 50%
150
- * ```
151
- */
152
- export declare function createProgressBar(progress: AnalysisProgress, width?: number): string;
153
- export { formatDuration };
154
- /**
155
- * Helper function to format summary
156
- *
157
- * @param summary - Analysis summary
158
- * @returns Formatted summary string
159
- */
160
- export declare function formatSummary<T>(summary: AnalysisSummary<T>): string;