@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 CHANGED
@@ -1,9 +1,9 @@
1
- # [1.4.0](https://github.com/rahul05ranjan/dhruv-cli/compare/v1.7.0...v1.4.0) (2026-09-21)
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
- ### Features
4
+ ### Bug Fixes
5
5
 
6
- * **distribution:** add canonical MIT LICENSE and package.json license metadata (closes [#107](https://github.com/rahul05ranjan/dhruv-cli/issues/107)) ([5ac966d](https://github.com/rahul05ranjan/dhruv-cli/commit/5ac966dedc091e271e6f2aff5b8e8a8ddad86091))
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);
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rahul05ranjan/dhruv-cli",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "AI-powered CLI assistant for developers using Ollama",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -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',