@rahul05ranjan/dhruv-cli 1.1.2 → 1.1.3

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,21 +1,27 @@
1
1
  # Automatically label PRs based on file paths or globs
2
- cli:
3
- - 'src/**'
4
- - 'bin/**'
5
- docs:
6
- - 'docs/**'
7
- - '**/*.md'
8
- ci:
9
- - '.github/workflows/**'
10
- - '.github/ISSUE_TEMPLATE/**'
11
- - '.github/PULL_REQUEST_TEMPLATE.md'
12
- - '.github/labeler.yml'
13
- - '.github/auto_assign.yml'
14
- - '.github/contribution.yml'
15
- - '.github/stale.yml'
16
- - '.github/release-please.yml'
17
- tests:
18
- - 'tests/**'
19
- - '**/*.test.*'
20
- plugins:
21
- - 'plugins/**'
2
+ labels:
3
+ - label: 'cli'
4
+ patterns:
5
+ - 'src/**'
6
+ - 'bin/**'
7
+ - label: 'docs'
8
+ patterns:
9
+ - 'docs/**'
10
+ - '**/*.md'
11
+ - label: 'ci'
12
+ patterns:
13
+ - '.github/workflows/**'
14
+ - '.github/ISSUE_TEMPLATE/**'
15
+ - '.github/PULL_REQUEST_TEMPLATE.md'
16
+ - '.github/labeler.yml'
17
+ - '.github/auto_assign.yml'
18
+ - '.github/contribution.yml'
19
+ - '.github/stale.yml'
20
+ - '.github/release-please.yml'
21
+ - label: 'tests'
22
+ patterns:
23
+ - 'tests/**'
24
+ - '**/*.test.*'
25
+ - label: 'plugins'
26
+ patterns:
27
+ - 'plugins/**'
@@ -37,5 +37,15 @@ jobs:
37
37
  steps:
38
38
  - uses: amannn/action-semantic-pull-request@v5
39
39
  with:
40
- types: feat,fix,chore,docs,refactor,style,test,ci
40
+ types: |
41
+ feat
42
+ fix
43
+ chore
44
+ docs
45
+ refactor
46
+ style
47
+ test
48
+ ci
41
49
  githubBaseUrl: https://api.github.com
50
+ env:
51
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package/.releaserc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "types": [
3
+ {"type": "feat", "section": "Features"},
4
+ {"type": "fix", "section": "Bug Fixes"},
5
+ {"type": "chore", "section": "Chores"},
6
+ {"type": "docs", "section": "Documentation"},
7
+ {"type": "refactor", "section": "Refactoring"},
8
+ {"type": "style", "section": "Style"},
9
+ {"type": "test", "section": "Tests"},
10
+ {"type": "ci", "section": "CI"}
11
+ ]
12
+ }
package/CONTRIBUTING.md CHANGED
@@ -41,6 +41,17 @@ Thank you for your interest in contributing! 🎉
41
41
 
42
42
  ## Commit Message Guidelines
