@cleocode/cleo 2026.4.29 → 2026.4.31
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/bin/postinstall.js +70 -0
- package/dist/cli/index.js +6410 -3289
- package/dist/cli/index.js.map +4 -4
- package/package.json +18 -7
package/bin/postinstall.js
CHANGED
|
@@ -46,6 +46,73 @@ function getPackageRoot() {
|
|
|
46
46
|
return resolve(__dirname, '..');
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Verify runtime dependencies after bootstrap and print a structured report.
|
|
51
|
+
*
|
|
52
|
+
* Imports checkAllDependencies from @cleocode/core using the same two-path
|
|
53
|
+
* strategy (internal subpath first, public barrel as fallback) used by
|
|
54
|
+
* bootstrapGlobalCleo above.
|
|
55
|
+
*
|
|
56
|
+
* This function is intentionally non-throwing — all errors are caught and
|
|
57
|
+
* logged. It will never cause npm install to exit with a non-zero code.
|
|
58
|
+
*/
|
|
59
|
+
async function verifyDependencies() {
|
|
60
|
+
console.log('CLEO: Verifying dependencies...');
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
let checkAllDependencies;
|
|
64
|
+
try {
|
|
65
|
+
({ checkAllDependencies } = await import('@cleocode/core/internal'));
|
|
66
|
+
} catch {
|
|
67
|
+
({ checkAllDependencies } = await import('@cleocode/core'));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const report = await checkAllDependencies();
|
|
71
|
+
|
|
72
|
+
// Report required dependencies — always shown
|
|
73
|
+
for (const result of report.results) {
|
|
74
|
+
if (result.category === 'required') {
|
|
75
|
+
if (result.healthy) {
|
|
76
|
+
const ver = result.version ? ` ${result.version}` : '';
|
|
77
|
+
console.log(`CLEO: \u2713 ${result.name}${ver}`);
|
|
78
|
+
} else {
|
|
79
|
+
const reason = result.installed ? 'unhealthy' : 'not found';
|
|
80
|
+
console.log(`CLEO: \u2717 ${result.name} — REQUIRED but ${reason}`);
|
|
81
|
+
if (result.suggestedFix) {
|
|
82
|
+
console.log(`CLEO: Fix: ${result.suggestedFix}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Report missing optional/feature dependencies as a summary
|
|
89
|
+
const optionalMissing = report.results.filter(
|
|
90
|
+
(r) => r.category !== 'required' && !r.installed,
|
|
91
|
+
);
|
|
92
|
+
if (optionalMissing.length > 0) {
|
|
93
|
+
console.log(
|
|
94
|
+
`CLEO: ${optionalMissing.length} optional ${optionalMissing.length === 1 ? 'dependency' : 'dependencies'} not installed (install for full functionality)`,
|
|
95
|
+
);
|
|
96
|
+
for (const r of optionalMissing) {
|
|
97
|
+
const hint = r.suggestedFix ?? 'optional';
|
|
98
|
+
console.log(`CLEO: - ${r.name}: ${hint}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!report.allRequiredMet) {
|
|
103
|
+
console.log(
|
|
104
|
+
'CLEO: Warning: Some required dependencies are missing. CLEO will work but some features may fail.',
|
|
105
|
+
);
|
|
106
|
+
console.log('CLEO: Run "cleo doctor" for full diagnostics.');
|
|
107
|
+
}
|
|
108
|
+
} catch (err) {
|
|
109
|
+
console.log('CLEO: Dependency check deferred (will complete on first "cleo doctor")');
|
|
110
|
+
if (process.env.CLEO_DEBUG) {
|
|
111
|
+
console.error('CLEO: Dependency check detail:', err);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
49
116
|
async function runPostinstall() {
|
|
50
117
|
if (!isGlobalInstall()) {
|
|
51
118
|
console.log('CLEO: Skipping global bootstrap (not global install)');
|
|
@@ -78,6 +145,9 @@ async function runPostinstall() {
|
|
|
78
145
|
|
|
79
146
|
console.log('CLEO: Global bootstrap complete!');
|
|
80
147
|
console.log('CLEO: Run "cleo init" in any project to set up local CLEO.');
|
|
148
|
+
|
|
149
|
+
// Dependency verification — non-blocking, never fails the install
|
|
150
|
+
await verifyDependencies();
|
|
81
151
|
} catch (err) {
|
|
82
152
|
console.log('CLEO: Bootstrap deferred (will complete on first "cleo install-global")');
|
|
83
153
|
if (process.env.CLEO_DEBUG) {
|