@defai.digital/ax-cli 3.4.6 → 3.5.4
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/LICENSE +2 -6
- package/README.md +109 -2
- package/dist/analyzers/ast/index.d.ts +9 -0
- package/dist/analyzers/ast/index.js +10 -0
- package/dist/analyzers/ast/index.js.map +1 -0
- package/dist/analyzers/ast/node-helpers.d.ts +81 -0
- package/dist/analyzers/ast/node-helpers.js +128 -0
- package/dist/analyzers/ast/node-helpers.js.map +1 -0
- package/dist/analyzers/ast/parser.d.ts +59 -0
- package/dist/analyzers/ast/parser.js +293 -0
- package/dist/analyzers/ast/parser.js.map +1 -0
- package/dist/analyzers/ast/traverser.d.ts +67 -0
- package/dist/analyzers/ast/traverser.js +156 -0
- package/dist/analyzers/ast/traverser.js.map +1 -0
- package/dist/analyzers/ast/types.d.ts +107 -0
- package/dist/analyzers/ast/types.js +7 -0
- package/dist/analyzers/ast/types.js.map +1 -0
- package/dist/analyzers/best-practices/index.d.ts +10 -0
- package/dist/analyzers/best-practices/index.js +11 -0
- package/dist/analyzers/best-practices/index.js.map +1 -0
- package/dist/analyzers/code-smells/base-smell-detector.d.ts +30 -0
- package/dist/analyzers/code-smells/base-smell-detector.js +44 -0
- package/dist/analyzers/code-smells/base-smell-detector.js.map +1 -0
- package/dist/analyzers/code-smells/code-smell-analyzer.d.ts +30 -0
- package/dist/analyzers/code-smells/code-smell-analyzer.js +167 -0
- package/dist/analyzers/code-smells/code-smell-analyzer.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/data-clumps-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/data-clumps-detector.js +66 -0
- package/dist/analyzers/code-smells/detectors/data-clumps-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/dead-code-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/dead-code-detector.js +53 -0
- package/dist/analyzers/code-smells/detectors/dead-code-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/duplicate-code-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js +51 -0
- package/dist/analyzers/code-smells/detectors/duplicate-code-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/feature-envy-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/feature-envy-detector.js +64 -0
- package/dist/analyzers/code-smells/detectors/feature-envy-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.d.ts +11 -0
- package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js +56 -0
- package/dist/analyzers/code-smells/detectors/inappropriate-intimacy-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/large-class-detector.d.ts +13 -0
- package/dist/analyzers/code-smells/detectors/large-class-detector.js +58 -0
- package/dist/analyzers/code-smells/detectors/large-class-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/long-method-detector.d.ts +12 -0
- package/dist/analyzers/code-smells/detectors/long-method-detector.js +52 -0
- package/dist/analyzers/code-smells/detectors/long-method-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.d.ts +12 -0
- package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js +50 -0
- package/dist/analyzers/code-smells/detectors/long-parameter-list-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/magic-numbers-detector.d.ts +12 -0
- package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js +54 -0
- package/dist/analyzers/code-smells/detectors/magic-numbers-detector.js.map +1 -0
- package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.d.ts +13 -0
- package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js +71 -0
- package/dist/analyzers/code-smells/detectors/nested-conditionals-detector.js.map +1 -0
- package/dist/analyzers/code-smells/index.d.ts +16 -0
- package/dist/analyzers/code-smells/index.js +19 -0
- package/dist/analyzers/code-smells/index.js.map +1 -0
- package/dist/analyzers/code-smells/types.d.ts +82 -0
- package/dist/analyzers/code-smells/types.js +30 -0
- package/dist/analyzers/code-smells/types.js.map +1 -0
- package/dist/analyzers/dependency/circular-detector.d.ts +17 -0
- package/dist/analyzers/dependency/circular-detector.js +71 -0
- package/dist/analyzers/dependency/circular-detector.js.map +1 -0
- package/dist/analyzers/dependency/coupling-calculator.d.ts +24 -0
- package/dist/analyzers/dependency/coupling-calculator.js +86 -0
- package/dist/analyzers/dependency/coupling-calculator.js.map +1 -0
- package/dist/analyzers/dependency/dependency-analyzer.d.ts +40 -0
- package/dist/analyzers/dependency/dependency-analyzer.js +214 -0
- package/dist/analyzers/dependency/dependency-analyzer.js.map +1 -0
- package/dist/analyzers/dependency/dependency-graph.d.ts +57 -0
- package/dist/analyzers/dependency/dependency-graph.js +186 -0
- package/dist/analyzers/dependency/dependency-graph.js.map +1 -0
- package/dist/analyzers/dependency/index.d.ts +8 -0
- package/dist/analyzers/dependency/index.js +8 -0
- package/dist/analyzers/dependency/index.js.map +1 -0
- package/dist/analyzers/dependency/types.d.ts +105 -0
- package/dist/analyzers/dependency/types.js +5 -0
- package/dist/analyzers/dependency/types.js.map +1 -0
- package/dist/analyzers/git/churn-calculator.d.ts +34 -0
- package/dist/analyzers/git/churn-calculator.js +214 -0
- package/dist/analyzers/git/churn-calculator.js.map +1 -0
- package/dist/analyzers/git/git-analyzer.d.ts +19 -0
- package/dist/analyzers/git/git-analyzer.js +71 -0
- package/dist/analyzers/git/git-analyzer.js.map +1 -0
- package/dist/analyzers/git/hotspot-detector.d.ts +34 -0
- package/dist/analyzers/git/hotspot-detector.js +170 -0
- package/dist/analyzers/git/hotspot-detector.js.map +1 -0
- package/dist/analyzers/git/index.d.ts +7 -0
- package/dist/analyzers/git/index.js +7 -0
- package/dist/analyzers/git/index.js.map +1 -0
- package/dist/analyzers/git/types.d.ts +88 -0
- package/dist/analyzers/git/types.js +5 -0
- package/dist/analyzers/git/types.js.map +1 -0
- package/dist/analyzers/metrics/halstead-calculator.d.ts +30 -0
- package/dist/analyzers/metrics/halstead-calculator.js +150 -0
- package/dist/analyzers/metrics/halstead-calculator.js.map +1 -0
- package/dist/analyzers/metrics/index.d.ts +9 -0
- package/dist/analyzers/metrics/index.js +9 -0
- package/dist/analyzers/metrics/index.js.map +1 -0
- package/dist/analyzers/metrics/maintainability-calculator.d.ts +17 -0
- package/dist/analyzers/metrics/maintainability-calculator.js +46 -0
- package/dist/analyzers/metrics/maintainability-calculator.js.map +1 -0
- package/dist/analyzers/metrics/metrics-analyzer.d.ts +32 -0
- package/dist/analyzers/metrics/metrics-analyzer.js +140 -0
- package/dist/analyzers/metrics/metrics-analyzer.js.map +1 -0
- package/dist/analyzers/metrics/types.d.ts +67 -0
- package/dist/analyzers/metrics/types.js +5 -0
- package/dist/analyzers/metrics/types.js.map +1 -0
- package/dist/analyzers/security/base-detector.d.ts +58 -0
- package/dist/analyzers/security/base-detector.js +104 -0
- package/dist/analyzers/security/base-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/command-injection-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/command-injection-detector.js +84 -0
- package/dist/analyzers/security/detectors/command-injection-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/hardcoded-secrets-detector.d.ts +16 -0
- package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js +140 -0
- package/dist/analyzers/security/detectors/hardcoded-secrets-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/insecure-deserialization-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/insecure-deserialization-detector.js +109 -0
- package/dist/analyzers/security/detectors/insecure-deserialization-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/insecure-random-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/insecure-random-detector.js +61 -0
- package/dist/analyzers/security/detectors/insecure-random-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/path-traversal-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/path-traversal-detector.js +82 -0
- package/dist/analyzers/security/detectors/path-traversal-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/sql-injection-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/sql-injection-detector.js +88 -0
- package/dist/analyzers/security/detectors/sql-injection-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/weak-crypto-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/weak-crypto-detector.js +104 -0
- package/dist/analyzers/security/detectors/weak-crypto-detector.js.map +1 -0
- package/dist/analyzers/security/detectors/xss-detector.d.ts +12 -0
- package/dist/analyzers/security/detectors/xss-detector.js +90 -0
- package/dist/analyzers/security/detectors/xss-detector.js.map +1 -0
- package/dist/analyzers/security/index.d.ts +16 -0
- package/dist/analyzers/security/index.js +18 -0
- package/dist/analyzers/security/index.js.map +1 -0
- package/dist/analyzers/security/security-analyzer.d.ts +38 -0
- package/dist/analyzers/security/security-analyzer.js +215 -0
- package/dist/analyzers/security/security-analyzer.js.map +1 -0
- package/dist/analyzers/security/types.d.ts +95 -0
- package/dist/analyzers/security/types.js +7 -0
- package/dist/analyzers/security/types.js.map +1 -0
- package/dist/hooks/use-enhanced-input.d.ts +0 -1
- package/dist/hooks/use-enhanced-input.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/mcp/validation.js +12 -6
- package/dist/mcp/validation.js.map +1 -1
- package/dist/tools/analysis-tools.d.ts +73 -0
- package/dist/tools/analysis-tools.js +422 -0
- package/dist/tools/analysis-tools.js.map +1 -0
- package/dist/tools/bash.js +2 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/ui/components/toast-notification.js +0 -1
- package/dist/ui/components/toast-notification.js.map +1 -1
- package/dist/ui/components/welcome-panel.js +1 -1
- package/dist/ui/components/welcome-panel.js.map +1 -1
- package/dist/ui/hooks/use-input-history.d.ts +9 -0
- package/dist/ui/hooks/use-input-history.js +117 -0
- package/dist/ui/hooks/use-input-history.js.map +1 -0
- package/dist/utils/parallel-analyzer.js +30 -17
- package/dist/utils/parallel-analyzer.js.map +1 -1
- package/eslint.config.js +3 -0
- package/package.json +5 -5
- package/vitest.config.ts +1 -0
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-11e9e0ba-c39d-4fd2-aa77-bc818811c921.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-2b260b98-b418-4c7c-9694-e2b94967e662.json +0 -24
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-7e03601e-e8ab-4cd7-9841-a74b66adf78f.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-7f9c6562-771f-4fd0-adcf-9e7e9ac34ae8.json +0 -44
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-e1ebe666-4c3a-4367-ba5c-27fe512a9c70.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-15743e7d-430c-4d76-b6fc-955d7a5c250c.json +0 -44
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-25cf7679-0b3f-4988-83d7-704548fbba91.json +0 -69
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-54aedbac-6db0-464e-8ebb-dbb3979e6dca.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-7658aed8-fe5d-4222-903f-1a7c63717ea7.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-c9c13497-40dc-4294-a327-6a5fc854eaa1.json +0 -69
- package/automatosx.config.json +0 -333
- package/config/messages.yaml +0 -75
- package/config/models.yaml +0 -66
- package/config/prompts.yaml +0 -156
- package/config/settings.yaml +0 -86
- package/dist/commands/weather.d.ts +0 -8
- package/dist/commands/weather.js +0 -160
- package/dist/commands/weather.js.map +0 -1
- package/dist/grok/client.d.ts +0 -144
- package/dist/grok/client.js +0 -237
- package/dist/grok/client.js.map +0 -1
- package/dist/grok/tools.d.ts +0 -8
- package/dist/grok/tools.js +0 -318
- package/dist/grok/tools.js.map +0 -1
- package/dist/grok/types.d.ts +0 -291
- package/dist/grok/types.js +0 -127
- package/dist/grok/types.js.map +0 -1
- package/dist/tools/morph-editor.d.ts +0 -36
- package/dist/tools/morph-editor.js +0 -308
- package/dist/tools/morph-editor.js.map +0 -1
- package/dist/ui/components/session-recovery.d.ts +0 -12
- package/dist/ui/components/session-recovery.js +0 -93
- package/dist/ui/components/session-recovery.js.map +0 -1
- package/dist/utils/model-config.d.ts +0 -28
- package/dist/utils/model-config.js +0 -43
- package/dist/utils/model-config.js.map +0 -1
- package/dist/utils/tool-helpers.d.ts +0 -25
- package/dist/utils/tool-helpers.js +0 -79
- package/dist/utils/tool-helpers.js.map +0 -1
- package/packages/schemas/dist/index.d.ts +0 -14
- package/packages/schemas/dist/index.d.ts.map +0 -1
- package/packages/schemas/dist/index.js +0 -19
- package/packages/schemas/dist/index.js.map +0 -1
- package/packages/schemas/dist/public/core/brand-types.d.ts +0 -308
- package/packages/schemas/dist/public/core/brand-types.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/brand-types.js +0 -243
- package/packages/schemas/dist/public/core/brand-types.js.map +0 -1
- package/packages/schemas/dist/public/core/enums.d.ts +0 -227
- package/packages/schemas/dist/public/core/enums.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/enums.js +0 -222
- package/packages/schemas/dist/public/core/enums.js.map +0 -1
- package/packages/schemas/dist/public/core/id-types.d.ts +0 -286
- package/packages/schemas/dist/public/core/id-types.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/id-types.js +0 -136
- package/packages/schemas/dist/public/core/id-types.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Copyright (c) 2023 GrokCLI Authors https://github.com/superagent-ai/grok-cli
|
|
5
|
-
|
|
6
|
-
Modifications Copyright (c) 2025 DEFAI Private Limited
|
|
3
|
+
Copyright (c) 2025 DEFAI Private Limited
|
|
7
4
|
Licensed under the MIT License https://github.com/defai-digital/ax-cli
|
|
8
5
|
|
|
9
|
-
|
|
10
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
7
|
of this software and associated documentation files (the "Software"), to deal
|
|
12
8
|
in the Software without restriction, including without limitation the rights
|
|
@@ -14,7 +10,7 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
14
10
|
copies of the Software, and to permit persons to whom the Software is
|
|
15
11
|
furnished to do so, subject to the following conditions:
|
|
16
12
|
|
|
17
|
-
The above copyright notice and this permission
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
14
|
copies or substantial portions of the Software.
|
|
19
15
|
|
|
20
16
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# AX CLI - Enterprise-Class GLM AI CLI
|
|
2
2
|
|
|
3
3
|
[](https://npm-stat.com/charts.html?package=%40defai.digital%2Fax-cli)
|
|
4
|
-
[](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)
|
|
5
|
+
[](https://github.com/defai-digital/ax-cli)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -82,6 +82,13 @@ ax-cli
|
|
|
82
82
|
- Support for technical docs, code examples, news, and general queries
|
|
83
83
|
- Configurable search depth and freshness filters
|
|
84
84
|
- **🔄 Auto-Update**: Built-in update checker and installer
|
|
85
|
+
- **📊 Advanced Code Analysis** (NEW in v2.4.0): Professional-grade static analysis tools
|
|
86
|
+
- **Dependency Analyzer**: Detect circular dependencies, calculate coupling metrics, identify orphan and hub files
|
|
87
|
+
- **Code Smell Detector**: Find 10+ anti-patterns (long methods, large classes, duplicates, dead code, etc.)
|
|
88
|
+
- **Hotspot Analyzer**: Identify frequently changing, complex code using git history analysis
|
|
89
|
+
- **Metrics Calculator**: Cyclomatic complexity, Halstead metrics, Maintainability Index (MI)
|
|
90
|
+
- **Security Scanner**: Detect SQL injection, XSS, path traversal, hardcoded secrets, and more
|
|
91
|
+
- **[Complete Guide](docs/analysis-tools.md)** and **[API Documentation](docs/api/analyzers.md)**
|
|
85
92
|
|
|
86
93
|
### Max Tokens Configuration
|
|
87
94
|
|
|
@@ -350,6 +357,60 @@ ax-cli usage reset
|
|
|
350
357
|
|
|
351
358
|
[CLI Reference →](docs/cli-reference.md) | [Usage Guide →](docs/usage.md)
|
|
352
359
|
|
|
360
|
+
## 📋 Working with Large Content
|
|
361
|
+
|
|
362
|
+
When working with large amounts of text (logs, code files, documentation), use **file-based workflows** instead of pasting directly into the terminal.
|
|
363
|
+
|
|
364
|
+
### ⚠️ Terminal Paste Limitations
|
|
365
|
+
|
|
366
|
+
**Avoid pasting large content directly** into the interactive terminal:
|
|
367
|
+
|
|
368
|
+
- ❌ **DON'T**: Paste large code files, logs, or documents (>2000 characters)
|
|
369
|
+
- ⚠️ Some terminals may have paste limitations
|
|
370
|
+
- ⚠️ Character counter shows visual warning: Gray (0-999) → Cyan (1000-1599) → Yellow (1600-1999) → **Red (2000+)**
|
|
371
|
+
|
|
372
|
+
### ✅ Recommended Approaches
|
|
373
|
+
|
|
374
|
+
**Option 1: File Reference (Interactive Mode)**
|
|
375
|
+
```bash
|
|
376
|
+
# Save your content to a file first
|
|
377
|
+
cat > context.txt
|
|
378
|
+
# (paste content, then Ctrl+D)
|
|
379
|
+
|
|
380
|
+
# Then use memory commands
|
|
381
|
+
ax-cli
|
|
382
|
+
> /memory add context.txt
|
|
383
|
+
> analyze the content I just added
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Option 2: Headless Mode with File Input**
|
|
387
|
+
```bash
|
|
388
|
+
# Direct file processing
|
|
389
|
+
ax-cli --prompt "analyze this: $(cat large-file.txt)"
|
|
390
|
+
|
|
391
|
+
# Or use the --file flag
|
|
392
|
+
ax-cli --file path/to/code.ts --prompt "review this code"
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Option 3: Use `/memory` Commands**
|
|
396
|
+
```bash
|
|
397
|
+
# In interactive mode
|
|
398
|
+
> /memory add src/
|
|
399
|
+
> /memory add logs/error.log
|
|
400
|
+
> analyze the errors in the log file
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Character Count Guide
|
|
404
|
+
|
|
405
|
+
The interactive terminal shows a character counter `[count/2000]` with color-coded warnings:
|
|
406
|
+
|
|
407
|
+
| Color | Range | Recommendation |
|
|
408
|
+
|-------|-------|----------------|
|
|
409
|
+
| **Gray** | 0-999 | ✅ Optimal length |
|
|
410
|
+
| **Cyan** | 1000-1599 | ⚠️ Getting long |
|
|
411
|
+
| **Yellow** | 1600-1999 | ⚠️ Consider using files |
|
|
412
|
+
| **Red** | 2000+ | ❌ Use file-based workflow |
|
|
413
|
+
|
|
353
414
|
## 🏥 Health Check & Diagnostics (NEW)
|
|
354
415
|
|
|
355
416
|
Run comprehensive diagnostics to verify your AX CLI configuration:
|
|
@@ -679,6 +740,52 @@ AX CLI implements enterprise-grade architecture with:
|
|
|
679
740
|
- [Development](docs/development.md) - Development and contribution guide
|
|
680
741
|
- [Troubleshooting](docs/troubleshooting.md) - Common issues and solutions
|
|
681
742
|
|
|
743
|
+
## 📋 Changelog
|
|
744
|
+
|
|
745
|
+
### v3.5.3 (2025-11-22)
|
|
746
|
+
|
|
747
|
+
**Bug Fixes - Test Quality & Reliability:**
|
|
748
|
+
- Fixed unhandled promise rejection in subagent tests that caused Node.js warnings
|
|
749
|
+
- Replaced meaningless test assertions (`expect(true).toBe(true)`) with real validation
|
|
750
|
+
- Properly skipped untestable tests with clear TODO documentation
|
|
751
|
+
- Fixed flaky performance test by adjusting timing threshold (0.9x instead of 0.7x)
|
|
752
|
+
|
|
753
|
+
**Test Suite Improvements:**
|
|
754
|
+
- Improved test isolation and error handling patterns
|
|
755
|
+
- Enhanced performance test reliability for CI/CD environments
|
|
756
|
+
- Better documentation of test limitations
|
|
757
|
+
- All 1,038 tests passing (1,036 passed + 2 properly skipped)
|
|
758
|
+
|
|
759
|
+
**Code Quality:**
|
|
760
|
+
- Comprehensive test quality analysis across all test files
|
|
761
|
+
- Eliminated false confidence from placeholder tests
|
|
762
|
+
- Maintained 98%+ test coverage with genuine validation
|
|
763
|
+
|
|
764
|
+
### v3.5.2 (2025-11-22)
|
|
765
|
+
|
|
766
|
+
**Bug Fixes - Resource Leak Prevention:**
|
|
767
|
+
- Fixed uncleaned nested timeout in bash tool that held process references after exit
|
|
768
|
+
- Fixed uncleaned timeout in MCP URL validation causing 3-second memory leaks
|
|
769
|
+
- Added `.unref()` to background cleanup timers to prevent GC blocking
|
|
770
|
+
- Added try-finally blocks for guaranteed timeout cleanup in error scenarios
|
|
771
|
+
|
|
772
|
+
**Bug Fixes - Platform Compatibility:**
|
|
773
|
+
- Fixed Windows home directory bug in command history (used `os.homedir()` instead of `"~"` fallback)
|
|
774
|
+
|
|
775
|
+
**Code Quality:**
|
|
776
|
+
- Comprehensive resource leak analysis across 78+ potential issues
|
|
777
|
+
- Improved timeout cleanup patterns following Node.js best practices
|
|
778
|
+
- Enhanced memory management for better garbage collection
|
|
779
|
+
|
|
780
|
+
### v3.5.0
|
|
781
|
+
|
|
782
|
+
**Features:**
|
|
783
|
+
- Multi-phase task planner with automatic complexity detection
|
|
784
|
+
- Enhanced MCP integration with production-ready templates
|
|
785
|
+
- Project memory system with intelligent context caching
|
|
786
|
+
- Web search capabilities with Tavily AI and Brave Search
|
|
787
|
+
- Advanced code analysis tools (dependency, security, metrics)
|
|
788
|
+
|
|
682
789
|
## 📄 License
|
|
683
790
|
|
|
684
791
|
MIT License - see [LICENSE](LICENSE) for details
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST Analysis Module
|
|
3
|
+
*
|
|
4
|
+
* Provides TypeScript/JavaScript AST parsing and traversal utilities
|
|
5
|
+
*/
|
|
6
|
+
export { ASTParser } from './parser.js';
|
|
7
|
+
export * from './types.js';
|
|
8
|
+
export * from './node-helpers.js';
|
|
9
|
+
export * from './traverser.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/analyzers/ast/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST Node Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* Type guards and utility functions for working with AST nodes
|
|
5
|
+
*/
|
|
6
|
+
import type { FunctionInfo, ClassInfo, MethodInfo, ImportInfo } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Check if function is a high-complexity function
|
|
9
|
+
*/
|
|
10
|
+
export declare function isHighComplexity(func: FunctionInfo, threshold?: number): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Check if function is a long function
|
|
13
|
+
*/
|
|
14
|
+
export declare function isLongFunction(func: FunctionInfo, threshold?: number): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Check if class is a large class (God Object indicator)
|
|
17
|
+
*/
|
|
18
|
+
export declare function isLargeClass(cls: ClassInfo, methodThreshold?: number, lineThreshold?: number): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Check if method has too many parameters
|
|
21
|
+
*/
|
|
22
|
+
export declare function hasTooManyParameters(method: MethodInfo | FunctionInfo, threshold?: number): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Get all external imports (from node_modules)
|
|
25
|
+
*/
|
|
26
|
+
export declare function getExternalImports(imports: readonly ImportInfo[]): ImportInfo[];
|
|
27
|
+
/**
|
|
28
|
+
* Get all internal imports (relative paths)
|
|
29
|
+
*/
|
|
30
|
+
export declare function getInternalImports(imports: readonly ImportInfo[]): ImportInfo[];
|
|
31
|
+
/**
|
|
32
|
+
* Calculate class coupling (number of external dependencies)
|
|
33
|
+
*/
|
|
34
|
+
export declare function calculateClassCoupling(imports: readonly ImportInfo[]): number;
|
|
35
|
+
/**
|
|
36
|
+
* Find all async functions in a list
|
|
37
|
+
*/
|
|
38
|
+
export declare function getAsyncFunctions(functions: readonly FunctionInfo[]): FunctionInfo[];
|
|
39
|
+
/**
|
|
40
|
+
* Find all exported functions
|
|
41
|
+
*/
|
|
42
|
+
export declare function getExportedFunctions(functions: readonly FunctionInfo[]): FunctionInfo[];
|
|
43
|
+
/**
|
|
44
|
+
* Get average complexity of functions
|
|
45
|
+
*/
|
|
46
|
+
export declare function getAverageComplexity(functions: readonly FunctionInfo[]): number;
|
|
47
|
+
/**
|
|
48
|
+
* Get average function length
|
|
49
|
+
*/
|
|
50
|
+
export declare function getAverageFunctionLength(functions: readonly FunctionInfo[]): number;
|
|
51
|
+
/**
|
|
52
|
+
* Find all private methods in a class
|
|
53
|
+
*/
|
|
54
|
+
export declare function getPrivateMethods(cls: ClassInfo): MethodInfo[];
|
|
55
|
+
/**
|
|
56
|
+
* Find all public methods in a class
|
|
57
|
+
*/
|
|
58
|
+
export declare function getPublicMethods(cls: ClassInfo): MethodInfo[];
|
|
59
|
+
/**
|
|
60
|
+
* Find all static methods in a class
|
|
61
|
+
*/
|
|
62
|
+
export declare function getStaticMethods(cls: ClassInfo): MethodInfo[];
|
|
63
|
+
/**
|
|
64
|
+
* Calculate method density (methods per line)
|
|
65
|
+
*/
|
|
66
|
+
export declare function calculateMethodDensity(cls: ClassInfo): number;
|
|
67
|
+
/**
|
|
68
|
+
* Check if import is a type-only import
|
|
69
|
+
*/
|
|
70
|
+
export declare function isTypeOnlyImport(imp: ImportInfo): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Group imports by external/internal
|
|
73
|
+
*/
|
|
74
|
+
export declare function groupImportsByType(imports: readonly ImportInfo[]): {
|
|
75
|
+
external: ImportInfo[];
|
|
76
|
+
internal: ImportInfo[];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Calculate cognitive complexity score for a file
|
|
80
|
+
*/
|
|
81
|
+
export declare function calculateFileCognitiveComplexity(functions: readonly FunctionInfo[], classes: readonly ClassInfo[]): number;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST Node Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* Type guards and utility functions for working with AST nodes
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if function is a high-complexity function
|
|
8
|
+
*/
|
|
9
|
+
export function isHighComplexity(func, threshold = 10) {
|
|
10
|
+
return func.complexity > threshold;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Check if function is a long function
|
|
14
|
+
*/
|
|
15
|
+
export function isLongFunction(func, threshold = 50) {
|
|
16
|
+
return func.length > threshold;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Check if class is a large class (God Object indicator)
|
|
20
|
+
*/
|
|
21
|
+
export function isLargeClass(cls, methodThreshold = 20, lineThreshold = 300) {
|
|
22
|
+
return cls.methods.length > methodThreshold || cls.length > lineThreshold;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Check if method has too many parameters
|
|
26
|
+
*/
|
|
27
|
+
export function hasTooManyParameters(method, threshold = 5) {
|
|
28
|
+
return method.parameters.length > threshold;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get all external imports (from node_modules)
|
|
32
|
+
*/
|
|
33
|
+
export function getExternalImports(imports) {
|
|
34
|
+
return imports.filter(imp => imp.isExternal);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all internal imports (relative paths)
|
|
38
|
+
*/
|
|
39
|
+
export function getInternalImports(imports) {
|
|
40
|
+
return imports.filter(imp => !imp.isExternal);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Calculate class coupling (number of external dependencies)
|
|
44
|
+
*/
|
|
45
|
+
export function calculateClassCoupling(imports) {
|
|
46
|
+
const external = getExternalImports(imports);
|
|
47
|
+
return external.length;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Find all async functions in a list
|
|
51
|
+
*/
|
|
52
|
+
export function getAsyncFunctions(functions) {
|
|
53
|
+
return functions.filter(f => f.isAsync);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Find all exported functions
|
|
57
|
+
*/
|
|
58
|
+
export function getExportedFunctions(functions) {
|
|
59
|
+
return functions.filter(f => f.isExported);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get average complexity of functions
|
|
63
|
+
*/
|
|
64
|
+
export function getAverageComplexity(functions) {
|
|
65
|
+
if (functions.length === 0)
|
|
66
|
+
return 0;
|
|
67
|
+
const total = functions.reduce((sum, f) => sum + f.complexity, 0);
|
|
68
|
+
return total / functions.length;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get average function length
|
|
72
|
+
*/
|
|
73
|
+
export function getAverageFunctionLength(functions) {
|
|
74
|
+
if (functions.length === 0)
|
|
75
|
+
return 0;
|
|
76
|
+
const total = functions.reduce((sum, f) => sum + f.length, 0);
|
|
77
|
+
return total / functions.length;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Find all private methods in a class
|
|
81
|
+
*/
|
|
82
|
+
export function getPrivateMethods(cls) {
|
|
83
|
+
return cls.methods.filter(m => m.visibility === 'private');
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Find all public methods in a class
|
|
87
|
+
*/
|
|
88
|
+
export function getPublicMethods(cls) {
|
|
89
|
+
return cls.methods.filter(m => m.visibility === 'public');
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Find all static methods in a class
|
|
93
|
+
*/
|
|
94
|
+
export function getStaticMethods(cls) {
|
|
95
|
+
return cls.methods.filter(m => m.isStatic);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Calculate method density (methods per line)
|
|
99
|
+
*/
|
|
100
|
+
export function calculateMethodDensity(cls) {
|
|
101
|
+
if (cls.length === 0)
|
|
102
|
+
return 0;
|
|
103
|
+
return cls.methods.length / cls.length;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Check if import is a type-only import
|
|
107
|
+
*/
|
|
108
|
+
export function isTypeOnlyImport(imp) {
|
|
109
|
+
return imp.namedImports.every(name => name.startsWith('type ') || name.includes('Type'));
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Group imports by external/internal
|
|
113
|
+
*/
|
|
114
|
+
export function groupImportsByType(imports) {
|
|
115
|
+
return {
|
|
116
|
+
external: getExternalImports(imports),
|
|
117
|
+
internal: getInternalImports(imports),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Calculate cognitive complexity score for a file
|
|
122
|
+
*/
|
|
123
|
+
export function calculateFileCognitiveComplexity(functions, classes) {
|
|
124
|
+
const funcComplexity = functions.reduce((sum, f) => sum + f.complexity, 0);
|
|
125
|
+
const methodComplexity = classes.reduce((sum, c) => sum + c.methods.reduce((mSum, m) => mSum + m.complexity, 0), 0);
|
|
126
|
+
return funcComplexity + methodComplexity;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=node-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-helpers.js","sourceRoot":"","sources":["../../../src/analyzers/ast/node-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAkB,EAAE,YAAoB,EAAE;IACzE,OAAO,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAkB,EAAE,YAAoB,EAAE;IACvE,OAAO,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAc,EAAE,kBAA0B,EAAE,EAAE,gBAAwB,GAAG;IACpG,OAAO,GAAG,CAA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CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAC3F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAA8B;IAI/D,OAAO;QACL,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC;QACrC,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC;KACtC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC9C,SAAkC,EAClC,OAA6B;IAE7B,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC3E,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CACrC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,EACvE,CAAC,CACF,CAAC;IACF,OAAO,cAAc,GAAG,gBAAgB,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST Parser
|
|
3
|
+
*
|
|
4
|
+
* Provides TypeScript/JavaScript AST parsing using ts-morph
|
|
5
|
+
*/
|
|
6
|
+
import { SourceFile } from 'ts-morph';
|
|
7
|
+
import type { FileASTInfo } from './types.js';
|
|
8
|
+
export declare class ASTParser {
|
|
9
|
+
private project;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Parse a TypeScript/JavaScript file
|
|
13
|
+
*/
|
|
14
|
+
parseFile(filePath: string): FileASTInfo;
|
|
15
|
+
/**
|
|
16
|
+
* Parse file content directly
|
|
17
|
+
*/
|
|
18
|
+
parseContent(content: string, filePath?: string): FileASTInfo;
|
|
19
|
+
/**
|
|
20
|
+
* Extract all functions from source file
|
|
21
|
+
*/
|
|
22
|
+
private extractFunctions;
|
|
23
|
+
/**
|
|
24
|
+
* Extract all classes from source file
|
|
25
|
+
*/
|
|
26
|
+
private extractClasses;
|
|
27
|
+
/**
|
|
28
|
+
* Extract methods from a class
|
|
29
|
+
*/
|
|
30
|
+
private extractMethods;
|
|
31
|
+
/**
|
|
32
|
+
* Extract properties from a class
|
|
33
|
+
*/
|
|
34
|
+
private extractProperties;
|
|
35
|
+
/**
|
|
36
|
+
* Extract parameters from a function or method
|
|
37
|
+
*/
|
|
38
|
+
private extractParameters;
|
|
39
|
+
/**
|
|
40
|
+
* Extract imports from source file
|
|
41
|
+
*/
|
|
42
|
+
private extractImports;
|
|
43
|
+
/**
|
|
44
|
+
* Extract exports from source file
|
|
45
|
+
*/
|
|
46
|
+
private extractExports;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate cyclomatic complexity (simplified)
|
|
49
|
+
*/
|
|
50
|
+
private calculateCyclomaticComplexity;
|
|
51
|
+
/**
|
|
52
|
+
* Get raw source file for advanced operations
|
|
53
|
+
*/
|
|
54
|
+
getSourceFile(filePath: string): SourceFile;
|
|
55
|
+
/**
|
|
56
|
+
* Clear project cache
|
|
57
|
+
*/
|
|
58
|
+
clear(): void;
|
|
59
|
+
}
|