@tng-sh/js 0.1.4 → 0.1.5
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 +46 -36
- package/bin/tng.js +2 -2
- package/binaries/go-ui-darwin-amd64 +0 -0
- package/binaries/go-ui-darwin-arm64 +0 -0
- package/binaries/go-ui-linux-amd64 +0 -0
- package/binaries/go-ui-linux-arm64 +0 -0
- package/{tng_sh_js.darwin-arm64.node → index.darwin-arm64.node} +0 -0
- package/{tng_sh_js.darwin-x64.node → index.darwin-x64.node} +0 -0
- package/{tng_sh_js.linux-arm64-gnu.node → index.linux-arm64-gnu.node} +0 -0
- package/{tng_sh_js.linux-x64-gnu.node → index.linux-x64-gnu.node} +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,69 +4,79 @@ High-performance test generation and context analysis for JavaScript/TypeScript,
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
+
Install the package as a development dependency in your project:
|
|
8
|
+
|
|
7
9
|
```bash
|
|
8
10
|
npm install @tng-sh/js --save-dev
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Usage
|
|
12
14
|
|
|
13
15
|
### 1. Initialize
|
|
14
|
-
|
|
16
|
+
First, run the init command to create a `tng.config.js` configuration file. This file stores your API keys and project settings.
|
|
15
17
|
|
|
16
18
|
```bash
|
|
17
|
-
npx
|
|
19
|
+
npx tng init
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
### 2.
|
|
21
|
-
|
|
22
|
+
### 2. Interactive Mode (TUI)
|
|
23
|
+
The most powerful way to use TNG is via the high-performance terminal interface. It provides a guided experience for all analysis tasks.
|
|
22
24
|
|
|
23
25
|
```bash
|
|
24
|
-
npx
|
|
26
|
+
npx tng i
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Capabilities in TUI:**
|
|
30
|
+
* **Generate Tests**: Guided test creation for methods, components, and utilities.
|
|
31
|
+
* **Audit Method**: Deep security, performance, and best-practice auditing.
|
|
32
|
+
* **Trace Method**: Symbolic execution and logic flow visualization.
|
|
33
|
+
* **X-Ray Method**: Deep dependency and side-effect analysis.
|
|
34
|
+
* **Check Duplicates**: High-performance clone detection across the codebase.
|
|
35
|
+
* **Dead Code**: Identify unreachable logic and unused variables/parameters.
|
|
36
|
+
* **User Stats**: Review your usage metrics and generation history.
|
|
37
|
+
|
|
38
|
+
### 3. Command Line Interface (CLI) ⚙️
|
|
39
|
+
For direct execution or integration into scripts.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# See file outline and method list
|
|
43
|
+
npx tng -f path/to/file.js --outline
|
|
44
|
+
|
|
45
|
+
# Generate tests for a specific method
|
|
46
|
+
npx tng -f path/to/file.js -m functionName -t react_component
|
|
47
|
+
|
|
48
|
+
# Check for code clones
|
|
49
|
+
npx tng -f path/to/file.js --clones
|
|
25
50
|
```
|
|
26
51
|
|
|
27
52
|
**Supported Types (`-t`):**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
- `
|
|
31
|
-
|
|
32
|
-
- `orm_model`
|
|
33
|
-
- `background_job`
|
|
34
|
-
- `mailer`
|
|
35
|
-
- `utility`
|
|
36
|
-
|
|
37
|
-
### 3. Interactive Mode
|
|
38
|
-
Launch the interactive UI to explore and generate tests visually:
|
|
53
|
+
`react_component`, `express_handler`, `graphql_resolver`, `nest_js`, `orm_model`, `background_job`, `mailer`, `utility`.
|
|
54
|
+
|
|
55
|
+
### 4. Machine-Readable Output (`--json`) 🤖
|
|
56
|
+
Add the `--json` flag to any command to receive output as structured JSON events. This is ideal for CI/CD pipelines or custom integrations.
|
|
39
57
|
|
|
40
58
|
```bash
|
|
41
|
-
npx -
|
|
59
|
+
npx tng -f path/to/file.js --clones --json
|
|
42
60
|
```
|
|
43
61
|
|
|
44
62
|
## Features
|
|
45
63
|
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
64
|
+
- **Oxc-Powered**: Blazing fast AST analysis using the industry-leading Rust parser.
|
|
65
|
+
- **Multi-Platform**: Native support for macOS (Intel/ARM) and Linux (x64/ARM64).
|
|
66
|
+
- **Prettier Integration**: Automatically formats generated code to match your existing style.
|
|
67
|
+
- **TypeScript Native**: First-class support for `.ts` and `.tsx` analysis and generation.
|
|
50
68
|
|
|
51
|
-
## Configuration
|
|
69
|
+
## ⚙️ Configuration
|
|
52
70
|
|
|
53
|
-
|
|
71
|
+
Your `tng.config.js` allows for full customization:
|
|
54
72
|
|
|
55
73
|
```javascript
|
|
56
74
|
module.exports = {
|
|
57
|
-
// API Configuration
|
|
58
75
|
API_KEY: "your-api-key-here",
|
|
59
76
|
API_URL: "https://app.tng.sh/",
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
// Options:
|
|
63
|
-
FRAMEWORK: "express",
|
|
64
|
-
|
|
65
|
-
// Testing Configuration
|
|
66
|
-
// Options: jest, mocha, vitest
|
|
67
|
-
TEST_FRAMEWORK: "jest",
|
|
68
|
-
|
|
69
|
-
// Test Directory
|
|
70
|
-
TEST_DIRECTORY: "tests"
|
|
77
|
+
FRAMEWORK: "express", // Options: express, nextjs, nestjs, generic
|
|
78
|
+
TESTS_PATH: "tests", // Where to save generated tests
|
|
79
|
+
TEST_FRAMEWORK: "jest" // Options: jest, mocha, vitest
|
|
71
80
|
};
|
|
72
81
|
```
|
|
82
|
+
|
package/bin/tng.js
CHANGED
|
@@ -27,8 +27,8 @@ process.on('uncaughtException', (err) => {
|
|
|
27
27
|
|
|
28
28
|
program
|
|
29
29
|
.name('tng')
|
|
30
|
-
.description('TNG - Automated Test Generation, and
|
|
31
|
-
.version('0.1.
|
|
30
|
+
.description('TNG - Automated Test Generation, and Audit generation for JavaScript')
|
|
31
|
+
.version('0.1.5');
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @command init
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|