@ultrst-armada/krnl 0.0.0-stage → 1.0.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/README.md +84 -2
- package/package.json +75 -4
- package/packages/cli/dist/K_ENT_Entity-PQ5MURQY-ZG6FZXXX.js +13 -0
- package/packages/cli/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-K4CRQYA5.js +8 -0
- package/packages/cli/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-LNPXZYOE.js +110 -0
- package/packages/cli/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-3ALZPNX4.js +11 -0
- package/packages/cli/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-PJTICYSW.js +11 -0
- package/packages/cli/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-M5TYU55O.js +8 -0
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-H6STOXRK.js +20 -0
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-XPJXSF7D.js +19 -0
- package/packages/cli/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-CUYGTWOW.js +7 -0
- package/packages/cli/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-VR6T4N6J.js +17 -0
- package/packages/cli/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-RLJ4QWDP.js +58 -0
- package/packages/cli/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-BOQGUASC.js +22 -0
- package/packages/cli/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-XJI7KIT5.js +8 -0
- package/packages/cli/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-K5VCWAFW.js +9 -0
- package/packages/cli/dist/bin/krnl.cjs +9758 -0
- package/packages/cli/dist/bin/krnl.d.cts +1 -0
- package/packages/cli/dist/bin/krnl.d.ts +1 -0
- package/packages/cli/dist/bin/krnl.js +2006 -0
- package/packages/cli/dist/chunk-3TRM6CYL.js +152 -0
- package/packages/cli/dist/chunk-5JDK35TG.js +3872 -0
- package/packages/cli/dist/chunk-63PTK33I.js +997 -0
- package/packages/cli/dist/chunk-6NIKAMUZ.js +82 -0
- package/packages/cli/dist/chunk-BOXWWXQG.js +400 -0
- package/packages/cli/dist/chunk-EEKLK7QJ.js +565 -0
- package/packages/cli/dist/chunk-EG7T2IAD.js +107 -0
- package/packages/cli/dist/chunk-F5EHXE2O.js +1036 -0
- package/packages/cli/dist/chunk-F65ANSQG.js +269 -0
- package/packages/cli/dist/chunk-FDNCADFE.js +71 -0
- package/packages/cli/dist/chunk-GDLRMDAN.js +127 -0
- package/packages/cli/dist/chunk-HWMTCMOS.js +656 -0
- package/packages/cli/dist/chunk-I74QIQOD.js +5536 -0
- package/packages/cli/dist/chunk-JTLSTO25.js +71 -0
- package/packages/cli/dist/chunk-JULBBJ27.js +1033 -0
- package/packages/cli/dist/chunk-OHVMVRBP.js +117 -0
- package/packages/cli/dist/chunk-P2PCLEKX.js +666 -0
- package/packages/cli/dist/chunk-PJQIUOX2.js +7767 -0
- package/packages/cli/dist/chunk-PPOF3DJW.js +471 -0
- package/packages/cli/dist/chunk-Q45257P6.js +173 -0
- package/packages/cli/dist/chunk-QNROWGBI.js +1036 -0
- package/packages/cli/dist/chunk-RJNYUXZD.js +977 -0
- package/packages/cli/dist/chunk-SRTOPJ5W.js +104 -0
- package/packages/cli/dist/chunk-TCEX3MPS.js +702 -0
- package/packages/cli/dist/chunk-TNOAJO2J.js +675 -0
- package/packages/cli/dist/chunk-UR2SUCSF.js +701 -0
- package/packages/cli/dist/chunk-X5LOIFM7.js +68 -0
- package/packages/cli/dist/chunk-XIRFOO3H.js +589 -0
- package/packages/cli/dist/chunk-ZAAV3JXQ.js +809 -0
- package/packages/cli/dist/index.cjs +7798 -0
- package/packages/cli/dist/index.d.cts +7 -0
- package/packages/cli/dist/index.d.ts +7 -0
- package/packages/cli/dist/index.js +29 -0
- package/packages/cli/package.json +34 -0
- package/packages/core/dist/K_ENT_Entity-4MB7CU4A.js +12 -0
- package/packages/core/dist/K_ENT_Entity-DEJGIDGH.js +12 -0
- package/packages/core/dist/K_ENT_Entity-FXZO5UZ2.js +12 -0
- package/packages/core/dist/K_ENT_Entity-HDSCXC5F.js +12 -0
- package/packages/core/dist/K_ENT_Entity-JILABHLW.js +12 -0
- package/packages/core/dist/K_ENT_Entity-PQ5MURQY.js +13 -0
- package/packages/core/dist/K_ENT_Entity-ROAKDIHW.js +12 -0
- package/packages/core/dist/K_ENT_Entity-TBVFSKDV.js +12 -0
- package/packages/core/dist/K_ENT_Entity-ZFLKG3JO.js +12 -0
- package/packages/core/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF.js +110 -0
- package/packages/core/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF.js +9 -0
- package/packages/core/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X.js +9 -0
- package/packages/core/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2.js +20 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-4C6GBQAG.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-6V23A6F6.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK.js +19 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-DYLLC5G2.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-F4FOFAUP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-FBOXXMI3.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-Q73BWLNP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QM2C4MVA.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QUGI6SMP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RGMTBHNP.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RWR7UNDW.js +18 -0
- package/packages/core/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js +7 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-32MFJJ5Z.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-4J4CEWRY.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-A366YHF2.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-LK4LYJHI.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-NW3K63II.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-QDHTI5ZV.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-VHCT6VIW.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-WBRKF24R.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-XKYQYT6Q.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-Z2PWZYDZ.js +17 -0
- package/packages/core/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5.js +58 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-2EZU7QF4.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-6G3AQNAV.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-B2NZMQUG.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-C2RABMZP.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-HHE3NZ4F.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-LHFGR6WK.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-M74BLM3N.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-PT6ZA6EA.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-SP52V3CX.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF.js +22 -0
- package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-YNSEUHJJ.js +21 -0
- package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-M6SBHIVA.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG.js +8 -0
- package/packages/core/dist/K_LIB_Krnl_Telemetry-77FRZ3KV.js +9 -0
- package/packages/core/dist/chunk-33L2J7V7.js +82 -0
- package/packages/core/dist/chunk-3ES4K2ZP.js +817 -0
- package/packages/core/dist/chunk-3SMHVVLL.js +82 -0
- package/packages/core/dist/chunk-3UEZ7JQA.js +4877 -0
- package/packages/core/dist/chunk-3XIE6KBD.js +4877 -0
- package/packages/core/dist/chunk-46ZLCML6.js +107 -0
- package/packages/core/dist/chunk-4UEL3DWJ.js +107 -0
- package/packages/core/dist/chunk-54GWZ5PC.js +82 -0
- package/packages/core/dist/chunk-6QCYRS5L.js +127 -0
- package/packages/core/dist/chunk-6ULMHNXR.js +104 -0
- package/packages/core/dist/chunk-7WUETJEV.js +117 -0
- package/packages/core/dist/chunk-A5KRAYDB.js +107 -0
- package/packages/core/dist/chunk-ANEAZ3PO.js +107 -0
- package/packages/core/dist/chunk-BE76RL6F.js +82 -0
- package/packages/core/dist/chunk-CIARVYDO.js +107 -0
- package/packages/core/dist/chunk-CR2ANE62.js +107 -0
- package/packages/core/dist/chunk-DI27MOR7.js +173 -0
- package/packages/core/dist/chunk-E6RLFHM5.js +596 -0
- package/packages/core/dist/chunk-EELAPMNV.js +4877 -0
- package/packages/core/dist/chunk-ENZ2RQVJ.js +107 -0
- package/packages/core/dist/chunk-F2U6CX4F.js +4877 -0
- package/packages/core/dist/chunk-FKG64OHL.js +82 -0
- package/packages/core/dist/chunk-FYAZJYM5.js +772 -0
- package/packages/core/dist/chunk-G4NP4RDQ.js +82 -0
- package/packages/core/dist/chunk-GADIRLRS.js +473 -0
- package/packages/core/dist/chunk-GR6CSLQJ.js +772 -0
- package/packages/core/dist/chunk-HDS7AT6O.js +772 -0
- package/packages/core/dist/chunk-HIMEZUU2.js +71 -0
- package/packages/core/dist/chunk-IB4UHG5I.js +596 -0
- package/packages/core/dist/chunk-J7ZYNVRS.js +772 -0
- package/packages/core/dist/chunk-JVLZU4K7.js +604 -0
- package/packages/core/dist/chunk-JYXXI7Q3.js +82 -0
- package/packages/core/dist/chunk-K54K2KZW.js +192 -0
- package/packages/core/dist/chunk-K6VHLBNH.js +3316 -0
- package/packages/core/dist/chunk-KCBP7ZYA.js +596 -0
- package/packages/core/dist/chunk-KFQGP6VL.js +33 -0
- package/packages/core/dist/chunk-KIUEUI7K.js +82 -0
- package/packages/core/dist/chunk-LB67NIZP.js +949 -0
- package/packages/core/dist/chunk-LDTYFUNW.js +596 -0
- package/packages/core/dist/chunk-MLVWARD4.js +596 -0
- package/packages/core/dist/chunk-MPYVXHKO.js +2777 -0
- package/packages/core/dist/chunk-MRQ3MITU.js +772 -0
- package/packages/core/dist/chunk-MVUN7I7O.js +107 -0
- package/packages/core/dist/chunk-NDDOIRW7.js +596 -0
- package/packages/core/dist/chunk-O3KDB5MH.js +3330 -0
- package/packages/core/dist/chunk-OEINUDSE.js +400 -0
- package/packages/core/dist/chunk-OPDENPT4.js +4877 -0
- package/packages/core/dist/chunk-P6XEM2LA.js +429 -0
- package/packages/core/dist/chunk-QKMRSQV4.js +82 -0
- package/packages/core/dist/chunk-R6CCWALL.js +4877 -0
- package/packages/core/dist/chunk-RAMMOO73.js +774 -0
- package/packages/core/dist/chunk-S3FTZFG6.js +772 -0
- package/packages/core/dist/chunk-T2ZVN434.js +4877 -0
- package/packages/core/dist/chunk-TFHLDMIA.js +107 -0
- package/packages/core/dist/chunk-TI3QUCIJ.js +107 -0
- package/packages/core/dist/chunk-TR2BAIGI.js +107 -0
- package/packages/core/dist/chunk-UGVVJKC6.js +4877 -0
- package/packages/core/dist/chunk-V2DX7YIU.js +984 -0
- package/packages/core/dist/chunk-W4IHYUYD.js +772 -0
- package/packages/core/dist/chunk-W6WBG5OY.js +4877 -0
- package/packages/core/dist/chunk-WN3M7O7H.js +3312 -0
- package/packages/core/dist/chunk-WR3NCU7U.js +4877 -0
- package/packages/core/dist/chunk-XC6B6L27.js +82 -0
- package/packages/core/dist/chunk-XNSE64ZY.js +3316 -0
- package/packages/core/dist/chunk-XROES2WN.js +634 -0
- package/packages/core/dist/chunk-XSCKNRCZ.js +5020 -0
- package/packages/core/dist/chunk-XVABPAUZ.js +82 -0
- package/packages/core/dist/chunk-YOBCB5C5.js +596 -0
- package/packages/core/dist/chunk-YUK6Q563.js +666 -0
- package/packages/core/dist/chunk-YXGL3ZEU.js +1030 -0
- package/packages/core/dist/chunk-ZINJ5OUX.js +596 -0
- package/packages/core/dist/chunk-ZPFD4BIQ.js +604 -0
- package/packages/core/dist/chunk-ZQZBFG6F.js +4826 -0
- package/packages/core/dist/chunk-ZZFRJGXM.js +4877 -0
- package/packages/core/dist/index.cjs +757 -0
- package/packages/core/dist/index.d.cts +360 -0
- package/packages/core/dist/index.d.ts +360 -0
- package/packages/core/dist/index.js +704 -0
- package/packages/core/package.json +34 -0
- package/packages/create-krnl/dist/K_ENT_Entity-PQ5MURQY-R2OH4VXE.js +14 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-AZM5HF4M.js +9 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-X5N6SV2S.js +111 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-5PFHF4JU.js +12 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-ED33OQPH.js +12 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-YGQLVR4P.js +9 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-VM7CTU2L.js +21 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-Y2GQFJ7I.js +21 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-L3JQWO54.js +8 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-KQARASPR.js +19 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-OF3IGLVL.js +59 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-JOLHKOEX.js +24 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-L46LSHKQ.js +10 -0
- package/packages/create-krnl/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-4JUPRR3X.js +10 -0
- package/packages/create-krnl/dist/chunk-3TRM6CYL.js +152 -0
- package/packages/create-krnl/dist/chunk-3URCB3QS.js +127 -0
- package/packages/create-krnl/dist/chunk-5JDK35TG.js +3872 -0
- package/packages/create-krnl/dist/chunk-A2XAXDOW.js +812 -0
- package/packages/create-krnl/dist/chunk-AN6TMQHG.js +1033 -0
- package/packages/create-krnl/dist/chunk-BOXWWXQG.js +400 -0
- package/packages/create-krnl/dist/chunk-BPTBREBG.js +38 -0
- package/packages/create-krnl/dist/chunk-FDNCADFE.js +71 -0
- package/packages/create-krnl/dist/chunk-JTLSTO25.js +71 -0
- package/packages/create-krnl/dist/chunk-M3NCUIPL.js +107 -0
- package/packages/create-krnl/dist/chunk-N2EONSOC.js +7769 -0
- package/packages/create-krnl/dist/chunk-OHVMVRBP.js +117 -0
- package/packages/create-krnl/dist/chunk-Q45257P6.js +173 -0
- package/packages/create-krnl/dist/chunk-QGM4M3NI.js +37 -0
- package/packages/create-krnl/dist/chunk-RJNYUXZD.js +977 -0
- package/packages/create-krnl/dist/chunk-SRTOPJ5W.js +104 -0
- package/packages/create-krnl/dist/chunk-UPBIGEC3.js +666 -0
- package/packages/create-krnl/dist/chunk-V2DB7UD7.js +82 -0
- package/packages/create-krnl/dist/chunk-WMHLIUI6.js +3644 -0
- package/packages/create-krnl/dist/chunk-XIRFOO3H.js +589 -0
- package/packages/create-krnl/dist/chunk-Y2CEEVZP.js +5536 -0
- package/packages/create-krnl/dist/index.cjs +395 -0
- package/packages/create-krnl/dist/index.js +372 -0
- package/packages/create-krnl/dist/main-DXUMPBND.js +2217 -0
- package/packages/create-krnl/dist/wrapper-SDF2VKX3.js +31 -0
- package/packages/create-krnl/package.json +23 -0
- package/packages/eslint-plugin/dist/index.cjs +439 -0
- package/packages/eslint-plugin/dist/index.d.cts +336 -0
- package/packages/eslint-plugin/dist/index.d.ts +336 -0
- package/packages/eslint-plugin/dist/index.js +416 -0
- package/packages/eslint-plugin/package.json +24 -0
- package/packages/validate/dist/index.cjs +499 -0
- package/packages/validate/dist/index.d.cts +49 -0
- package/packages/validate/dist/index.d.ts +49 -0
- package/packages/validate/dist/index.js +462 -0
- package/packages/validate/package.json +27 -0
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
// src/KrnlValidatorEngine.ts
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import { Project, SyntaxKind, Node } from "ts-morph";
|
|
5
|
+
var KrnlValidatorEngine = class {
|
|
6
|
+
project;
|
|
7
|
+
projectRoot;
|
|
8
|
+
maxFileLineLimit;
|
|
9
|
+
maxMainLogicLimit;
|
|
10
|
+
maxHelperLineLimit;
|
|
11
|
+
constructor(optionsOrRoot) {
|
|
12
|
+
const options = typeof optionsOrRoot === "string" ? { projectRoot: optionsOrRoot } : optionsOrRoot;
|
|
13
|
+
this.projectRoot = path.resolve(options.projectRoot || process.cwd());
|
|
14
|
+
this.maxFileLineLimit = options.maxFileLineLimit ?? 200;
|
|
15
|
+
this.maxMainLogicLimit = options.maxMainLogicLimit ?? 20;
|
|
16
|
+
this.maxHelperLineLimit = options.maxHelperLineLimit ?? 30;
|
|
17
|
+
const tsConfigPath = path.join(this.projectRoot, "tsconfig.json");
|
|
18
|
+
if (fs.existsSync(tsConfigPath)) {
|
|
19
|
+
this.project = new Project({ tsConfigFilePath: tsConfigPath, skipAddingFilesFromTsConfig: true });
|
|
20
|
+
} else {
|
|
21
|
+
this.project = new Project({ compilerOptions: {
|
|
22
|
+
target: 99
|
|
23
|
+
/* ESNext */
|
|
24
|
+
} });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Scans and validates all source files in the project.
|
|
29
|
+
*/
|
|
30
|
+
validateAll() {
|
|
31
|
+
const files = this.collectSourceFiles(this.projectRoot);
|
|
32
|
+
const errors = [];
|
|
33
|
+
const warnings = [];
|
|
34
|
+
this.validateWorkspaceLayout(errors);
|
|
35
|
+
for (const f of files) {
|
|
36
|
+
const sf = this.project.addSourceFileAtPath(f);
|
|
37
|
+
const fileReport = this.validateSourceFile(sf);
|
|
38
|
+
errors.push(...fileReport.errors);
|
|
39
|
+
warnings.push(...fileReport.warnings);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
valid: errors.length === 0,
|
|
43
|
+
totalFiles: files.length,
|
|
44
|
+
errors,
|
|
45
|
+
warnings
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Validates a single SourceFile.
|
|
50
|
+
*/
|
|
51
|
+
validateSourceFile(sf) {
|
|
52
|
+
const errors = [];
|
|
53
|
+
const warnings = [];
|
|
54
|
+
const filePath = sf.getFilePath();
|
|
55
|
+
const sourceText = sf.getText();
|
|
56
|
+
const baseName = path.basename(filePath);
|
|
57
|
+
if (baseName.includes("_pb.") || baseName.endsWith(".d.ts")) {
|
|
58
|
+
return { errors, warnings };
|
|
59
|
+
}
|
|
60
|
+
const lines = sourceText.split("\n");
|
|
61
|
+
if (lines.length > this.maxFileLineLimit) {
|
|
62
|
+
errors.push({
|
|
63
|
+
ruleId: "krnl/file-line-limit",
|
|
64
|
+
filePath,
|
|
65
|
+
message: `File exceeds maximum length of ${this.maxFileLineLimit} lines (currently ${lines.length} lines). Decompose into sub-components, custom hooks, quad-units, or concept libraries.`,
|
|
66
|
+
severity: "error"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
for (const decl of sf.getImportDeclarations()) {
|
|
70
|
+
const moduleSpec = decl.getModuleSpecifierValue();
|
|
71
|
+
if (moduleSpec.startsWith(".") && !moduleSpec.endsWith(".js") && !moduleSpec.endsWith(".json") && !moduleSpec.endsWith(".css") && !moduleSpec.endsWith(".svg") && !moduleSpec.endsWith(".png")) {
|
|
72
|
+
const line = decl.getStartLineNumber();
|
|
73
|
+
errors.push({
|
|
74
|
+
ruleId: "krnl/import-suffix",
|
|
75
|
+
filePath,
|
|
76
|
+
line,
|
|
77
|
+
message: `Relative import '${moduleSpec}' must end with '.js' for NodeNext module resolution.`,
|
|
78
|
+
severity: "error"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const isUiTopLevel = /^(App|main|index|_app|root)\.(tsx|jsx)$/i.test(baseName);
|
|
83
|
+
const isBackendTopLevel = /^(server|app)\.(ts|js)$/i.test(baseName) && (!filePath.includes("/components/") && !filePath.includes("/entities/") && !filePath.includes("/libraries/"));
|
|
84
|
+
if (isUiTopLevel) {
|
|
85
|
+
const jsxElements = sf.getDescendantsOfKind(SyntaxKind.JsxOpeningElement);
|
|
86
|
+
const jsxSelfClosing = sf.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement);
|
|
87
|
+
const allJsxTags = [...jsxElements, ...jsxSelfClosing];
|
|
88
|
+
for (const jsx of allJsxTags) {
|
|
89
|
+
const tagName = jsx.getTagNameNode().getText();
|
|
90
|
+
if (/^[a-z]/.test(tagName)) {
|
|
91
|
+
errors.push({
|
|
92
|
+
ruleId: "krnl/top-level-purity",
|
|
93
|
+
filePath,
|
|
94
|
+
line: jsx.getStartLineNumber(),
|
|
95
|
+
message: `Top-level file '${baseName}' violates Top-Level Purity Law. Raw JSX/HTML element '<${tagName}>' is strictly forbidden. Top-level files must ONLY import and compose React components.`,
|
|
96
|
+
severity: "error"
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const calls2 = sf.getDescendantsOfKind(SyntaxKind.CallExpression);
|
|
101
|
+
for (const call of calls2) {
|
|
102
|
+
const exprText = call.getExpression().getText();
|
|
103
|
+
if (["useState", "useEffect", "useRef", "useMemo", "useCallback", "useReducer", "useContext", "useLayoutEffect"].includes(exprText) || /^use[A-Z]/.test(exprText) && exprText !== "use") {
|
|
104
|
+
errors.push({
|
|
105
|
+
ruleId: "krnl/top-level-purity",
|
|
106
|
+
filePath,
|
|
107
|
+
line: call.getStartLineNumber(),
|
|
108
|
+
message: `Top-level file '${baseName}' violates Top-Level Purity Law. React hook '${exprText}' is forbidden in top-level files. Encapsulate state and effects inside dedicated component files.`,
|
|
109
|
+
severity: "error"
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (isBackendTopLevel) {
|
|
115
|
+
const calls2 = sf.getDescendantsOfKind(SyntaxKind.CallExpression);
|
|
116
|
+
for (const call of calls2) {
|
|
117
|
+
const exprText = call.getExpression().getText();
|
|
118
|
+
if (/^(app|router|server)\.(get|post|put|delete|patch|options|head)$/.test(exprText)) {
|
|
119
|
+
errors.push({
|
|
120
|
+
ruleId: "krnl/top-level-purity",
|
|
121
|
+
filePath,
|
|
122
|
+
line: call.getStartLineNumber(),
|
|
123
|
+
message: `Backend entry file '${baseName}' violates Entry Purity Law. Inline route definition '${exprText}' is forbidden. Delegate to dedicated route/controller modules.`,
|
|
124
|
+
severity: "error"
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (filePath.endsWith(".tsx") || filePath.endsWith(".jsx")) {
|
|
130
|
+
const componentNames = [];
|
|
131
|
+
for (const fn of sf.getFunctions()) {
|
|
132
|
+
const name = fn.getName();
|
|
133
|
+
if (name && /^[A-Z]/.test(name)) {
|
|
134
|
+
const hasJsx = fn.getDescendantsOfKind(SyntaxKind.JsxElement).length > 0 || fn.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement).length > 0 || fn.getDescendantsOfKind(SyntaxKind.JsxFragment).length > 0;
|
|
135
|
+
if (hasJsx) {
|
|
136
|
+
componentNames.push(name);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
for (const stmt of sf.getVariableStatements()) {
|
|
141
|
+
for (const decl of stmt.getDeclarations()) {
|
|
142
|
+
const name = decl.getName();
|
|
143
|
+
if (/^[A-Z]/.test(name)) {
|
|
144
|
+
const typeText = decl.getTypeNode()?.getText() || "";
|
|
145
|
+
const isFcType = typeText.includes("FC") || typeText.includes("FunctionComponent") || typeText.includes("ComponentType");
|
|
146
|
+
const init = decl.getInitializer();
|
|
147
|
+
if (init) {
|
|
148
|
+
const hasJsx = init.getDescendantsOfKind(SyntaxKind.JsxElement).length > 0 || init.getDescendantsOfKind(SyntaxKind.JsxSelfClosingElement).length > 0 || init.getDescendantsOfKind(SyntaxKind.JsxFragment).length > 0;
|
|
149
|
+
if (isFcType || hasJsx) {
|
|
150
|
+
if (!componentNames.includes(name)) {
|
|
151
|
+
componentNames.push(name);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
for (const cls of sf.getClasses()) {
|
|
159
|
+
const name = cls.getName();
|
|
160
|
+
const ext = cls.getExtends()?.getText() || "";
|
|
161
|
+
if (name && (ext.includes("Component") || ext.includes("PureComponent"))) {
|
|
162
|
+
if (!componentNames.includes(name)) {
|
|
163
|
+
componentNames.push(name);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (componentNames.length > 1) {
|
|
168
|
+
errors.push({
|
|
169
|
+
ruleId: "krnl/one-component-per-file",
|
|
170
|
+
filePath,
|
|
171
|
+
message: `File '${baseName}' defines multiple React components (${componentNames.join(", ")}). Krnl strictly enforces ONE component per file. Decompose into sub-component files.`,
|
|
172
|
+
severity: "error"
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const isHelper = filePath.includes("helper_functions") || filePath.includes("/helpers/") || filePath.includes("\\helpers\\");
|
|
177
|
+
const isMainLogic = filePath.endsWith("logic.ts") || filePath.endsWith("logic.js");
|
|
178
|
+
const isRootConcept = filePath.includes("libraries/") || filePath.includes("Concepts.ts");
|
|
179
|
+
if (isHelper) {
|
|
180
|
+
for (const decl of sf.getImportDeclarations()) {
|
|
181
|
+
const spec = decl.getModuleSpecifierValue();
|
|
182
|
+
if (["fs", "node:fs", "http", "node:http", "ws"].includes(spec)) {
|
|
183
|
+
errors.push({
|
|
184
|
+
ruleId: "krnl/helper-purity",
|
|
185
|
+
filePath,
|
|
186
|
+
line: decl.getStartLineNumber(),
|
|
187
|
+
message: `Helper functions (Layer 1) cannot directly import I/O modules ('${spec}'). Delegate to Layer 0 libraries or Entity context.`,
|
|
188
|
+
severity: "error"
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
for (const fn of sf.getFunctions()) {
|
|
193
|
+
const fnLines = fn.getText().split("\n").length;
|
|
194
|
+
if (fnLines > this.maxHelperLineLimit && !sourceText.includes("Concepts.")) {
|
|
195
|
+
errors.push({
|
|
196
|
+
ruleId: "krnl/helper-line-limit",
|
|
197
|
+
filePath,
|
|
198
|
+
line: fn.getStartLineNumber(),
|
|
199
|
+
message: `Helper function '${fn.getName() || "anonymous"}' exceeds ${this.maxHelperLineLimit} lines (${fnLines} lines). Must delegate to a root libraries/{Domain}Concepts.ts library.`,
|
|
200
|
+
severity: "error"
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (isMainLogic) {
|
|
206
|
+
const substantiveLines = lines.filter((l) => {
|
|
207
|
+
const trimmed = l.trim();
|
|
208
|
+
return trimmed.length > 0 && !trimmed.startsWith("//") && !trimmed.startsWith("/*") && !trimmed.startsWith("*");
|
|
209
|
+
});
|
|
210
|
+
if (substantiveLines.length > this.maxMainLogicLimit && !sourceText.includes("helpers") && !sourceText.includes("Concepts") && !sourceText.includes("state")) {
|
|
211
|
+
errors.push({
|
|
212
|
+
ruleId: "krnl/main-delegation",
|
|
213
|
+
filePath,
|
|
214
|
+
message: `Main logic function has ${substantiveLines.length} substantive lines without delegating to Layer 1 helper functions or Layer 0 libraries.`,
|
|
215
|
+
severity: "error"
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (sourceText.includes("main = async") || sourceText.includes("export const main = async")) {
|
|
220
|
+
const match = sourceText.match(/main\s*=\s*async\s*\([^,]+,\s*\{([^}]*)\}\s*\)/);
|
|
221
|
+
if (match) {
|
|
222
|
+
const destructured = match[1];
|
|
223
|
+
if (/\bsystem\b/.test(destructured) && !/\bentity\b/.test(destructured)) {
|
|
224
|
+
errors.push({
|
|
225
|
+
ruleId: "krnl/context-destructuring",
|
|
226
|
+
filePath,
|
|
227
|
+
message: `Functionality context parameter destructures 'system'. Functionality passes { state, entity }. Always destructure 'entity'.`,
|
|
228
|
+
severity: "error"
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const calls = sf.getDescendantsOfKind(SyntaxKind.CallExpression);
|
|
234
|
+
for (const call of calls) {
|
|
235
|
+
const exprText = call.getExpression().getText();
|
|
236
|
+
if (exprText === "setInterval" || exprText === "window.setInterval") {
|
|
237
|
+
errors.push({
|
|
238
|
+
ruleId: "krnl/no-polling",
|
|
239
|
+
filePath,
|
|
240
|
+
line: call.getStartLineNumber(),
|
|
241
|
+
message: `Prohibited use of 'setInterval'. Krnl applications must use reactive event streams (entity.emitEvent / entity.on).`,
|
|
242
|
+
severity: "error"
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const isEntityClass = sf.getClasses().some((c) => {
|
|
247
|
+
const ext = c.getExtends();
|
|
248
|
+
return ext && (ext.getText().includes("Entity") || ext.getText().includes("krnlEntityBase"));
|
|
249
|
+
});
|
|
250
|
+
if (isEntityClass) {
|
|
251
|
+
for (const decl of sf.getImportDeclarations()) {
|
|
252
|
+
const spec = decl.getModuleSpecifierValue();
|
|
253
|
+
if (spec.includes("libraries/") || spec.includes("Concepts")) {
|
|
254
|
+
errors.push({
|
|
255
|
+
ruleId: "krnl/entity-no-libraries",
|
|
256
|
+
filePath,
|
|
257
|
+
line: decl.getStartLineNumber(),
|
|
258
|
+
message: `Entity class violates Library Calling Invariant. Entities must not call or import libraries directly ('${spec}'). Only functionalities in 'src/functionalities/' are permitted to call shared libraries.`,
|
|
259
|
+
severity: "error"
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
let loadAllLine = -1;
|
|
264
|
+
const addLocalLines = [];
|
|
265
|
+
for (const call of calls) {
|
|
266
|
+
const txt = call.getText();
|
|
267
|
+
if (txt.includes("MagneticLoader.loadAll") || txt.includes("KrnlMagneticLoader.loadAll")) {
|
|
268
|
+
loadAllLine = call.getStartLineNumber();
|
|
269
|
+
} else if (txt.startsWith("this.addLocal(")) {
|
|
270
|
+
const hasUiSpec = txt.includes("uiSpec");
|
|
271
|
+
const idMatch = txt.match(/id\s*:\s*["']([^"']+)["']/);
|
|
272
|
+
addLocalLines.push({
|
|
273
|
+
line: call.getStartLineNumber(),
|
|
274
|
+
hasUiSpec,
|
|
275
|
+
id: idMatch ? idMatch[1] : "unknown"
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (loadAllLine !== -1) {
|
|
280
|
+
for (const al of addLocalLines) {
|
|
281
|
+
if (al.hasUiSpec && al.line > loadAllLine) {
|
|
282
|
+
errors.push({
|
|
283
|
+
ruleId: "krnl/boot-order",
|
|
284
|
+
filePath,
|
|
285
|
+
line: al.line,
|
|
286
|
+
message: `addLocal('${al.id}') with uiSpec at line ${al.line} appears AFTER loadAll() at line ${loadAllLine}. All addLocal() with UI must precede loadAll().`,
|
|
287
|
+
severity: "error"
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
for (const cls of sf.getClasses()) {
|
|
293
|
+
const ext = cls.getExtends();
|
|
294
|
+
if (ext && (ext.getText().includes("Entity") || ext.getText().includes("krnlEntityBase"))) {
|
|
295
|
+
const loops = [
|
|
296
|
+
...cls.getDescendantsOfKind(SyntaxKind.ForStatement),
|
|
297
|
+
...cls.getDescendantsOfKind(SyntaxKind.ForOfStatement),
|
|
298
|
+
...cls.getDescendantsOfKind(SyntaxKind.ForInStatement),
|
|
299
|
+
...cls.getDescendantsOfKind(SyntaxKind.WhileStatement),
|
|
300
|
+
...cls.getDescendantsOfKind(SyntaxKind.DoStatement)
|
|
301
|
+
];
|
|
302
|
+
for (const loop of loops) {
|
|
303
|
+
errors.push({
|
|
304
|
+
ruleId: "krnl/entity-purity",
|
|
305
|
+
filePath,
|
|
306
|
+
line: loop.getStartLineNumber(),
|
|
307
|
+
message: `Entity '${cls.getName() || "Anonymous"}' violates Entity Purity Law. Loops and procedural algorithms are prohibited inside entities. Move logic to a functionality or a global library function.`,
|
|
308
|
+
severity: "error"
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
for (const method of cls.getMethods()) {
|
|
312
|
+
const methodName = method.getName();
|
|
313
|
+
if (!["boot", "init", "dispose"].includes(methodName)) {
|
|
314
|
+
errors.push({
|
|
315
|
+
ruleId: "krnl/entity-purity",
|
|
316
|
+
filePath,
|
|
317
|
+
line: method.getStartLineNumber(),
|
|
318
|
+
message: `Entity '${cls.getName() || "Anonymous"}' defines custom method '${methodName}'. Entities are purely declarative compositors/orchestrators. Define capabilities as functionalities or global library functions.`,
|
|
319
|
+
severity: "error"
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
for (const call of calls) {
|
|
326
|
+
const callText = call.getText();
|
|
327
|
+
if (callText.startsWith("this.orchestration(") || callText.startsWith("this.flow(")) {
|
|
328
|
+
let currentExpr = call;
|
|
329
|
+
const chainCalls = [];
|
|
330
|
+
while (currentExpr && Node.isCallExpression(currentExpr)) {
|
|
331
|
+
const propAccess = currentExpr.getExpression();
|
|
332
|
+
if (Node.isPropertyAccessExpression(propAccess)) {
|
|
333
|
+
const methodName = propAccess.getName();
|
|
334
|
+
const args = currentExpr.getArguments();
|
|
335
|
+
const argText = args.length > 0 ? args[0].getText() : void 0;
|
|
336
|
+
chainCalls.unshift({ name: methodName, node: currentExpr, argText });
|
|
337
|
+
currentExpr = propAccess.getExpression();
|
|
338
|
+
} else {
|
|
339
|
+
break;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
let consecutiveFunctions = 0;
|
|
343
|
+
let chainId = "orchestration";
|
|
344
|
+
for (const step of chainCalls) {
|
|
345
|
+
if (step.name === "orchestration" || step.name === "flow") {
|
|
346
|
+
chainId = step.argText ? step.argText.replace(/['"]/g, "") : "orchestration";
|
|
347
|
+
} else if (step.name === "thenFunctionality" || step.name === "then") {
|
|
348
|
+
consecutiveFunctions = 0;
|
|
349
|
+
} else if (step.name === "thenEntityOrchestration" || step.name === "thenEntity") {
|
|
350
|
+
consecutiveFunctions = 0;
|
|
351
|
+
} else if (step.name === "thenFunction") {
|
|
352
|
+
errors.push({
|
|
353
|
+
ruleId: "krnl/entity-no-direct-library-calls",
|
|
354
|
+
filePath,
|
|
355
|
+
line: step.node.getStartLineNumber(),
|
|
356
|
+
message: `Orchestration chain '${chainId}' violates Entity Purity Law. Entities cannot chain direct library functions via thenFunction(). Entities must only orchestrate functionalities (thenFunctionality) and orchestrations from other entities (thenEntityOrchestration).`,
|
|
357
|
+
severity: "error"
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return { errors, warnings };
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Validates workspace layout invariants for symmetric Krnl architecture.
|
|
368
|
+
*/
|
|
369
|
+
validateWorkspaceLayout(errors) {
|
|
370
|
+
const krnlDir = path.join(this.projectRoot, "krnl");
|
|
371
|
+
const srcDir = path.join(this.projectRoot, "src");
|
|
372
|
+
const targetDir = fs.existsSync(krnlDir) ? krnlDir : fs.existsSync(srcDir) ? srcDir : null;
|
|
373
|
+
if (!targetDir) return;
|
|
374
|
+
const backendDir = path.join(targetDir, "backend");
|
|
375
|
+
const frontendDir = path.join(targetDir, "frontend");
|
|
376
|
+
if (fs.existsSync(backendDir)) {
|
|
377
|
+
const bLibs = path.join(backendDir, "libraries");
|
|
378
|
+
if (fs.existsSync(bLibs)) {
|
|
379
|
+
for (const entry of fs.readdirSync(bLibs, { withFileTypes: true })) {
|
|
380
|
+
if (!entry.isDirectory()) continue;
|
|
381
|
+
const libPath = path.join(bLibs, entry.name);
|
|
382
|
+
const manifestPath = path.join(libPath, "manifest.json");
|
|
383
|
+
if (!fs.existsSync(manifestPath)) {
|
|
384
|
+
errors.push({
|
|
385
|
+
ruleId: "krnl/concept-manifest-required",
|
|
386
|
+
filePath: libPath,
|
|
387
|
+
message: `Backend concept library "${entry.name}" is missing a manifest.json file.`,
|
|
388
|
+
severity: "error"
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
const bFuncs = path.join(backendDir, "functionalities");
|
|
394
|
+
if (fs.existsSync(bFuncs)) {
|
|
395
|
+
for (const entry of fs.readdirSync(bFuncs, { withFileTypes: true })) {
|
|
396
|
+
if (!entry.isDirectory()) continue;
|
|
397
|
+
const funcPath = path.join(bFuncs, entry.name);
|
|
398
|
+
const manifestPath = path.join(funcPath, "manifest.json");
|
|
399
|
+
if (!fs.existsSync(manifestPath)) {
|
|
400
|
+
errors.push({
|
|
401
|
+
ruleId: "krnl/functionality-manifest-required",
|
|
402
|
+
filePath: funcPath,
|
|
403
|
+
message: `Backend functionality "${entry.name}" is missing a manifest.json file.`,
|
|
404
|
+
severity: "error"
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (fs.existsSync(frontendDir)) {
|
|
411
|
+
const fLibs = path.join(frontendDir, "libraries");
|
|
412
|
+
if (fs.existsSync(fLibs)) {
|
|
413
|
+
for (const entry of fs.readdirSync(fLibs, { withFileTypes: true })) {
|
|
414
|
+
if (!entry.isDirectory()) continue;
|
|
415
|
+
const libPath = path.join(fLibs, entry.name);
|
|
416
|
+
const manifestPath = path.join(libPath, "manifest.json");
|
|
417
|
+
if (!fs.existsSync(manifestPath)) {
|
|
418
|
+
errors.push({
|
|
419
|
+
ruleId: "krnl/frontend-concept-manifest-required",
|
|
420
|
+
filePath: libPath,
|
|
421
|
+
message: `Frontend concept library "${entry.name}" is missing a manifest.json file.`,
|
|
422
|
+
severity: "error"
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const fFuncs = path.join(frontendDir, "functionalities");
|
|
428
|
+
if (fs.existsSync(fFuncs)) {
|
|
429
|
+
for (const entry of fs.readdirSync(fFuncs, { withFileTypes: true })) {
|
|
430
|
+
if (!entry.isDirectory()) continue;
|
|
431
|
+
const funcPath = path.join(fFuncs, entry.name);
|
|
432
|
+
const manifestPath = path.join(funcPath, "manifest.json");
|
|
433
|
+
if (!fs.existsSync(manifestPath)) {
|
|
434
|
+
errors.push({
|
|
435
|
+
ruleId: "krnl/frontend-functionality-manifest-required",
|
|
436
|
+
filePath: funcPath,
|
|
437
|
+
message: `Frontend functionality "${entry.name}" is missing a manifest.json file.`,
|
|
438
|
+
severity: "error"
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
collectSourceFiles(dir, collected = []) {
|
|
446
|
+
if (!fs.existsSync(dir)) return collected;
|
|
447
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
448
|
+
for (const entry of entries) {
|
|
449
|
+
if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".git") continue;
|
|
450
|
+
const full = path.join(dir, entry.name);
|
|
451
|
+
if (entry.isDirectory()) {
|
|
452
|
+
this.collectSourceFiles(full, collected);
|
|
453
|
+
} else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".js") || entry.name.endsWith(".tsx") || entry.name.endsWith(".jsx"))) {
|
|
454
|
+
collected.push(full);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
return collected;
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
export {
|
|
461
|
+
KrnlValidatorEngine
|
|
462
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dinilmusick/krnl-validate",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Deep AST Validation and 4-Layer Function Purity Engine for Krnl",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"registry": "https://npm.pkg.github.com"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup src/index.ts --dts --format esm,cjs --external ts-morph"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"ts-morph": "^25.0.1"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"tsup": "^8.4.0",
|
|
25
|
+
"typescript": "^5.7.3"
|
|
26
|
+
}
|
|
27
|
+
}
|