aios-core 4.4.2 → 4.4.4

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.
@@ -1,10 +1,12 @@
1
1
  /**
2
2
  * Doctor Check: npm Packages
3
3
  *
4
- * Validates node_modules/ exists in project root (quick sanity check).
4
+ * Validates:
5
+ * 1. node_modules/ exists in project root (quick sanity check)
6
+ * 2. (INS-4.12) .aios-core/node_modules/ exists and contains all declared deps
5
7
  *
6
8
  * @module aios-core/doctor/checks/npm-packages
7
- * @story INS-4.1
9
+ * @story INS-4.1, INS-4.12
8
10
  */
9
11
 
10
12
  const path = require('path');
@@ -14,21 +16,62 @@ const name = 'npm-packages';
14
16
 
15
17
  async function run(context) {
16
18
  const nodeModulesPath = path.join(context.projectRoot, 'node_modules');
17
-
18
- if (fs.existsSync(nodeModulesPath)) {
19
+ // Check 1: Project node_modules
20
+ if (!fs.existsSync(nodeModulesPath)) {
19
21
  return {
20
22
  check: name,
21
- status: 'PASS',
22
- message: 'node_modules present',
23
- fixCommand: null,
23
+ status: 'FAIL',
24
+ message: 'node_modules not found',
25
+ fixCommand: 'npm install',
24
26
  };
25
27
  }
26
28
 
29
+ // Check 2 (INS-4.12): .aios-core/node_modules/ completeness
30
+ const aiosCoreDir = path.join(context.projectRoot, '.aios-core');
31
+ const aiosCorePackageJson = path.join(aiosCoreDir, 'package.json');
32
+ const aiosCoreNodeModules = path.join(aiosCoreDir, 'node_modules');
33
+
34
+ if (fs.existsSync(aiosCorePackageJson)) {
35
+ if (!fs.existsSync(aiosCoreNodeModules)) {
36
+ return {
37
+ check: name,
38
+ status: 'FAIL',
39
+ message: 'node_modules present, but .aios-core/node_modules/ missing',
40
+ fixCommand: 'cd .aios-core && npm install --production',
41
+ };
42
+ }
43
+
44
+ // Verify all declared deps are installed
45
+ try {
46
+ const pkg = JSON.parse(fs.readFileSync(aiosCorePackageJson, 'utf8'));
47
+ const deps = Object.keys(pkg.dependencies || {});
48
+ const missing = [];
49
+
50
+ for (const dep of deps) {
51
+ const depPath = path.join(aiosCoreNodeModules, dep);
52
+ if (!fs.existsSync(depPath)) {
53
+ missing.push(dep);
54
+ }
55
+ }
56
+
57
+ if (missing.length > 0) {
58
+ return {
59
+ check: name,
60
+ status: 'FAIL',
61
+ message: `node_modules present, but .aios-core missing deps: ${missing.join(', ')}`,
62
+ fixCommand: 'cd .aios-core && npm install --production',
63
+ };
64
+ }
65
+ } catch {
66
+ // If we can't parse package.json, just check existence passed above
67
+ }
68
+ }
69
+
27
70
  return {
28
71
  check: name,
29
- status: 'FAIL',
30
- message: 'node_modules not found',
31
- fixCommand: 'npm install',
72
+ status: 'PASS',
73
+ message: 'node_modules present' + (fs.existsSync(aiosCoreNodeModules) ? ', .aios-core deps complete' : ''),
74
+ fixCommand: null,
32
75
  };
33
76
  }
34
77