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.
@@ -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();