pkg-scaffold 2.2.0 → 2.4.0
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/.scaffold-ignore +22 -0
- package/bin/cli.js +91 -0
- package/index.js +2254 -2544
- package/package.json +19 -7
- package/src/EngineContext.js +282 -0
- package/src/ast/ASTAnalyzer.js +313 -0
- package/src/ast/BarrelParser.js +177 -0
- package/src/ast/MagicDetector.js +154 -0
- package/src/healing/GitSandbox.js +160 -0
- package/src/healing/SelfHealer.js +150 -0
- package/src/index.js +343 -0
- package/src/performance/GraphCache.js +82 -0
- package/src/performance/SupplyChainGuard.js +106 -0
- package/src/performance/WorkerPool.js +89 -0
- package/src/performance/WorkerTaskRunner.js +64 -0
- package/src/refractor/ImpactAnalyzer.js +92 -0
- package/src/refractor/SourceRewriter.js +86 -0
- package/src/refractor/TransactionManager.js +131 -0
- package/src/refractor/TypeIntegrity.js +75 -0
- package/src/resolution/DepencyResolver.js +120 -0
- package/src/resolution/PathMapper.js +115 -0
- package/src/resolution/WorkSpaceGraph.js +171 -0
- package/tsconfig.json +26 -0
package/.scaffold-ignore
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# ============================================================================
|
|
2
|
+
# ⚙️ pkg-scaffold Rule Suppression & Intent Profiles
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# Define exact symbols, file patterns, or dependency keys that must remain
|
|
5
|
+
# preserved during dead-code scanning and transactional refactoring pruning.
|
|
6
|
+
|
|
7
|
+
# Framework & Meta Entrypoints (Implicitly Alive)
|
|
8
|
+
pages/api/*
|
|
9
|
+
app/routes/*
|
|
10
|
+
src/entry-point.js
|
|
11
|
+
|
|
12
|
+
# Intent Suppression: Library Code / Consumer Consumption Contracts
|
|
13
|
+
export:publicApiMethod
|
|
14
|
+
export:initializePlugin
|
|
15
|
+
export:onConfigLoaded
|
|
16
|
+
|
|
17
|
+
# Globally Ignored Module Specifiers
|
|
18
|
+
@types/node
|
|
19
|
+
tslib
|
|
20
|
+
|
|
21
|
+
# Secret Heuristic Exemptions (Explicit False Positive Control)
|
|
22
|
+
exempt_token_pattern
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ============================================================================
|
|
5
|
+
* 🏁 pkg-scaffold 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
|
+
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
+
const __dirname = path.dirname(__filename);
|
|
19
|
+
|
|
20
|
+
const program = new Command();
|
|
21
|
+
|
|
22
|
+
async function bootstrap() {
|
|
23
|
+
try {
|
|
24
|
+
const packageJsonPath = path.resolve(__dirname, '../package.json');
|
|
25
|
+
const packageJsonContent = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'));
|
|
26
|
+
|
|
27
|
+
program
|
|
28
|
+
.name('pkg-scaffold')
|
|
29
|
+
.description(ansis.cyan('Enterprise-Grade AST Syntax Refactoring & Self-Healing Engine'))
|
|
30
|
+
.version(packageJsonContent.version || '3.0.0');
|
|
31
|
+
|
|
32
|
+
program
|
|
33
|
+
.option('-c, --cwd <path>', 'Specify the execution context root directory', process.cwd())
|
|
34
|
+
.option('--fix', 'Enable atomic code updates, structural file pruning, and active type sanitization', true)
|
|
35
|
+
.option('--no-fix', 'Disable direct file manipulation modifications (dry-run reporting mode)')
|
|
36
|
+
.option('--tsconfig <filename>', 'Specify path to custom layout configurations', 'tsconfig.json')
|
|
37
|
+
.option('--test-command <command>', 'Integrated continuous safety test validation script execution path', 'npm test')
|
|
38
|
+
.option('--workspace', 'Enable high-density workspace workspace/monorepo cluster mesh evaluation parsing', false)
|
|
39
|
+
.option('--verbose', 'Toggle expanded trace telemetry for debug operational diagnostics', false);
|
|
40
|
+
|
|
41
|
+
program.parse(process.argv);
|
|
42
|
+
const options = program.opts();
|
|
43
|
+
|
|
44
|
+
console.log(ansis.bold.green(`\n📦 pkg-scaffold v${packageJsonContent.version || '3.0.0'} Engine Activation`));
|
|
45
|
+
console.log(ansis.dim('------------------------------------------------------------'));
|
|
46
|
+
console.log(`${ansis.bold('Target Workspace Root :')} ${ansis.blue(path.resolve(options.cwd))}`);
|
|
47
|
+
console.log(`${ansis.bold('Refactoring Mode :')} ${options.fix ? ansis.yellow('Active Fixing & Self-Healing Enabled') : ansis.gray('Dry-Run Reporting Only')}`);
|
|
48
|
+
console.log(`${ansis.bold('Validation Sandbox :')} ${ansis.magenta(options.testCommand)}`);
|
|
49
|
+
console.log(ansis.dim('------------------------------------------------------------\n'));
|
|
50
|
+
|
|
51
|
+
const engineModulePath = path.resolve(__dirname, '../src/EngineContext.js');
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
await fs.access(engineModulePath);
|
|
55
|
+
} catch {
|
|
56
|
+
console.error(ansis.red(`🚨 Execution Fault: Core engine architecture files missing. Ensure src/ directory layout is fully generated.`));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Lazy load execution context wrapper to align with domain initialization
|
|
61
|
+
const { RefactoringEngine } = await import('../src/index.js');
|
|
62
|
+
|
|
63
|
+
if (!RefactoringEngine) {
|
|
64
|
+
console.error(ansis.red('🚨 Architecture Boundary Error: RefactoringEngine could not be resolved from code topology channels.'));
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const engine = new RefactoringEngine({
|
|
69
|
+
cwd: options.cwd,
|
|
70
|
+
autoFix: options.fix,
|
|
71
|
+
tsconfig: options.tsconfig,
|
|
72
|
+
testCommand: options.testCommand,
|
|
73
|
+
workspace: options.workspace,
|
|
74
|
+
verbose: options.verbose
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
await engine.run();
|
|
78
|
+
|
|
79
|
+
console.log(ansis.bold.green('\n✨ Core cycle execution completed successfully. Structural layout is clean.'));
|
|
80
|
+
process.exit(0);
|
|
81
|
+
|
|
82
|
+
} catch (criticalBootError) {
|
|
83
|
+
console.error(ansis.bold.red(`\n🚨 Critical Lifecycle Boot Instability: ${criticalBootError.message}`));
|
|
84
|
+
if (criticalBootError.stack) {
|
|
85
|
+
console.error(ansis.dim(criticalBootError.stack));
|
|
86
|
+
}
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
bootstrap();
|