43
43
  - Use [Conventional Commits](https://www.conventionalcommits.org/) for commit messages.
44
+ - **Allowed PR title types:**
45
+ - feat
46
+ - fix
47
+ - chore
48
+ - docs
49
+ - refactor
50
+ - style
51
+ - test
52
+ - ci
53
+ - Example: `fix: update version to 1.1.3 and improve streaming response handling`
54
+ - PR titles are checked automatically in CI. See `.github/workflows/contribution.yml` for details.
44
55
 
45
56
  ## Code of Conduct
46
57
  - Be respectful and inclusive. See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Dhruv CLI
2
2
 
3
+ [📦 View on npm](https://www.npmjs.com/package/@rahul05ranjan/dhruv-cli)
3
4
  [📖 View Documentation on GitHub Pages](https://rahul05ranjan.github.io/dhruv-cli/)
4
5
 
5
6
  AI-powered CLI assistant for developers using Ollama.
@@ -25,6 +26,8 @@ AI-powered CLI assistant for developers using Ollama.
25
26
  npm install -g @rahul05ranjan/dhruv-cli
26
27
  ```
27
28
 
29
+ Or visit the npm page: https://www.npmjs.com/package/@rahul05ranjan/dhruv-cli
30
+
28
31
  ## 📝 Usage Examples
29
32
  ```bash
30
33
  dhruv suggest "deploy react app to vercel"
package/dist/core/ai.js CHANGED
@@ -20,18 +20,20 @@ export async function askOllama({ prompt, model, onToken }) {
20
20
  try {
21
21
  let result = '';
22
22
  const ollama = new Ollama();
23
- // Await the result directly (no streaming)
24
- const chunk = await ollama.generate({ model: model || 'codellama', prompt });
25
- let token = '';
26
- if (typeof chunk === 'object' && chunk !== null && 'response' in chunk) {
27
- token = chunk.response;
23
+ // Await the iterator, then stream
24
+ const iterator = await ollama.generate({ model: model || 'codellama', prompt, stream: true });
25
+ for await (const chunk of iterator) {
26
+ let token = '';
27
+ if (typeof chunk === 'object' && chunk !== null && 'response' in chunk) {
28
+ token = chunk.response;
29
+ }
30
+ else if (typeof chunk === 'string') {
31
+ token = chunk;
32
+ }
33
+ if (onToken)
34
+ onToken(token);
35
+ result += token;
28
36
  }
29
- else if (typeof chunk === 'string') {
30
- token = chunk;
31
- }
32
- if (onToken)
33
- onToken(token);
34
- result += token;
35
37
  fs.writeFileSync(cacheKey, result.trim());
36
38
  return result.trim();
37
39
  }
package/docs/index.html CHANGED
@@ -299,6 +299,7 @@
299
299
  <a href="#usage">Usage</a>
300
300
  <a href="#plugins">Plugins</a>
301
301
  <a href="#community">Community</a>
302
+ <a href="https://www.npmjs.com/package/@rahul05ranjan/dhruv-cli" target="_blank">NPM</a>
302
303
  </nav>
303
304
  <div class="theme-toggle" id="themeToggle" title="Toggle dark/light mode">
304
305
  <span id="themeIcon">🌙</span> <span id="themeLabel">Dark</span>
@@ -310,6 +311,9 @@
310
311
  <div class="hero-title">Dhruv CLI</div>
311
312
  <div class="hero-animated" id="animatedTagline"></div>
312
313
  <button class="hero-install" onclick="copyInstall()" id="installBtn">npm install -g @rahul05ranjan/dhruv-cli<span style='font-size:0.9em;' id='copyIcon'>📋</span></button>
314
+ <div style="margin-top:0.7em;">
315
+ <a href="https://www.npmjs.com/package/@rahul05ranjan/dhruv-cli" target="_blank" style="color:#eebf63;font-weight:bold;">View on npm</a>
316
+ </div>
313
317
  <div class="badges">
314
318
  <img src="https://img.shields.io/github/stars/rahul05ranjan/dhruv-cli?style=social" alt="GitHub stars">
315
319
  <img src="https://img.shields.io/npm/v/dhruv-cli?color=blue&label=npm" alt="npm version">
@@ -317,56 +321,10 @@
317
321
  <img src="https://img.shields.io/github/license/rahul05ranjan/dhruv-cli?color=green" alt="license">
318
322
  </div>
319
323
  </section>
320
- <section class="terminal-demo" id="features">
321
- <div class="terminal-bar">
322
- <span class="term-dot red"></span>
323
- <span class="term-dot yellow"></span>
324
- <span class="term-dot green"></span>
325
- <span style="margin-left:1em;color:#a1a6b4;font-size:1em;">dhruv@cli:~$</span>
326
- </div>
327
- <div class="terminal-content" id="terminalContent"></div>
328
- <button class="copy-btn" onclick="copyTerminal()" id="copyTermBtn">Copy</button>
329
- </section>
330
- <div class="tabs">
331
- <button class="tab active" data-tab="featuresTab">Features</button>
332
- <button class="tab" data-tab="installTab">Install</button>
333
- <button class="tab" data-tab="usageTab">Usage</button>
334
- <button class="tab" data-tab="pluginsTab">Plugins</button>
335
- <button class="tab" data-tab="communityTab">Community</button>
336
- </div>
337
- <section class="tab-content active" id="featuresTab">
338
- <button class="collapsible">🧠 Smart Suggestions</button>
339
- <div class="collapsible-content">
340
- <ul>
341
- <li>AI-powered suggestions, explanations, and fixes for any dev task.</li>
342
- <li>Project context detection (Node, React, Python, etc.).</li>
343
- </ul>
344
- </div>
345
- <button class="collapsible">🔍 Code Review & Security</button>
346
- <div class="collapsible-content">
347
- <ul>
348
- <li>Review, optimize, and check your code for security issues with a single command.</li>
349
- <li>Test/code generation for any file or project.</li>
350
- </ul>
351
- </div>
352
- <button class="collapsible">⚡ Streaming & UX</button>
353
- <div class="collapsible-content">
354
- <ul>
355
- <li>Streaming output, syntax highlighting, progress bars, colored errors, and interactive menus.</li>
356
- <li>Beautiful, modern CLI design with theme support.</li>
357
- </ul>
358
- </div>
359
- <button class="collapsible">🧩 Plugin System</button>
360
- <div class="collapsible-content">
361
- <ul>
362
- <li>Drop ESM modules in <code>plugins/</code> to add new commands.</li>
363
- <li>Fully extensible and open source.</li>
364
- </ul>
365
- </div>
366
- </section>
367
324
  <section class="tab-content" id="installTab">
368
325
  <h2>Install</h2>
369
326
  <pre><code>npm install -g @rahul05ranjan/dhruv-cli</code></pre>
327
+ <p>Also available on <a href="https://www.npmjs.com/package/@rahul05ranjan/dhruv-cli" target="_blank">npm</a>.</p>
370
328
  <p>Requires <a href="https://nodejs.org/" target="_blank">Node.js</a> 18+ and <a href="https://ollama.com/" target="_blank">Ollama</a> for local AI models.</p>
371
329
  </section>
372
330
  <section class="tab-content" id="usageTab">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rahul05ranjan/dhruv-cli",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "AI-powered CLI assistant for developers using Ollama",
5
5
  "keywords": [
6
6
  "ai",
package/src/core/ai.ts CHANGED
@@ -21,16 +21,18 @@ export async function askOllama({ prompt, model, onToken }: { prompt: string; mo
21
21
  try {
22
22
  let result = '';
23
23
  const ollama = new Ollama();
24
- // Await the result directly (no streaming)
25
- const chunk = await ollama.generate({ model: model || 'codellama', prompt });
26
- let token = '';
27
- if (typeof chunk === 'object' && chunk !== null && 'response' in chunk) {
28
- token = (chunk as { response: string }).response;
29
- } else if (typeof chunk === 'string') {
30
- token = chunk;
24
+ // Await the iterator, then stream
25
+ const iterator = await ollama.generate({ model: model || 'codellama', prompt, stream: true });
26
+ for await (const chunk of iterator) {
27
+ let token = '';
28
+ if (typeof chunk === 'object' && chunk !== null && 'response' in chunk) {
29
+ token = (chunk as { response: string }).response;
30
+ } else if (typeof chunk === 'string') {
31
+ token = chunk;
32
+ }
33
+ if (onToken) onToken(token);
34
+ result += token;
31
35
  }
32
- if (onToken) onToken(token);
33
- result += token;
34
36
  fs.writeFileSync(cacheKey, result.trim());
35
37
  return result.trim();
36
38
  } catch (err) {