scorpion-cli 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -59,24 +59,24 @@ After the `0.1.0` release, Scorpion can be installed on Windows, macOS, and Linu
59
59
 
60
60
  ```bash
61
61
  # Global npm install
62
- npm install --global scorpion-cli
62
+ npm install --global scorpion-cli@0.1.2
63
63
  scorpion
64
64
 
65
65
  # Run without installing globally
66
- npx scorpion-cli
66
+ npx scorpion-cli@0.1.2
67
67
  ```
68
68
 
69
69
  PowerShell:
70
70
 
71
71
  ```powershell
72
- irm https://raw.githubusercontent.com/amaansyed27/scorpion-cli-agent/v0.1.0/install.ps1 | iex
72
+ irm https://raw.githubusercontent.com/amaansyed27/scorpion-cli-agent/v0.1.2/install.ps1 | iex
73
73
  scorpion
74
74
  ```
75
75
 
76
76
  macOS/Linux:
77
77
 
78
78
  ```bash
79
- curl -fsSL https://raw.githubusercontent.com/amaansyed27/scorpion-cli-agent/v0.1.0/install.sh | sh
79
+ curl -fsSL https://raw.githubusercontent.com/amaansyed27/scorpion-cli-agent/v0.1.2/install.sh | sh
80
80
  scorpion
81
81
  ```
82
82
 
@@ -103,6 +103,8 @@ Inside the interactive session, slash commands control the session:
103
103
  /demo Show UI features
104
104
  /exit Quit Scorpion
