@rahul05ranjan/dhruv-cli 1.8.0 → 1.8.1
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/CHANGELOG.md +3 -3
- package/__tests__/diagnostics.test.ts +30 -0
- package/dist/commands/health.js +1 -1
- package/package.json +1 -1
- package/src/commands/health.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# [1.4.0](https://github.com/rahul05ranjan/dhruv-cli/compare/v1.
|
|
1
|
+
# [1.4.0](https://github.com/rahul05ranjan/dhruv-cli/compare/v1.8.0...v1.4.0) (2026-09-21)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
###
|
|
4
|
+
### Bug Fixes
|
|
5
5
|
|
|
6
|
-
* **
|
|
6
|
+
* **health:** exit with code 1 on FAIL in text mode (closes [#93](https://github.com/rahul05ranjan/dhruv-cli/issues/93)) ([272fdd8](https://github.com/rahul05ranjan/dhruv-cli/commit/272fdd8e14d6f46227ee47756c1e556c49897c12))
|
|
7
7
|
# Changelog
|
|
8
8
|
|
|
9
9
|
## [1.1.1](https://github.com/rahul05ranjan/dhruv-cli/compare/v1.1.0...v1.1.1) (2025-06-29)
|
|
@@ -95,6 +95,36 @@ describe('diagnostic commands', () => {
|
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
+
it('sets process.exitCode = 1 on FAIL in text mode', async () => {
|
|
99
|
+
process.exitCode = 0;
|
|
100
|
+
jest.mocked(listModels).mockRejectedValue(new Error('connection refused'));
|
|
101
|
+
saveConfig({ model: 'test-model', responseFormat: 'text' });
|
|
102
|
+
const logSpy = jest.spyOn(console, 'log').mockImplementation(() => {});
|
|
103
|
+
|
|
104
|
+
try {
|
|
105
|
+
await health();
|
|
106
|
+
expect(process.exitCode).toBe(1);
|
|
107
|
+
} finally {
|
|
108
|
+
process.exitCode = 0;
|
|
109
|
+
logSpy.mockRestore();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('sets process.exitCode = 0 on PASS in text mode', async () => {
|
|
114
|
+
process.exitCode = undefined;
|
|
115
|
+
jest.mocked(listModels).mockResolvedValue(['test-model']);
|
|
116
|
+
saveConfig({ model: 'test-model', responseFormat: 'text' });
|
|
117
|
+
const logSpy = jest.spyOn(console, 'log').mockImplementation(() => {});
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
await health();
|
|
121
|
+
expect(process.exitCode ?? 0).toBe(0);
|
|
122
|
+
} finally {
|
|
123
|
+
process.exitCode = 0;
|
|
124
|
+
logSpy.mockRestore();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
|
|
98
128
|
it('retains a local command summary across collector reads', () => {
|
|
99
129
|
metricsCollector.resetPersistent();
|
|
100
130
|
metricsCollector.recordCommand('explain', 1250, true);
|
package/dist/commands/health.js
CHANGED
|
@@ -38,8 +38,8 @@ export async function health(options = {}) {
|
|
|
38
38
|
results.push(...await checkPlugins());
|
|
39
39
|
const duration = Date.now() - startTime;
|
|
40
40
|
const summary = summarizeResults(results);
|
|
41
|
+
process.exitCode = summary.fail > 0 ? 1 : 0;
|
|
41
42
|
if (jsonOutput) {
|
|
42
|
-
process.exitCode = summary.fail > 0 ? 1 : 0;
|
|
43
43
|
process.stdout.write(`${JSON.stringify({
|
|
44
44
|
ok: summary.fail === 0,
|
|
45
45
|
command: 'health',
|
package/package.json
CHANGED
package/src/commands/health.ts
CHANGED
|
@@ -72,8 +72,8 @@ export async function health(options: HealthOptions = {}): Promise<void> {
|
|
|
72
72
|
|
|
73
73
|
const duration = Date.now() - startTime;
|
|
74
74
|
const summary = summarizeResults(results);
|
|
75
|
+
process.exitCode = summary.fail > 0 ? 1 : 0;
|
|
75
76
|
if (jsonOutput) {
|
|
76
|
-
process.exitCode = summary.fail > 0 ? 1 : 0;
|
|
77
77
|
process.stdout.write(`${JSON.stringify({
|
|
78
78
|
ok: summary.fail === 0,
|
|
79
79
|
command: 'health',
|