entkapp 5.5.0 â 5.6.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.
- package/README.md +1 -1
- package/bin/cli.js +2 -2
- package/bin/cli.mjs +175 -0
- package/index.cjs +18 -0
- package/index.mjs +51 -0
- package/package.json +7 -6
- package/src/EngineContext.mjs +428 -0
- package/src/Initializer.mjs +82 -0
- package/src/analyzers/CodeSmellAnalyzer.mjs +106 -0
- package/src/analyzers/OxcAnalyzer.mjs +11 -0
- package/src/api/HeadlessAPI.js +31 -16
- package/src/api/HeadlessAPI.mjs +369 -0
- package/src/api/PluginSDK.mjs +135 -0
- package/src/ast/ASTAnalyzer.js +17 -3
- package/src/ast/ASTAnalyzer.mjs +742 -0
- package/src/ast/AdvancedAnalysis.mjs +586 -0
- package/src/ast/BarrelParser.mjs +230 -0
- package/src/ast/DeadCodeDetector.js +7 -5
- package/src/ast/DeadCodeDetector.mjs +92 -0
- package/src/ast/MagicDetector.mjs +203 -0
- package/src/ast/OxcAnalyzer.mjs +188 -0
- package/src/ast/SecretScanner.mjs +374 -0
- package/src/healing/GitSandbox.mjs +82 -0
- package/src/healing/SelfHealer.mjs +48 -0
- package/src/index.js +37 -1
- package/src/index.mjs +1180 -0
- package/src/performance/GraphCache.mjs +108 -0
- package/src/performance/SupplyChainGuard.mjs +92 -0
- package/src/performance/WorkerPool.mjs +132 -0
- package/src/performance/WorkerTaskRunner.mjs +144 -0
- package/src/plugins/BasePlugin.mjs +240 -0
- package/src/plugins/PluginRegistry.mjs +203 -0
- package/src/plugins/ecosystems/BackendServices.mjs +197 -0
- package/src/plugins/ecosystems/GenericPlugins.mjs +142 -0
- package/src/plugins/ecosystems/ModernFrameworks.mjs +162 -0
- package/src/plugins/ecosystems/MorePlugins.mjs +562 -0
- package/src/plugins/ecosystems/NewPlugins.mjs +526 -0
- package/src/plugins/ecosystems/NextJsPlugin.mjs +45 -0
- package/src/plugins/ecosystems/PluginLoader.mjs +193 -0
- package/src/plugins/ecosystems/TypeScriptPlugin.mjs +56 -0
- package/src/plugins/ecosystems/UltimateBundle.mjs +1182 -0
- package/src/refractor/ImpactAnalyzer.mjs +92 -0
- package/src/refractor/SourceRewriter.mjs +86 -0
- package/src/refractor/TransactionManager.mjs +5 -0
- package/src/refractor/TypeIntegrity.mjs +4 -0
- package/src/resolution/BuildOrchestrator.mjs +46 -0
- package/src/resolution/CircularDetector.mjs +91 -0
- package/src/resolution/ConfigGenerator.mjs +83 -0
- package/src/resolution/ConfigLoader.mjs +94 -0
- package/src/resolution/DepencyResolver.mjs +66 -0
- package/src/resolution/DependencyFixer.mjs +88 -0
- package/src/resolution/DependencyProfiler.mjs +286 -0
- package/src/resolution/EntryPointDetector.mjs +134 -0
- package/src/resolution/FrameworkConfigParser.mjs +119 -0
- package/src/resolution/GraphAnalyzer.mjs +80 -0
- package/src/resolution/MigrationAnalyzer.mjs +60 -0
- package/src/resolution/PathMapper.mjs +82 -0
- package/src/resolution/TSConfigLoader.mjs +162 -0
- package/src/resolution/WorkSpaceGraph.mjs +183 -0
- package/src/resolution/WorkspaceDiagnostic.mjs +139 -0
- package/test.js +76 -0
- package/wrangler.toml +6 -0
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ async function bootstrap() {
|
|
|
28
28
|
program
|
|
29
29
|
.name('entkapp')
|
|
30
30
|
.description(ansis.cyan('The Ultimate Enterprise Codebase Janitor with OXC integration, type-aware analysis, and automated structural healing.'))
|
|
31
|
-
.version(packageJsonContent.version || '5.
|
|
31
|
+
.version(packageJsonContent.version || '5.6.0');
|
|
32
32
|
|
|
33
33
|
program
|
|
34
34
|
.option('-c, --cwd <path>', 'Specify the execution context root directory', process.cwd())
|
|
@@ -132,7 +132,7 @@ async function bootstrap() {
|
|
|
132
132
|
}, timeoutMs);
|
|
133
133
|
timeoutTimer.unref(); // Allow process to exit if work finishes
|
|
134
134
|
|
|
135
|
-
console.log(ansis.bold.green(`\nđŚ entkapp v${packageJsonContent.version || '5.
|
|
135
|
+
console.log(ansis.bold.green(`\nđŚ entkapp v${packageJsonContent.version || '5.6.0'} Engine Activation`));
|
|
136
136
|
console.log(ansis.dim('------------------------------------------------------------'));
|
|
137
137
|
console.log(`${ansis.bold('Target Workspace Root :')} ${ansis.blue(targetCwd)}`);
|
|
138
138
|
console.log(`${ansis.bold('Refactoring Mode :')} ${options.fix ? ansis.yellow('Active Fixing & Self-Healing Enabled') : ansis.gray('Dry-Run Reporting Only')}`);
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ============================================================================
|
|
5
|
+
* đ loui CLI Entry Point
|
|
6
|
+
* ============================================================================
|
|
7
|
+
* Handles option compilation, environment orchestration, option validation,
|
|
8
|
+
* and initiates the primary operational pipeline loop.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Command } from 'commander';
|
|
12
|
+
import ansis from 'ansis';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import fs from 'fs/promises';
|
|
15
|
+
import { fileURLToPath } from 'url';
|
|
16
|
+
import readline from 'readline/promises';
|
|
17
|
+
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = path.dirname(__filename);
|
|
20
|
+
|
|
21
|
+
const program = new Command();
|
|
22
|
+
|
|
23
|
+
async function bootstrap() {
|
|
24
|
+
try {
|
|
25
|
+
const packageJsonPath = path.resolve(__dirname, '../package.json');
|
|
26
|
+
const packageJsonContent = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
|
|
27
|
+
|
|
28
|
+
program
|
|
29
|
+
.name('entkapp')
|
|
30
|
+
.description(ansis.cyan('The Ultimate Enterprise Codebase Janitor with OXC integration, type-aware analysis, and automated structural healing.'))
|
|
31
|
+
.version(packageJsonContent.version || '5.6.0');
|
|
32
|
+
|
|
33
|
+
program
|
|
34
|
+
.option('-c, --cwd <path>', 'Specify the execution context root directory', process.cwd())
|
|
35
|
+
.option('-d, --debug', 'Developer`s comprehensive telemetry debug diagnostics', false)
|
|
36
|
+
.option('--fix', 'Enable atomic code updates, structural file pruning, and active type sanitization', false)
|
|
37
|
+
.option('--tsconfig <filename>', 'Specify path to custom layout configurations', 'tsconfig.json')
|
|
38
|
+
.option('--test-command <command>', 'Integrated continuous safety test validation script execution path', 'npm test')
|
|
39
|
+
.option('--workspace', 'Enable high-density workspace workspace/monorepo cluster mesh evaluation parsing', false)
|
|
40
|
+
.option('--verbose', 'Toggle expanded trace telemetry for debug operational diagnostics', false)
|
|
41
|
+
.option('--visualize', 'Generate an interactive execution graph visualization', false)
|
|
42
|
+
.option('-r, --run', 'Execute the primary operational pipeline loop', false)
|
|
43
|
+
.option('-y, --yes', 'Skip confirmation prompts and execute planned structural modifications automatically', false)
|
|
44
|
+
.option('--timeout <ms>', 'Set execution timeout in milliseconds', '30000');
|
|
45
|
+
|
|
46
|
+
program.parse(process.argv);
|
|
47
|
+
const options = program.opts();
|
|
48
|
+
|
|
49
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
50
|
+
|
|
51
|
+
// --- Onboarding Check (Skipped in Non-Interactive Mode) ---
|
|
52
|
+
// FIX: Ensure options.cwd is always a string, never undefined
|
|
53
|
+
const targetCwd = path.resolve(options.cwd || process.cwd());
|
|
54
|
+
const pkgJsonPath = path.join(targetCwd, 'package.json');
|
|
55
|
+
const configDirPath = path.join(targetCwd, 'entkapp');
|
|
56
|
+
|
|
57
|
+
let pkgJson;
|
|
58
|
+
try {
|
|
59
|
+
pkgJson = JSON.parse(await fs.readFile(pkgJsonPath, 'utf8'));
|
|
60
|
+
} catch (e) {}
|
|
61
|
+
|
|
62
|
+
let configInstalled = false;
|
|
63
|
+
if (!options.yes && !options.run) {
|
|
64
|
+
// 1. Ask to install script
|
|
65
|
+
if (pkgJson && !pkgJson.scripts?.['entkapp:run']) {
|
|
66
|
+
const answer = await rl.question(ansis.bold.yellow('â No "entkapp:run" script found in package.json. Install it? (y/n): '));
|
|
67
|
+
if (answer.toLowerCase() === 'y') {
|
|
68
|
+
pkgJson.scripts = pkgJson.scripts || {};
|
|
69
|
+
pkgJson.scripts['entkapp:run'] = 'npx entkapp --fix';
|
|
70
|
+
await fs.writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
71
|
+
console.log(ansis.green('â
"entkapp:run" script added to package.json.'));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 2. Ask to install config folder
|
|
76
|
+
try {
|
|
77
|
+
await fs.access(configDirPath);
|
|
78
|
+
configInstalled = true;
|
|
79
|
+
} catch (e) {
|
|
80
|
+
const answer = await rl.question(ansis.bold.yellow('â No "/entkapp" configuration folder found. Create it with defaults? (y/n): '));
|
|
81
|
+
if (answer.toLowerCase() === 'y') {
|
|
82
|
+
await fs.mkdir(configDirPath, { recursive: true });
|
|
83
|
+
await fs.mkdir(path.join(configDirPath, 'plugins'), { recursive: true });
|
|
84
|
+
const defaultConfig = {
|
|
85
|
+
interface: "CLI",
|
|
86
|
+
useBuiltinPlugins: true,
|
|
87
|
+
useCustomPlugins: true,
|
|
88
|
+
|
|
89
|
+
options: { verbose: false, fastMode: true, selfHealing: true },
|
|
90
|
+
enabledPlugins: ["nextjs", "nuxt", "remix", "sveltekit", "astro"]
|
|
91
|
+
};
|
|
92
|
+
await fs.writeFile(path.join(configDirPath, 'config.json'), JSON.stringify(defaultConfig, null, 2));
|
|
93
|
+
console.log(ansis.green('â
"/entkapp" folder? and default config created.'));
|
|
94
|
+
configInstalled = true;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (pkgJson?.scripts?.['entkapp:run'] || configInstalled) {
|
|
99
|
+
console.log(ansis.bold.cyan('\nđ Setup complete! To start the engine, run:'));
|
|
100
|
+
console.log(ansis.white(` - npx entkapp -r`));
|
|
101
|
+
console.log(ansis.white(` - npm run entkapp:run\n`));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
rl.close();
|
|
106
|
+
|
|
107
|
+
// Load local config if available
|
|
108
|
+
let localConfig = {};
|
|
109
|
+
try {
|
|
110
|
+
const { ConfigLoader } = await import('../src/resolution/ConfigLoader.mjs');
|
|
111
|
+
const loader = new ConfigLoader(targetCwd);
|
|
112
|
+
localConfig = await loader.loadConfig();
|
|
113
|
+
} catch (e) {}
|
|
114
|
+
|
|
115
|
+
// Merge options with local config
|
|
116
|
+
const finalInterface = localConfig.interface || 'CLI';
|
|
117
|
+
if (finalInterface === 'GUI') {
|
|
118
|
+
console.log(ansis.bold.magenta('đ¨ GUI Mode Detected. Starting Web Interface...'));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Only proceed to execution if -r/--run is provided
|
|
123
|
+
if (!options.run) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// --- Timeout Handling ---
|
|
128
|
+
const timeoutMs = parseInt(options.timeout);
|
|
129
|
+
const timeoutTimer = setTimeout(() => {
|
|
130
|
+
console.error(ansis.bold.red(`\nđ¨ Execution Timeout: The process exceeded the limit of ${timeoutMs}ms.`));
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}, timeoutMs);
|
|
133
|
+
timeoutTimer.unref(); // Allow process to exit if work finishes
|
|
134
|
+
|
|
135
|
+
console.log(ansis.bold.green(`\nđŚ entkapp v${packageJsonContent.version || '5.6.0'} Engine Activation`));
|
|
136
|
+
console.log(ansis.dim('------------------------------------------------------------'));
|
|
137
|
+
console.log(`${ansis.bold('Target Workspace Root :')} ${ansis.blue(targetCwd)}`);
|
|
138
|
+
console.log(`${ansis.bold('Refactoring Mode :')} ${options.fix ? ansis.yellow('Active Fixing & Self-Healing Enabled') : ansis.gray('Dry-Run Reporting Only')}`);
|
|
139
|
+
console.log(`${ansis.bold('Validation Sandbox :')} ${ansis.magenta(options.testCommand)}`);
|
|
140
|
+
console.log(ansis.dim('------------------------------------------------------------\n'));
|
|
141
|
+
|
|
142
|
+
const { RefactoringEngine } = await import('../src/index.mjs');
|
|
143
|
+
|
|
144
|
+
const engine = new RefactoringEngine({
|
|
145
|
+
cwd: targetCwd,
|
|
146
|
+
autoFix: options.fix,
|
|
147
|
+
tsconfig: options.tsconfig,
|
|
148
|
+
testCommand: options.testCommand,
|
|
149
|
+
workspace: options.workspace,
|
|
150
|
+
verbose: options.verbose,
|
|
151
|
+
skipConfirm: options.yes,
|
|
152
|
+
// Pass through local config settings
|
|
153
|
+
entryPoints: localConfig.entryPoints,
|
|
154
|
+
exclude: localConfig.exclude,
|
|
155
|
+
rules: localConfig.rules,
|
|
156
|
+
debug: options.debug,
|
|
157
|
+
visualize: options.visualize,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
await engine.run();
|
|
161
|
+
|
|
162
|
+
clearTimeout(timeoutTimer);
|
|
163
|
+
console.log(ansis.bold.green('\n⨠Core cycle execution completed successfully. Structural layout is clean.'));
|
|
164
|
+
process.exit(0);
|
|
165
|
+
|
|
166
|
+
} catch (criticalBootError) {
|
|
167
|
+
console.error(ansis.bold.red(`\nđ¨ Critical Lifecycle Boot Instability: ${criticalBootError.message}`));
|
|
168
|
+
if (criticalBootError.stack) {
|
|
169
|
+
console.error(ansis.dim(criticalBootError.stack));
|
|
170
|
+
}
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
bootstrap();
|
package/index.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* entkapp Legacy CJS Wrapper
|
|
6
|
+
* Allows the tool to be used in older Node.js environments.
|
|
7
|
+
*/
|
|
8
|
+
module.exports = async function runLegacy() {
|
|
9
|
+
console.log("â ď¸ Running in Legacy CommonJS mode...");
|
|
10
|
+
const { EntkappEngine } = await import('./src/index.js');
|
|
11
|
+
const { EngineContext } = await import('./src/EngineContext.js');
|
|
12
|
+
|
|
13
|
+
const targetCwd = process.cwd();
|
|
14
|
+
const context = new EngineContext(targetCwd);
|
|
15
|
+
const engine = new EntkappEngine(context);
|
|
16
|
+
|
|
17
|
+
return engine.run();
|
|
18
|
+
};
|
package/index.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs/promises';
|
|
3
|
+
import { existsSync } from 'fs';
|
|
4
|
+
import ansis from 'ansis';
|
|
5
|
+
import { Initializer } from './src/Initializer.mjs';
|
|
6
|
+
import { EngineContext } from './src/EngineContext.mjs';
|
|
7
|
+
import { EntkappEngine } from './src/index.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* entkapp Ultimate v5.2.0
|
|
11
|
+
* The main interactive entry point that orchestrates the entire workflow.
|
|
12
|
+
*/
|
|
13
|
+
async function main() {
|
|
14
|
+
const args = process.argv.slice(2);
|
|
15
|
+
const isVerbose = args.includes('--verbose');
|
|
16
|
+
const cwdIdx = args.indexOf('--cwd');
|
|
17
|
+
const targetCwd = (cwdIdx !== -1 && args[cwdIdx + 1]) ? path.resolve(args[cwdIdx + 1]) : process.cwd();
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
const context = new EngineContext(targetCwd);
|
|
21
|
+
context.verbose = isVerbose;
|
|
22
|
+
context.options = {
|
|
23
|
+
autoFix: args.includes('--fix'),
|
|
24
|
+
skipConfirm: args.includes('-y') || args.includes('--yes'),
|
|
25
|
+
debug: args.includes('--debug')
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// 1. Initialize Project (Scaffold / package.json)
|
|
29
|
+
const initializer = new Initializer(context);
|
|
30
|
+
await initializer.run();
|
|
31
|
+
|
|
32
|
+
// 2. Run Engine
|
|
33
|
+
const engine = new EntkappEngine(context);
|
|
34
|
+
await engine.run();
|
|
35
|
+
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error(ansis.bold.red(`\nđ¨ Critical Lifecycle Failure: ${err.message}`));
|
|
38
|
+
if (isVerbose) console.error(err.stack);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Only run if executed directly
|
|
44
|
+
const currentFilePath = path.resolve(process.argv[1]);
|
|
45
|
+
const indexFilePath = path.resolve(import.meta.url.replace('file://', ''));
|
|
46
|
+
|
|
47
|
+
if (currentFilePath === indexFilePath) {
|
|
48
|
+
main();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { EntkappEngine, EngineContext, Initializer };
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"name": "entkapp",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.6.1",
|
|
5
5
|
"description": "The Ultimate Enterprise Codebase Janitor. High-speed OXC integration, type-aware analysis, and automated structural healing. Fully standalone architectural orchestrator.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"bin": {
|
|
9
|
-
"entkapp": "./bin/cli.
|
|
9
|
+
"entkapp": "./bin/cli.mjs"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"start": "node bin/cli.
|
|
12
|
+
"start": "node bin/cli.mjs",
|
|
13
13
|
"entkapp:run": "npx entkapp --fix",
|
|
14
|
-
"test": "
|
|
14
|
+
"test": "node test.js",
|
|
15
15
|
"test:stability": "npm run test",
|
|
16
16
|
"docs:dev": "vitepress dev docs",
|
|
17
|
-
"docs:build": "vitepress build docs && cp docs/sitemap.xml docs/.vitepress/dist/ && cp docs/robots.txt docs/.vitepress/dist && cp logo.png docs/.vitepress/dist",
|
|
17
|
+
"docs:build": "vitepress build docs && (cp docs/sitemap.xml docs/.vitepress/dist/ || true) && (cp docs/robots.txt docs/.vitepress/dist || true) && (cp logo.png docs/.vitepress/dist || true)",
|
|
18
18
|
"docs:preview": "vitepress preview docs"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"enhanced-resolve": "^5.24.0",
|
|
83
83
|
"execa": "^8.0.1",
|
|
84
84
|
"oxc-parser": "^0.135.0",
|
|
85
|
-
"typescript": "^5.9.3"
|
|
85
|
+
"typescript": "^5.9.3",
|
|
86
|
+
"glob": "^10.3.10"
|
|
86
87
|
},
|
|
87
88
|
"devDependencies": {
|
|
88
89
|
"@types/node": "^25.9.3",
|