105
105
  ```
106
+
107
+ The model chosen through `/model` is saved locally and reused the next time Scorpion starts. Use `--model <name>` to override it for one launch.
106
108
 
107
109
  ### **1. Deep Research Mode** (`@deep`)
108
110
  Triggers an in-depth analysis session. It searches multiple sources, reads simplified content, and compiles a structured report with citations.
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "scorpion-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Agentic AI CLI assistant powered by Ollama",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
7
- "bin": {
8
- "scorpion": "src/index.js"
7
+ "bin": {
8
+ "scorpion": "src/index.js",
9
+ "scorpion-cli": "src/index.js"
9
10
  },
10
11
  "files": [
11
12
  "src",
package/src/config.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Persistent local settings for Scorpion.
3
+ */
4
+
5
+ import fs from 'fs/promises';
6
+ import os from 'os';
7
+ import path from 'path';
8
+
9
+ const CONFIG_DIRECTORY = process.env.SCORPION_CONFIG_DIR || path.join(os.homedir(), '.scorpion');
10
+ const CONFIG_PATH = path.join(CONFIG_DIRECTORY, 'config.json');
11
+
12
+ export async function loadSettings() {
13
+ try {
14
+ const raw = await fs.readFile(CONFIG_PATH, 'utf8');
15
+ const settings = JSON.parse(raw);
16
+
17
+ return typeof settings?.model === 'string' && settings.model.trim()
18
+ ? { model: settings.model.trim() }
19
+ : {};
20
+ } catch (error) {
21
+ if (error.code === 'ENOENT' || error instanceof SyntaxError) return {};
22
+ throw error;
23
+ }
24
+ }
25
+
26
+ export async function saveSettings(settings) {
27
+ await fs.mkdir(CONFIG_DIRECTORY, { recursive: true });
28
+ await fs.writeFile(CONFIG_PATH, `${JSON.stringify(settings, null, 2)}\n`, 'utf8');
29
+ }
30
+
31
+ export function getConfigPath() {
32
+ return CONFIG_PATH;
33
+ }
package/src/index.js CHANGED
@@ -9,7 +9,7 @@
9
9
  import { program } from 'commander';
10
10
  import { startREPL } from './ui/repl.js';
11
11
  import { query } from './agent.js';
12
- import { isModelAvailable, DEFAULT_MODEL } from './ollama.js';
12
+ import { isModelAvailable, DEFAULT_MODEL } from './ollama.js';
13
13
  import {
14
14
  displayBanner,
15
15
  showError,
@@ -19,7 +19,7 @@ import {
19
19
  } from './ui/formatter.js';
20
20
 
21
21
  // Package info
22
- const VERSION = '0.1.0';
22
+ const VERSION = '0.1.2';
23
23
  const NAME = 'scorpion';
24
24
 
25
25
  // Setup CLI
@@ -27,7 +27,7 @@ program
27
27
  .name(NAME)
28
28
  .version(VERSION)
29
29
  .description('🦂 Scorpion - Agentic AI CLI powered by Ollama')
30
- .option('-m, --model <model>', 'Ollama model to use', DEFAULT_MODEL)
30
+ .option('-m, --model <model>', 'Ollama model to use')
31
31
  .option('-q, --query <query>', 'Run a single query and exit')
32
32
  .option('--think', 'Show AI thinking process')
33
33
  .option('--check', 'Check Ollama connection and exit');
@@ -37,17 +37,19 @@ program.parse();
37
37
  const options = program.opts();
38
38
 
39
39
  // Main entry point
40
- async function main() {
40
+ async function main() {
41
+ const selectedModel = options.model || DEFAULT_MODEL;
42
+
41
43
  // Handle --check flag
42
44
  if (options.check) {
43
45
  showInfo('Checking Ollama connection...');
44
46
  try {
45
- const available = await isModelAvailable(options.model);
46
- if (available) {
47
- showSuccess(`Ollama is running. Model '${options.model}' is available.`);
48
- } else {
49
- showError(`Model '${options.model}' not found.`);
50
- showInfo(`Run: ollama pull ${options.model}`);
47
+ const available = await isModelAvailable(selectedModel);
48
+ if (available) {
49
+ showSuccess(`Ollama is running. Model '${selectedModel}' is available.`);
50
+ } else {
51
+ showError(`Model '${selectedModel}' not found.`);
52
+ showInfo(`Run: ollama pull ${selectedModel}`);
51
53
  }
52
54
  } catch (error) {
53
55
  showError('Could not connect to Ollama.');
@@ -73,9 +75,9 @@ async function main() {
73
75
  }
74
76
 
75
77
  // Start interactive REPL
76
- await startREPL({
77
- model: options.model,
78
- showThinkingOutput: options.think || false,
78
+ await startREPL({
79
+ model: options.model,
80
+ showThinkingOutput: options.think || false,
79
81
  });
80
82
  }
81
83
 
package/src/ui/repl.js CHANGED
@@ -4,8 +4,9 @@
4
4
  */
5
5
 
6
6
  import readline from 'readline';
7
- import { runAgent } from '../agent.js';
7
+ import { runAgent } from '../agent.js';
8
8
  import { isModelAvailable, DEFAULT_MODEL } from '../ollama.js';
9
+ import { getConfigPath, loadSettings, saveSettings } from '../config.js';
9
10
  import { setProgressCallback } from '../tools/deep-research.js';
10
11
  import { handleStats, handleListReports, handleDemo, handleExport, handleListModels, handleModelSelect } from '../commands.js';
11
12
  import {
@@ -31,11 +32,15 @@ import {
31
32
  */
32
33
  export async function startREPL(options = {}) {
33
34
  const {
34
- model = DEFAULT_MODEL,
35
+ model,
35
36
  showThinkingOutput = false, // Hidden by default like Claude Code
36
37
  } = options;
37
38
 
38
- const settings = { model, showThinkingOutput };
39
+ const persistedSettings = await loadSettings();
40
+ const settings = {
41
+ model: model || persistedSettings.model || DEFAULT_MODEL,
42
+ showThinkingOutput,
43
+ };
39
44
 
40
45
  // Display welcome banner
41
46
  displayBanner();
@@ -182,7 +187,12 @@ async function handleCommand(command, settings, clearHistory, ask) {
182
187
  const selected = await handleModelSelect(settings.model, ask, command.args.join(' '));
183
188
  if (selected) {
184
189
  settings.model = selected;
185
- showSuccess(`Model changed to ${settings.model}`);
190
+ try {
191
+ await saveSettings({ model: settings.model });
192
+ showSuccess(`Model changed to ${settings.model} (saved)`);
193
+ } catch (error) {
194
+ showError(`Model changed, but could not save it: ${error.message}`);
195
+ }
186
196
  }
187
197
  return true;
188
198
  }
@@ -232,6 +242,7 @@ function showSettings(settings) {
232
242
  console.log(` Model: ${colors.accent(settings.model)}`);
233
243
  console.log(` Thinking output: ${colors.accent(settings.showThinkingOutput ? 'on' : 'off')}`);
234
244
  console.log(` Ollama host: ${colors.dim(process.env.OLLAMA_HOST || 'http://localhost:11434')}`);
245
+ console.log(` Settings file: ${colors.dim(getConfigPath())}`);
235
246
  console.log();
236
247
  }
237
248