entkapp 5.7.0 → 5.7.2
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 +1 -1
- package/bin/cli.mjs +15 -5
- package/package.json +1 -1
- package/src/healing/GitSandbox.mjs +24 -14
- package/src/index.mjs +1137 -64
- package/src/resolution/ConfigLoader.mjs +6 -5
package/README.md
CHANGED
package/bin/cli.js
CHANGED
|
@@ -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.7.2'} 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
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* ============================================================================
|
|
5
|
-
* 🏁
|
|
5
|
+
* 🏁 loui CLI Entry Point
|
|
6
6
|
* ============================================================================
|
|
7
7
|
* Handles option compilation, environment orchestration, option validation,
|
|
8
8
|
* and initiates the primary operational pipeline loop.
|
|
@@ -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())
|
|
@@ -48,6 +48,8 @@ async function bootstrap() {
|
|
|
48
48
|
|
|
49
49
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
50
50
|
|
|
51
|
+
// --- Onboarding Check (Skipped in Non-Interactive Mode) ---
|
|
52
|
+
// FIX: Ensure options.cwd is always a string, never undefined
|
|
51
53
|
const targetCwd = path.resolve(options.cwd || process.cwd());
|
|
52
54
|
const pkgJsonPath = path.join(targetCwd, 'package.json');
|
|
53
55
|
const configDirPath = path.join(targetCwd, 'entkapp');
|
|
@@ -59,6 +61,7 @@ async function bootstrap() {
|
|
|
59
61
|
|
|
60
62
|
let configInstalled = false;
|
|
61
63
|
if (!options.yes && !options.run) {
|
|
64
|
+
// 1. Ask to install script
|
|
62
65
|
if (pkgJson && !pkgJson.scripts?.['entkapp:run']) {
|
|
63
66
|
const answer = await rl.question(ansis.bold.yellow('❓ No "entkapp:run" script found in package.json. Install it? (y/n): '));
|
|
64
67
|
if (answer.toLowerCase() === 'y') {
|
|
@@ -69,6 +72,7 @@ async function bootstrap() {
|
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
|
|
75
|
+
// 2. Ask to install config folder
|
|
72
76
|
try {
|
|
73
77
|
await fs.access(configDirPath);
|
|
74
78
|
configInstalled = true;
|
|
@@ -81,11 +85,12 @@ async function bootstrap() {
|
|
|
81
85
|
interface: "CLI",
|
|
82
86
|
useBuiltinPlugins: true,
|
|
83
87
|
useCustomPlugins: true,
|
|
88
|
+
|
|
84
89
|
options: { verbose: false, fastMode: true, selfHealing: true },
|
|
85
90
|
enabledPlugins: ["nextjs", "nuxt", "remix", "sveltekit", "astro"]
|
|
86
91
|
};
|
|
87
92
|
await fs.writeFile(path.join(configDirPath, 'config.json'), JSON.stringify(defaultConfig, null, 2));
|
|
88
|
-
console.log(ansis.green('✅ "/entkapp" folder and default config created.'));
|
|
93
|
+
console.log(ansis.green('✅ "/entkapp" folder? and default config created.'));
|
|
89
94
|
configInstalled = true;
|
|
90
95
|
}
|
|
91
96
|
}
|
|
@@ -99,6 +104,7 @@ async function bootstrap() {
|
|
|
99
104
|
|
|
100
105
|
rl.close();
|
|
101
106
|
|
|
107
|
+
// Load local config if available
|
|
102
108
|
let localConfig = {};
|
|
103
109
|
try {
|
|
104
110
|
const { ConfigLoader } = await import('../src/resolution/ConfigLoader.mjs');
|
|
@@ -106,24 +112,27 @@ async function bootstrap() {
|
|
|
106
112
|
localConfig = await loader.loadConfig();
|
|
107
113
|
} catch (e) {}
|
|
108
114
|
|
|
115
|
+
// Merge options with local config
|
|
109
116
|
const finalInterface = localConfig.interface || 'CLI';
|
|
110
117
|
if (finalInterface === 'GUI') {
|
|
111
118
|
console.log(ansis.bold.magenta('🎨 GUI Mode Detected. Starting Web Interface...'));
|
|
112
119
|
return;
|
|
113
120
|
}
|
|
114
121
|
|
|
122
|
+
// Only proceed to execution if -r/--run is provided
|
|
115
123
|
if (!options.run) {
|
|
116
124
|
return;
|
|
117
125
|
}
|
|
118
126
|
|
|
127
|
+
// --- Timeout Handling ---
|
|
119
128
|
const timeoutMs = parseInt(options.timeout);
|
|
120
129
|
const timeoutTimer = setTimeout(() => {
|
|
121
130
|
console.error(ansis.bold.red(`\n🚨 Execution Timeout: The process exceeded the limit of ${timeoutMs}ms.`));
|
|
122
131
|
process.exit(1);
|
|
123
132
|
}, timeoutMs);
|
|
124
|
-
timeoutTimer.unref();
|
|
133
|
+
timeoutTimer.unref(); // Allow process to exit if work finishes
|
|
125
134
|
|
|
126
|
-
console.log(ansis.bold.green(`\n📦 entkapp v${packageJsonContent.version || '5.7.
|
|
135
|
+
console.log(ansis.bold.green(`\n📦 entkapp v${packageJsonContent.version || '5.7.2'} Engine Activation`));
|
|
127
136
|
console.log(ansis.dim('------------------------------------------------------------'));
|
|
128
137
|
console.log(`${ansis.bold('Target Workspace Root :')} ${ansis.blue(targetCwd)}`);
|
|
129
138
|
console.log(`${ansis.bold('Refactoring Mode :')} ${options.fix ? ansis.yellow('Active Fixing & Self-Healing Enabled') : ansis.gray('Dry-Run Reporting Only')}`);
|
|
@@ -144,6 +153,7 @@ async function bootstrap() {
|
|
|
144
153
|
exclude: localConfig.exclude || [],
|
|
145
154
|
ignoreDependencies: localConfig.ignoreDependencies || [],
|
|
146
155
|
options: localConfig.options || {},
|
|
156
|
+
rules: localConfig.rules || {},
|
|
147
157
|
debug: options.debug,
|
|
148
158
|
visualize: options.visualize,
|
|
149
159
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
3
|
"name": "entkapp",
|
|
4
|
-
"version": "5.7.
|
|
4
|
+
"version": "5.7.2",
|
|
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",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { execa } from 'execa';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Deterministic Version Control Guard for Structural Healing Operations.
|
|
@@ -11,24 +10,33 @@ export class GitSandbox {
|
|
|
11
10
|
this.context = context;
|
|
12
11
|
this.initialBranch = '';
|
|
13
12
|
this.healingBranch = `scaffold-healing-${Date.now()}`;
|
|
14
|
-
|
|
13
|
+
// NEW in v5.7.0: Robust Git detection
|
|
14
|
+
this.isGitRepo = false;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Captures the current repository state before applying structural modifications.
|
|
19
19
|
*/
|
|
20
20
|
async captureState() {
|
|
21
|
-
if (!this.isGitRepo) return;
|
|
22
21
|
try {
|
|
23
|
-
const { stdout } = await execa('git', ['rev-parse', '--
|
|
24
|
-
this.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
const { stdout } = await execa('git', ['rev-parse', '--is-inside-work-tree'], { cwd: this.context.cwd });
|
|
23
|
+
this.isGitRepo = stdout.trim() === 'true';
|
|
24
|
+
|
|
25
|
+
if (this.isGitRepo) {
|
|
26
|
+
const { stdout: branch } = await execa('git', ['rev-parse', '--abbrev-ref', 'HEAD'], { cwd: this.context.cwd });
|
|
27
|
+
this.initialBranch = branch.trim();
|
|
28
|
+
|
|
29
|
+
// Create a temporary recovery branch
|
|
30
|
+
await execa('git', ['checkout', '-b', this.healingBranch], { cwd: this.context.cwd });
|
|
31
|
+
if (this.context.verbose) {
|
|
32
|
+
console.log(`[Git] State captured in temporary branch: ${this.healingBranch}`);
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
} catch (e) {
|
|
31
|
-
|
|
36
|
+
this.isGitRepo = false;
|
|
37
|
+
if (this.context.verbose) {
|
|
38
|
+
console.log(`[Git] Not a git repository or git not found: ${e.message}`);
|
|
39
|
+
}
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
|
|
@@ -37,7 +45,7 @@ export class GitSandbox {
|
|
|
37
45
|
*/
|
|
38
46
|
async rollback() {
|
|
39
47
|
if (!this.isGitRepo) {
|
|
40
|
-
console.
|
|
48
|
+
console.log(ansis.yellow('[Git] Rollback skipped: Not a git repository.'));
|
|
41
49
|
return;
|
|
42
50
|
}
|
|
43
51
|
try {
|
|
@@ -76,11 +84,13 @@ export class GitSandbox {
|
|
|
76
84
|
*/
|
|
77
85
|
async verifyIntegrity() {
|
|
78
86
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// Ich simuliere hier Erfolg für den Benchmark.
|
|
87
|
+
const [cmd, ...args] = this.context.testCommand.split(' ');
|
|
88
|
+
await execa(cmd, args, { cwd: this.context.cwd });
|
|
82
89
|
return true;
|
|
83
90
|
} catch (e) {
|
|
91
|
+
if (this.context.verbose) {
|
|
92
|
+
console.warn(`[Git] Integrity verification failed: ${e.message}`);
|
|
93
|
+
}
|
|
84
94
|
return false;
|
|
85
95
|
}
|
|
86
96
|
}
|