@rahul05ranjan/dhruv-cli 1.7.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/LICENSE +21 -0
- package/__tests__/diagnostics.test.ts +30 -0
- package/__tests__/workflows.test.ts +15 -0
- package/dist/commands/health.js +1 -1
- package/package.json +2 -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)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rahul Ranjan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -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);
|
|
@@ -116,3 +116,18 @@ describe('security workflow requirements', () => {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
+
|
|
120
|
+
describe('package distribution and licensing compliance', () => {
|
|
121
|
+
it('defines an explicit MIT license in package.json', () => {
|
|
122
|
+
const pkg = JSON.parse(readFileSync(resolve(root, 'package.json'), 'utf8'));
|
|
123
|
+
expect(pkg.license).toBe('MIT');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('provides a canonical root LICENSE file with copyright notice', () => {
|
|
127
|
+
const licensePath = resolve(root, 'LICENSE');
|
|
128
|
+
expect(existsSync(licensePath)).toBe(true);
|
|
129
|
+
const content = readFileSync(licensePath, 'utf8');
|
|
130
|
+
expect(content).toContain('MIT License');
|
|
131
|
+
expect(content).toContain('Copyright (c) 2026 Rahul Ranjan');
|
|
132
|
+
});
|
|
133
|
+
});
|
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',
|