@iamharshil/aix-cli 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024
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.
package/README.md ADDED
@@ -0,0 +1,272 @@
1
+ # AIX CLI
2
+
3
+ > AI CLI tool that integrates LM Studio with Claude Code for enhanced development assistance
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@iamharshil/aix-cli.svg)](https://www.npmjs.com/package/@iamharshil/aix-cli)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)
8
+
9
+ **AIX** lets you use locally running AI models from LM Studio directly with Claude Code. No API keys, no cloud dependencies, complete privacy.
10
+
11
+ ## Features
12
+
13
+ - **Privacy-first**: All processing happens locally on your machine
14
+ - **Permission-based**: Never makes system changes without asking
15
+ - **Interactive model selection**: Browse and choose from your downloaded models
16
+ - **Seamless Claude Code integration**: Just run `aix-cli run` and code
17
+ - **Cross-platform**: macOS, Linux, and Windows support
18
+
19
+ ## Prerequisites
20
+
21
+ - [Node.js](https://nodejs.org/) 18.0.0 or higher
22
+ - [LM Studio](https://lmstudio.ai) - Download and install
23
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) - Install via `npm install -g @anthropic-ai/claude-code`
24
+
25
+ ## Quick Start
26
+
27
+ ```bash
28
+ # Install AIX CLI
29
+ npm install -g @iamharshil/aix-cli
30
+
31
+ # Check if everything is set up
32
+ aix-cli doctor
33
+
34
+ # Start using (will prompt for model selection)
35
+ aix-cli run
36
+ ```
37
+
38
+ ## Installation
39
+
40
+ ### Using npm (recommended)
41
+
42
+ ```bash
43
+ npm install -g @iamharshil/aix-cli
44
+ ```
45
+
46
+ ### Using Yarn
47
+
48
+ ```bash
49
+ yarn global add @iamharshil/aix-cli
50
+ ```
51
+
52
+ ### Using pnpm
53
+
54
+ ```bash
55
+ pnpm add -g @iamharshil/aix-cli
56
+ ```
57
+
58
+ ### From source
59
+
60
+ ```bash
61
+ git clone https://github.com/iamharshil/aix-cli.git
62
+ cd aix-cli
63
+ npm install
64
+ npm run build
65
+ npm link
66
+ ```
67
+
68
+ ## Usage
69
+
70
+ ### System Check
71
+
72
+ Verify your setup:
73
+
74
+ ```bash
75
+ aix-cli doctor
76
+ ```
77
+
78
+ Output:
79
+
80
+ ```
81
+ System Check
82
+ ──────────────────────────────────────────────────
83
+ ✓ LM Studio: Running
84
+ ✓ Claude Code: Installed
85
+
86
+ Configuration
87
+ ──────────────────────────────────────────────────
88
+ ▸ LM Studio URL: http://localhost:1234
89
+ ```
90
+
91
+ ### Initialize & Load a Model
92
+
93
+ Select and load a model from your local LM Studio models:
94
+
95
+ ```bash
96
+ aix-cli init
97
+ ```
98
+
99
+ With a specific model:
100
+
101
+ ```bash
102
+ aix-cli init -m llama-3-8b
103
+ ```
104
+
105
+ ### Run Claude Code with a Model
106
+
107
+ Start an interactive Claude Code session with your selected model:
108
+
109
+ ```bash
110
+ aix-cli run
111
+ ```
112
+
113
+ With a specific model:
114
+
115
+ ```bash
116
+ aix-cli run -m llama-3-8b
117
+ ```
118
+
119
+ With additional Claude Code arguments:
120
+
121
+ ```bash
122
+ aix-cli run -m llama-3-8b -- "Write a hello world in Python"
123
+ ```
124
+
125
+ ### Check Status
126
+
127
+ View LM Studio status and loaded models:
128
+
129
+ ```bash
130
+ aix-cli status
131
+ ```
132
+
133
+ ## Configuration
134
+
135
+ AIX CLI stores configuration in your system's app data directory:
136
+
137
+ - **macOS**: `~/Library/Application Support/aix-cli/`
138
+ - **Linux**: `~/.config/aix-cli/`
139
+ - **Windows**: `%APPDATA%\aix-cli\`
140
+
141
+ ### Config File
142
+
143
+ The config is stored as `config.json`:
144
+
145
+ ```json
146
+ {
147
+ "lmStudioUrl": "http://localhost",
148
+ "lmStudioPort": 1234,
149
+ "defaultTimeout": 30000,
150
+ "model": "lmstudio/llama-3-8b"
151
+ }
152
+ ```
153
+
154
+ ### Environment Variables
155
+
156
+ | Variable | Description | Default |
157
+ | ---------------- | --------------------- | ------- |
158
+ | `LM_STUDIO_PORT` | LM Studio server port | `1234` |
159
+
160
+ ## How It Works
161
+
162
+ ```
163
+ ┌─────────────────────────────────────────────────────────────┐
164
+ │ AIX Flow │
165
+ ├─────────────────────────────────────────────────────────────┤
166
+ │ │
167
+ │ ┌──────────┐ ┌──────────────┐ ┌─────────────┐ │
168
+ │ │ User │────▶│ LM Studio │────▶│ Models │ │
169
+ │ └──────────┘ └──────────────┘ └─────────────┘ │
170
+ │ │ │ │
171
+ │ │ ▼ │
172
+ │ │ ┌──────────────┐ │
173
+ │ │ │ Local API │ │
174
+ │ │ │ (port 1234) │ │
175
+ │ │ └──────────────┘ │
176
+ │ │ │ │
177
+ │ ▼ ▼ │
178
+ │ ┌──────────────────────────────┐ │
179
+ │ │ Claude Code │ │
180
+ │ │ --model lmstudio/model-id │ │
181
+ │ └──────────────────────────────┘ │
182
+ │ │
183
+ └─────────────────────────────────────────────────────────────┘
184
+ ```
185
+
186
+ ## Troubleshooting
187
+
188
+ ### "LM Studio server is not running"
189
+
190
+ 1. Open LM Studio
191
+ 2. Go to the **Server** tab (left sidebar)
192
+ 3. Click **Start Server**
193
+ 4. Run `aix run` again
194
+
195
+ Or let AIX start it for you (it will ask for permission).
196
+
197
+ ### "No models found"
198
+
199
+ 1. Open LM Studio
200
+ 2. Go to the **Search** tab
201
+ 3. Download a model (e.g., Llama 3, Mistral, Phi-3)
202
+ 4. Wait for download to complete
203
+ 5. Run `aix init` or `aix run` again
204
+
205
+ ### "Claude Code is not installed"
206
+
207
+ ```bash
208
+ npm install -g @anthropic-ai/claude-code
209
+ ```
210
+
211
+ ### "Connection refused" on port 1234
212
+
213
+ The default port might be in use. Check LM Studio's server tab for the correct port, then update your config if needed.
214
+
215
+ ## Privacy
216
+
217
+ - All AI processing happens locally on your machine
218
+ - No data is sent to external servers
219
+ - No telemetry or analytics
220
+ - No API keys required
221
+ - Your code stays on your machine
222
+
223
+ ## Contributing
224
+
225
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) before submitting PRs.
226
+
227
+ ### Development Setup
228
+
229
+ ```bash
230
+ # Clone the repository
231
+ git clone https://github.com/your-username/aix.git
232
+ cd aix
233
+
234
+ # Install dependencies
235
+ npm install
236
+
237
+ # Run in development mode
238
+ npm run dev
239
+
240
+ # Run tests
241
+ npm test
242
+
243
+ # Build for production
244
+ npm run build
245
+ ```
246
+
247
+ ### Code Style
248
+
249
+ - TypeScript with strict mode
250
+ - ESLint + Prettier configured
251
+ - 2-space indentation
252
+ - Single quotes, semicolons
253
+
254
+ ## Related Projects
255
+
256
+ - [LM Studio](https://lmstudio.ai) - Run local AI models
257
+ - [Claude Code](https://docs.anthropic.com/en/docs/claude-code) - AI coding assistant
258
+
259
+ ## License
260
+
261
+ MIT License - see [LICENSE](LICENSE) for details.
262
+
263
+ ## Support
264
+
265
+ - [Issue Tracker](https://github.com/your-username/aix/issues) - Report bugs or request features
266
+ - [Discussions](https://github.com/your-username/aix/discussions) - Ask questions and share ideas
267
+
268
+ ---
269
+
270
+ <p align="center">
271
+ Made with ❤️ for developers who value privacy
272
+ </p>
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ var J=Object.defineProperty;var P=(t,o)=>()=>(t&&(o=t(t=0)),o);var A=(t,o)=>{for(var e in o)J(t,e,{get:o[e],enumerable:!0})};var N={};A(N,{ConfigService:()=>w,configService:()=>d});import Q from"conf";var w,d,S=P(()=>{"use strict";w=class{store;constructor(){this.store=new Q({projectName:"aix",defaults:{lmStudioUrl:"http://localhost",lmStudioPort:1234,defaultTimeout:3e4,autoStartServer:!1},clearInvalidConfig:!0})}get(o){return this.store.get(o)}set(o,e){this.store.set(o,e)}setModel(o){this.store.set("model",o)}getLastUsedModel(){return this.store.get("model")}getLMStudioUrl(){let o=this.store.get("lmStudioUrl"),e=this.store.get("lmStudioPort");return`${o}:${e}`}reset(){this.store.clear()}},d=new w});var B={};A(B,{LMStudioService:()=>M,lmStudioService:()=>m});import{execa as k}from"execa";import D from"ora";import F from"chalk";var z,M,m,v=P(()=>{"use strict";S();z=[1234,1235,1236,1237],M=class{baseUrl;constructor(){this.baseUrl=d.getLMStudioUrl()}getApiUrl(o){return`${this.baseUrl}${o}`}async checkStatus(){try{return(await fetch(this.getApiUrl("/api/status"),{method:"GET",signal:AbortSignal.timeout(3e3)})).ok}catch{return!1}}async getAvailableModels(){try{let o=await fetch(this.getApiUrl("/api/models"),{method:"GET",signal:AbortSignal.timeout(1e4)});if(!o.ok)throw new Error(`Failed to fetch models: ${o.statusText}`);return(await o.json()).models??[]}catch(o){throw new Error(`Unable to fetch models from LM Studio: ${o instanceof Error?o.message:"Unknown error"}`)}}async getStatus(){if(!await this.checkStatus())return{running:!1,port:d.get("lmStudioPort"),models:[]};try{let e=await fetch(this.getApiUrl("/api/status"),{method:"GET",signal:AbortSignal.timeout(1e4)});if(!e.ok)return{running:!1,port:d.get("lmStudioPort"),models:[]};let n=await e.json();return{running:!0,port:d.get("lmStudioPort"),models:n.models??[],activeModel:n.active_model}}catch{return{running:!1,port:d.get("lmStudioPort"),models:[]}}}async loadModel(o,e){let n=e??D({text:`Loading model: ${F.cyan(o)}`,color:"cyan"}).start();try{let r=await fetch(this.getApiUrl("/api/model/load"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:o}),signal:AbortSignal.timeout(3e5)});if(!r.ok)throw new Error(`Failed to load model: ${r.statusText}`);return n.succeed(`Model ${F.green(o)} loaded successfully`),d.setModel(o),{loadSpinner:n}}catch(r){throw n.fail(`Failed to load model: ${r instanceof Error?r.message:"Unknown error"}`),r}}async startServer(o){let e=o??D({text:"Starting LM Studio server...",color:"cyan"}).start();try{let n=process.platform==="darwin",r=process.platform==="linux",l=process.platform==="win32",c;if(n?c="/Applications/LM Studio.app/Contents/MacOS/lm-studio":r?c=await this.findLinuxBinary():l&&(c=await this.findWindowsExecutable()),!c)throw e.fail("LM Studio not found. Please install it from https://lmstudio.ai"),new Error("LM Studio not installed");await k(c,["--server"],{detached:!0,stdio:"ignore",env:{...process.env,LM_STUDIO_SERVER_PORT:String(d.get("lmStudioPort"))}}),e.succeed("LM Studio server started"),await this.waitForServer(6e4)}catch(n){throw e.fail(`Failed to start LM Studio: ${n instanceof Error?n.message:"Unknown error"}`),n}}async findLinuxBinary(){let o=["/usr/bin/lm-studio","/usr/local/bin/lm-studio",`${process.env.HOME}/.local/bin/lm-studio`];for(let e of o)try{return await k("test",["-x",e]),e}catch{continue}}async findWindowsExecutable(){let o=process.env.LOCALAPPDATA,e=process.env.PROGRAMFILES,n=[o?`${o}\\Programs\\LM Studio\\lm-studio.exe`:"",e?`${e}\\LM Studio\\lm-studio.exe`:""].filter(Boolean);for(let r of n)try{return await k("cmd",["/c","if exist",`"${r}"`,"echo","yes"]),r}catch{continue}}async waitForServer(o=6e4){let e=Date.now();for(;Date.now()-e<o;){if(await this.checkStatus())return!0;await this.sleep(2e3)}return!1}sleep(o){return new Promise(e=>setTimeout(e,o))}async findAvailablePort(){for(let o of z)try{if((await fetch(`http://localhost:${o}/api/status`,{method:"GET",signal:AbortSignal.timeout(1e3)})).ok)return o}catch{return d.set("lmStudioPort",o),o}return z[0]??1234}},m=new M});var _={};A(_,{ClaudeService:()=>L,claudeService:()=>O});import{execa as U}from"execa";import Y from"chalk";var L,O,I=P(()=>{"use strict";L=class{async isClaudeCodeInstalled(){try{return await U("claude",["--version"],{stdio:"ignore"}),!0}catch{return!1}}async run(o){let{model:e,args:n=[],verbose:r=!1}=o,l=this.extractProvider(e),c=this.extractModelName(e);if(!l||!c)throw new Error(`Invalid model format: ${e}. Expected format: provider/model-name`);let g=`${l}/${c}`,u=["--model",g,...n];r&&console.log(Y.dim(`
3
+ Running: claude ${u.join(" ")}
4
+ `));try{await U("claude",u,{stdio:"inherit",env:{...process.env,ANTHROPIC_MODEL:g}})}catch(s){if(s instanceof Error&&"exitCode"in s){let C=s.exitCode;process.exit(C??1)}throw s}}extractProvider(o){return o.split("/")[0]}extractModelName(o){let e=o.split("/");if(!(e.length<2))return e.slice(1).join("/")}async getVersion(){try{return(await U("claude",["--version"])).stdout}catch{return}}},O=new L});import{Command as Z}from"commander";import a from"chalk";v();S();import W from"ora";import f from"chalk";import j from"inquirer";async function y(t,o){let e=t.map(l=>({name:`${l.name} (${l.id})`,value:l,short:l.name})),n=o?e.findIndex(l=>l.value.id===o):0;return(await j.prompt([{type:"list",name:"model",message:"Select a model to load:",choices:e,default:Math.max(0,n),pageSize:Math.min(t.length,15)}])).model}async function x(t,o=!0){return(await j.prompt([{type:"confirm",name:"confirm",message:t,default:o}])).confirm}import K from"chalk";function $(t){if(t===0)return"0 B";let o=1024,e=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(o));return`${parseFloat((t/Math.pow(o,n)).toFixed(2))} ${e[n]}`}function b(t){console.log(K.green("\u2713")+" "+t)}function X(t){console.error(K.red("\u2717")+" "+t)}function p(t,o=1){X(t),process.exit(o)}async function E(t={}){let o=W({text:"Checking LM Studio status...",color:"cyan"}).start(),e=await m.checkStatus();e||(o.info("LM Studio server not running"),o.stop(),await x("Would you like to start the LM Studio server?")||p("LM Studio server must be running. Start it manually or use the Server tab in LM Studio."),await m.startServer(),e=!0),o.succeed("Connected to LM Studio");let n=W({text:"Fetching available models...",color:"cyan"}).start(),r=await m.getAvailableModels();r.length===0&&(n.fail("No models found. Download some models in LM Studio first."),p("No models available")),n.succeed(`Found ${f.bold(r.length)} model${r.length===1?"":"s"}`),console.log(),console.log(f.bold("Available Models:")),console.log(f.dim("\u2500".repeat(process.stdout.columns||80))),r.forEach((s,C)=>{let H=$(s.size),V=s.loaded?f.green(" [LOADED]"):"";console.log(` ${f.dim(String(C+1).padStart(2))}. ${s.name} ${f.dim(`(${H})`)}${V}`)}),console.log();let l=d.getLastUsedModel(),c=t.model,g=c?r.find(s=>s.id===c||s.name.includes(c)):await y(r,l);g||p("No model selected"),await m.loadModel(g.id,o);let u=g.id.replace("/","--");b(f.bold(`
5
+ Model ready: ${g.name}`)),console.log(),console.log("Run Claude Code with this model:"),console.log(` ${f.cyan("claude --model lmstudio/"+u)}`),console.log(),console.log(`Or use ${f.cyan("npx aix run")} to start an interactive session`)}v();I();S();import G from"ora";import q from"chalk";async function R(t={}){let o=G({text:"Checking LM Studio status...",color:"cyan"}).start(),e=await m.checkStatus();e||(o.info("LM Studio server not running"),o.stop(),await x("Would you like to start the LM Studio server?")||p("LM Studio server must be running. Start it manually or use the Server tab in LM Studio."),await m.startServer(),e=!0),o.succeed("Connected to LM Studio"),o.text="Fetching available models...";let n=await m.getAvailableModels();n.length===0&&(o.fail("No models found. Download some models in LM Studio first."),p("No models available")),o.stop();let r;if(t.model){let u=n.find(s=>s.id===t.model||s.name.toLowerCase().includes(t.model.toLowerCase()));u||p(`Model "${t.model}" not found. Available models: ${n.map(s=>s.name).join(", ")}`),r=u.id}else{let u=d.getLastUsedModel();r=(await y(n,u)).id}let l=G({text:`Loading model: ${q.cyan(r)}`,color:"cyan"}).start();await m.loadModel(r,l);let g=`lmstudio/${r.replace("/","--")}`;b(q.green(`
6
+ Starting Claude Code with model: ${g}
7
+ `));try{await O.run({model:g,args:t.args??[],verbose:t.verbose})}catch(u){p(`Failed to run Claude Code: ${u instanceof Error?u.message:"Unknown error"}`)}}v();import i from"chalk";async function T(){let t=await m.getStatus();console.log(),console.log(i.bold("LM Studio Status")),console.log(i.dim("\u2500".repeat(50))),console.log(` ${t.running?i.green("\u25CF"):i.red("\u25CB")} Server: ${t.running?i.green("Running"):i.red("Stopped")}`),console.log(` ${i.dim("\u25B8")} Port: ${i.cyan(String(t.port))}`),console.log(` ${i.dim("\u25B8")} URL: ${i.cyan(`http://localhost:${t.port}`)}`),t.activeModel?console.log(` ${i.dim("\u25B8")} Active Model: ${i.green(t.activeModel)}`):console.log(` ${i.dim("\u25B8")} Active Model: ${i.dim("None")}`),console.log(),console.log(i.bold("Models")),console.log(i.dim("\u2500".repeat(50))),t.models.length===0?console.log(` ${i.dim("No models available")}`):t.models.forEach((o,e)=>{let n=$(o.size),r=o.id===t.activeModel?` ${i.green("[LOADED]")}`:"";console.log(` ${i.dim(String(e+1)+".")} ${o.name}${r}`),console.log(` ${i.dim("ID:")} ${o.id}`),console.log(` ${i.dim("Size:")} ${n}`),o.quantization&&console.log(` ${i.dim("Quantization:")} ${o.quantization}`),console.log()})}var h=new Z;h.name("aix").description("AI CLI tool integrating LM Studio with Claude Code").version("1.0.0");h.command("init").description("Initialize and load a model into LM Studio").option("-m, --model <name>","Model name or ID to load").action(E);h.command("run").description("Run Claude Code with a model from LM Studio").option("-m, --model <name>","Model name or ID to use").option("-v, --verbose","Show verbose output").argument("[args...]","Additional arguments for Claude Code").action(async(t,o)=>{await R({...o,args:t})});h.command("status").description("Show LM Studio status and available models").action(T);h.command("doctor").description("Check system requirements and configuration").action(async()=>{let{lmStudioService:t}=await Promise.resolve().then(()=>(v(),B)),{claudeService:o}=await Promise.resolve().then(()=>(I(),_)),{configService:e}=await Promise.resolve().then(()=>(S(),N));console.log(),console.log(a.bold("System Check")),console.log(a.dim("\u2500".repeat(50)));let n=await t.checkStatus();console.log(` ${n?a.green("\u2713"):a.yellow("\u26A0")} LM Studio: ${n?a.green("Running"):a.yellow("Not running")}`);let r=await o.isClaudeCodeInstalled();console.log(` ${r?a.green("\u2713"):a.red("\u2717")} Claude Code: ${r?a.green("Installed"):a.red("Not installed")}`),console.log(),console.log(a.bold("Configuration")),console.log(a.dim("\u2500".repeat(50))),console.log(` ${a.dim("\u25B8")} LM Studio URL: ${a.cyan(e.getLMStudioUrl())}`),r||(console.log(),console.log(a.yellow("\u26A0 Claude Code is not installed.")),console.log(` Install it with: ${a.cyan("npm install -g @anthropic-ai/claude-code")}`)),n||(console.log(),console.log(a.yellow("\u26A0 LM Studio is not running.")),console.log(` Start the server from the LM Studio app or download from ${a.cyan("https://lmstudio.ai")}`))});h.parse();
8
+ //# sourceMappingURL=aix.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/services/config.ts", "../../src/services/lmstudio.ts", "../../src/services/claude.ts", "../../src/index.ts", "../../src/commands/init.ts", "../../src/utils/prompt.ts", "../../src/utils/format.ts", "../../src/commands/run.ts", "../../src/commands/status.ts"],
4
+ "sourcesContent": ["import Conf from 'conf';\nimport type { Config } from '../types/index.js';\n\nexport class ConfigService {\n private store: Conf<Config>;\n\n constructor() {\n this.store = new Conf<Config>({\n projectName: 'aix',\n defaults: {\n lmStudioUrl: 'http://localhost',\n lmStudioPort: 1234,\n defaultTimeout: 30000,\n autoStartServer: false,\n },\n clearInvalidConfig: true,\n });\n }\n\n get<K extends keyof Config>(key: K): Config[K] {\n return this.store.get(key) as Config[K];\n }\n\n set<K extends keyof Config>(key: K, value: Config[K]): void {\n this.store.set(key, value as Config[K]);\n }\n\n setModel(model: string): void {\n this.store.set('model', model);\n }\n\n getLastUsedModel(): string | undefined {\n return this.store.get('model');\n }\n\n getLMStudioUrl(): string {\n const host = this.store.get('lmStudioUrl');\n const port = this.store.get('lmStudioPort');\n return `${host}:${port}`;\n }\n\n reset(): void {\n this.store.clear();\n }\n}\n\nexport const configService = new ConfigService();\n", "import { execa } from 'execa';\nimport ora, { type Ora } from 'ora';\nimport chalk from 'chalk';\nimport { configService } from './config.js';\nimport type { LMStudioStatus, LMStudioModel } from '../types/index.js';\n\nconst LMSTUDIO_PORTS = [1234, 1235, 1236, 1237];\n\nexport class LMStudioService {\n private baseUrl: string;\n\n constructor() {\n this.baseUrl = configService.getLMStudioUrl();\n }\n\n private getApiUrl(path: string): string {\n return `${this.baseUrl}${path}`;\n }\n\n async checkStatus(): Promise<boolean> {\n try {\n const response = await fetch(this.getApiUrl('/api/status'), {\n method: 'GET',\n signal: AbortSignal.timeout(3000),\n });\n return response.ok;\n } catch {\n return false;\n }\n }\n\n async getAvailableModels(): Promise<LMStudioModel[]> {\n try {\n const response = await fetch(this.getApiUrl('/api/models'), {\n method: 'GET',\n signal: AbortSignal.timeout(10000),\n });\n\n if (!response.ok) {\n throw new Error(`Failed to fetch models: ${response.statusText}`);\n }\n\n const data = (await response.json()) as {\n models: Array<{ id: string; name: string; size: number; quantization?: string }>;\n };\n return data.models ?? [];\n } catch (error) {\n throw new Error(\n `Unable to fetch models from LM Studio: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n }\n\n async getStatus(): Promise<LMStudioStatus> {\n const running = await this.checkStatus();\n\n if (!running) {\n return {\n running: false,\n port: configService.get('lmStudioPort'),\n models: [],\n };\n }\n\n try {\n const response = await fetch(this.getApiUrl('/api/status'), {\n method: 'GET',\n signal: AbortSignal.timeout(10000),\n });\n\n if (!response.ok) {\n return {\n running: false,\n port: configService.get('lmStudioPort'),\n models: [],\n };\n }\n\n const data = (await response.json()) as {\n models: LMStudioModel[];\n active_model?: string;\n };\n\n return {\n running: true,\n port: configService.get('lmStudioPort'),\n models: data.models ?? [],\n activeModel: data.active_model,\n };\n } catch {\n return {\n running: false,\n port: configService.get('lmStudioPort'),\n models: [],\n };\n }\n }\n\n async loadModel(modelId: string, spinner?: Ora): Promise<{ loadSpinner: Ora }> {\n const loadSpinner =\n spinner ??\n ora({\n text: `Loading model: ${chalk.cyan(modelId)}`,\n color: 'cyan',\n }).start();\n\n try {\n const response = await fetch(this.getApiUrl('/api/model/load'), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ model: modelId }),\n signal: AbortSignal.timeout(300000),\n });\n\n if (!response.ok) {\n throw new Error(`Failed to load model: ${response.statusText}`);\n }\n\n loadSpinner.succeed(`Model ${chalk.green(modelId)} loaded successfully`);\n configService.setModel(modelId);\n\n return { loadSpinner };\n } catch (error) {\n loadSpinner.fail(\n `Failed to load model: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n throw error;\n }\n }\n\n async startServer(spinner?: Ora): Promise<void> {\n const startSpinner =\n spinner ??\n ora({\n text: 'Starting LM Studio server...',\n color: 'cyan',\n }).start();\n\n try {\n const isMac = process.platform === 'darwin';\n const isLinux = process.platform === 'linux';\n const isWindows = process.platform === 'win32';\n\n let lmStudioPath: string | undefined;\n\n if (isMac) {\n lmStudioPath = '/Applications/LM Studio.app/Contents/MacOS/lm-studio';\n } else if (isLinux) {\n lmStudioPath = await this.findLinuxBinary();\n } else if (isWindows) {\n lmStudioPath = await this.findWindowsExecutable();\n }\n\n if (!lmStudioPath) {\n startSpinner.fail('LM Studio not found. Please install it from https://lmstudio.ai');\n throw new Error('LM Studio not installed');\n }\n\n await execa(lmStudioPath, ['--server'], {\n detached: true,\n stdio: 'ignore',\n env: {\n ...process.env,\n LM_STUDIO_SERVER_PORT: String(configService.get('lmStudioPort')),\n },\n });\n\n startSpinner.succeed('LM Studio server started');\n\n await this.waitForServer(60000);\n } catch (error) {\n startSpinner.fail(\n `Failed to start LM Studio: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n throw error;\n }\n }\n\n private async findLinuxBinary(): Promise<string | undefined> {\n const possiblePaths = [\n '/usr/bin/lm-studio',\n '/usr/local/bin/lm-studio',\n `${process.env.HOME}/.local/bin/lm-studio`,\n ];\n\n for (const path of possiblePaths) {\n try {\n await execa('test', ['-x', path]);\n return path;\n } catch {\n continue;\n }\n }\n\n return undefined;\n }\n\n private async findWindowsExecutable(): Promise<string | undefined> {\n const localAppData = process.env.LOCALAPPDATA;\n const programFiles = process.env.PROGRAMFILES;\n\n const possiblePaths = [\n localAppData ? `${localAppData}\\\\Programs\\\\LM Studio\\\\lm-studio.exe` : '',\n programFiles ? `${programFiles}\\\\LM Studio\\\\lm-studio.exe` : '',\n ].filter(Boolean);\n\n for (const path of possiblePaths) {\n try {\n await execa('cmd', ['/c', 'if exist', `\"${path}\"`, 'echo', 'yes']);\n return path;\n } catch {\n continue;\n }\n }\n\n return undefined;\n }\n\n async waitForServer(timeout: number = 60000): Promise<boolean> {\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n if (await this.checkStatus()) {\n return true;\n }\n await this.sleep(2000);\n }\n\n return false;\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n async findAvailablePort(): Promise<number> {\n for (const port of LMSTUDIO_PORTS) {\n try {\n const response = await fetch(`http://localhost:${port}/api/status`, {\n method: 'GET',\n signal: AbortSignal.timeout(1000),\n });\n if (response.ok) {\n return port;\n }\n } catch {\n configService.set('lmStudioPort', port);\n return port;\n }\n }\n\n return LMSTUDIO_PORTS[0] ?? 1234;\n }\n}\n\nexport const lmStudioService = new LMStudioService();\n", "import { execa } from 'execa';\nimport chalk from 'chalk';\n\nexport interface ClaudeOptions {\n model: string;\n args?: string[];\n verbose?: boolean;\n}\n\nexport class ClaudeService {\n async isClaudeCodeInstalled(): Promise<boolean> {\n try {\n await execa('claude', ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n }\n\n async run(options: ClaudeOptions): Promise<void> {\n const { model, args = [], verbose = false } = options;\n\n const provider = this.extractProvider(model);\n const modelName = this.extractModelName(model);\n\n if (!provider || !modelName) {\n throw new Error(`Invalid model format: ${model}. Expected format: provider/model-name`);\n }\n\n const modelArg = `${provider}/${modelName}`;\n const claudeArgs = ['--model', modelArg, ...args];\n\n if (verbose) {\n console.log(chalk.dim(`\\nRunning: claude ${claudeArgs.join(' ')}\\n`));\n }\n\n try {\n await execa('claude', claudeArgs, {\n stdio: 'inherit',\n env: {\n ...process.env,\n ANTHROPIC_MODEL: modelArg,\n },\n });\n } catch (error) {\n if (error instanceof Error && 'exitCode' in error) {\n const exitCode = (error as unknown as { exitCode: number }).exitCode;\n process.exit(exitCode ?? 1);\n }\n throw error;\n }\n }\n\n private extractProvider(model: string): string | undefined {\n const parts = model.split('/');\n return parts[0];\n }\n\n private extractModelName(model: string): string | undefined {\n const parts = model.split('/');\n if (parts.length < 2) return undefined;\n return parts.slice(1).join('/');\n }\n\n async getVersion(): Promise<string | undefined> {\n try {\n const result = await execa('claude', ['--version']);\n return result.stdout;\n } catch {\n return undefined;\n }\n }\n}\n\nexport const claudeService = new ClaudeService();\n", "#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport { initCommand, runCommand, statusCommand } from './commands/index.js';\n\nconst program = new Command();\n\nprogram\n .name('aix')\n .description('AI CLI tool integrating LM Studio with Claude Code')\n .version('1.0.0');\n\nprogram\n .command('init')\n .description('Initialize and load a model into LM Studio')\n .option('-m, --model <name>', 'Model name or ID to load')\n .action(initCommand);\n\nprogram\n .command('run')\n .description('Run Claude Code with a model from LM Studio')\n .option('-m, --model <name>', 'Model name or ID to use')\n .option('-v, --verbose', 'Show verbose output')\n .argument('[args...]', 'Additional arguments for Claude Code')\n .action(async (args: string[], options: Record<string, unknown>) => {\n await runCommand({\n ...options,\n args,\n });\n });\n\nprogram\n .command('status')\n .description('Show LM Studio status and available models')\n .action(statusCommand);\n\nprogram\n .command('doctor')\n .description('Check system requirements and configuration')\n .action(async () => {\n const { lmStudioService } = await import('./services/lmstudio.js');\n const { claudeService } = await import('./services/claude.js');\n const { configService } = await import('./services/config.js');\n\n console.log();\n console.log(chalk.bold('System Check'));\n console.log(chalk.dim('\u2500'.repeat(50)));\n\n const lmStudioRunning = await lmStudioService.checkStatus();\n console.log(\n ` ${lmStudioRunning ? chalk.green('\u2713') : chalk.yellow('\u26A0')} LM Studio: ${lmStudioRunning ? chalk.green('Running') : chalk.yellow('Not running')}`\n );\n\n const claudeInstalled = await claudeService.isClaudeCodeInstalled();\n console.log(\n ` ${claudeInstalled ? chalk.green('\u2713') : chalk.red('\u2717')} Claude Code: ${claudeInstalled ? chalk.green('Installed') : chalk.red('Not installed')}`\n );\n\n console.log();\n console.log(chalk.bold('Configuration'));\n console.log(chalk.dim('\u2500'.repeat(50)));\n console.log(` ${chalk.dim('\u25B8')} LM Studio URL: ${chalk.cyan(configService.getLMStudioUrl())}`);\n\n if (!claudeInstalled) {\n console.log();\n console.log(chalk.yellow('\u26A0 Claude Code is not installed.'));\n console.log(` Install it with: ${chalk.cyan('npm install -g @anthropic-ai/claude-code')}`);\n }\n\n if (!lmStudioRunning) {\n console.log();\n console.log(chalk.yellow('\u26A0 LM Studio is not running.'));\n console.log(\n ` Start the server from the LM Studio app or download from ${chalk.cyan('https://lmstudio.ai')}`\n );\n }\n });\n\nprogram.parse();\n", "import ora from 'ora';\nimport chalk from 'chalk';\nimport { lmStudioService } from '../services/lmstudio.js';\nimport { configService } from '../services/config.js';\nimport { selectModel, confirmAction } from '../utils/prompt.js';\nimport { formatBytes, success, exitWithError } from '../utils/format.js';\nimport type { InitOptions } from '../types/index.js';\n\nexport async function initCommand(options: InitOptions = {}): Promise<void> {\n const spinner = ora({\n text: 'Checking LM Studio status...',\n color: 'cyan',\n }).start();\n\n let isRunning = await lmStudioService.checkStatus();\n\n if (!isRunning) {\n spinner.info('LM Studio server not running');\n spinner.stop();\n\n const shouldStart = await confirmAction('Would you like to start the LM Studio server?');\n\n if (!shouldStart) {\n exitWithError(\n 'LM Studio server must be running. Start it manually or use the Server tab in LM Studio.'\n );\n }\n\n await lmStudioService.startServer();\n isRunning = true;\n }\n\n spinner.succeed('Connected to LM Studio');\n\n const modelsSpinner = ora({\n text: 'Fetching available models...',\n color: 'cyan',\n }).start();\n\n const models = await lmStudioService.getAvailableModels();\n\n if (models.length === 0) {\n modelsSpinner.fail('No models found. Download some models in LM Studio first.');\n exitWithError('No models available');\n }\n\n modelsSpinner.succeed(\n `Found ${chalk.bold(models.length)} model${models.length === 1 ? '' : 's'}`\n );\n\n console.log();\n console.log(chalk.bold('Available Models:'));\n console.log(chalk.dim('\u2500'.repeat(process.stdout.columns || 80)));\n\n models.forEach((model, index) => {\n const size = formatBytes(model.size);\n const loaded = model.loaded ? chalk.green(' [LOADED]') : '';\n console.log(\n ` ${chalk.dim(String(index + 1).padStart(2))}. ${model.name} ${chalk.dim(`(${size})`)}${loaded}`\n );\n });\n console.log();\n\n const lastUsedModel = configService.getLastUsedModel();\n const modelSearch = options.model;\n const selectedModel = modelSearch\n ? models.find((m) => m.id === modelSearch || m.name.includes(modelSearch))\n : await selectModel(models, lastUsedModel);\n\n if (!selectedModel) {\n exitWithError('No model selected');\n }\n\n await lmStudioService.loadModel(selectedModel.id, spinner);\n\n const modelIdentifier = selectedModel.id.replace('/', '--');\n\n success(chalk.bold(`\\nModel ready: ${selectedModel.name}`));\n console.log();\n console.log(`Run Claude Code with this model:`);\n console.log(` ${chalk.cyan('claude --model lmstudio/' + modelIdentifier)}`);\n console.log();\n console.log(`Or use ${chalk.cyan('npx aix run')} to start an interactive session`);\n}\n", "import inquirer from 'inquirer';\nimport type { LMStudioModel } from '../types/index.js';\n\nexport async function selectModel(\n models: LMStudioModel[],\n defaultModel?: string\n): Promise<LMStudioModel> {\n const choices = models.map((model) => ({\n name: `${model.name} (${model.id})`,\n value: model,\n short: model.name,\n }));\n\n const defaultIndex = defaultModel ? choices.findIndex((m) => m.value.id === defaultModel) : 0;\n\n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'model',\n message: 'Select a model to load:',\n choices,\n default: Math.max(0, defaultIndex),\n pageSize: Math.min(models.length, 15),\n },\n ]);\n\n return answers['model'] as LMStudioModel;\n}\n\nexport async function confirmAction(\n message: string,\n defaultValue: boolean = true\n): Promise<boolean> {\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'confirm',\n message,\n default: defaultValue,\n },\n ]);\n\n return answers['confirm'] as boolean;\n}\n\nexport async function enterPrompt(message: string, defaultValue?: string): Promise<string> {\n const answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'value',\n message,\n default: defaultValue,\n validate: (input: string) => input.trim().length > 0 || 'Please enter a value',\n },\n ]);\n\n return answers['value'] as string;\n}\n", "import chalk from \"chalk\";\n\nexport function formatBytes(bytes: number): string {\n if (bytes === 0) return \"0 B\";\n\n const k = 1024;\n const sizes = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;\n}\n\nexport function formatModelName(modelId: string): string {\n return modelId\n .replace(/^.*\\//, \"\")\n .replace(/[-_]/g, \" \")\n .replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\nexport function truncate(str: string, maxLength: number): string {\n if (str.length <= maxLength) return str;\n return str.slice(0, maxLength - 3) + \"...\";\n}\n\nexport function promptSeparator(): void {\n console.log(chalk.dim(\"\u2500\".repeat(process.stdout.columns || 80)));\n}\n\nexport function success(message: string): void {\n console.log(chalk.green(\"\u2713\") + \" \" + message);\n}\n\nexport function error(message: string): void {\n console.error(chalk.red(\"\u2717\") + \" \" + message);\n}\n\nexport function info(message: string): void {\n console.log(chalk.blue(\"\u2139\") + \" \" + message);\n}\n\nexport function warn(message: string): void {\n console.log(chalk.yellow(\"\u26A0\") + \" \" + message);\n}\n\nexport function exitWithError(message: string, code: number = 1): never {\n error(message);\n process.exit(code);\n}\n", "import ora from 'ora';\nimport chalk from 'chalk';\nimport { lmStudioService } from '../services/lmstudio.js';\nimport { claudeService } from '../services/claude.js';\nimport { configService } from '../services/config.js';\nimport { selectModel, confirmAction } from '../utils/prompt.js';\nimport { exitWithError, success } from '../utils/format.js';\n\ninterface RunOptions {\n model?: string;\n verbose?: boolean;\n args?: string[];\n}\n\nexport async function runCommand(options: RunOptions = {}): Promise<void> {\n const spinner = ora({\n text: 'Checking LM Studio status...',\n color: 'cyan',\n }).start();\n\n let isRunning = await lmStudioService.checkStatus();\n\n if (!isRunning) {\n spinner.info('LM Studio server not running');\n spinner.stop();\n\n const shouldStart = await confirmAction('Would you like to start the LM Studio server?');\n\n if (!shouldStart) {\n exitWithError(\n 'LM Studio server must be running. Start it manually or use the Server tab in LM Studio.'\n );\n }\n\n await lmStudioService.startServer();\n isRunning = true;\n }\n\n spinner.succeed('Connected to LM Studio');\n\n spinner.text = 'Fetching available models...';\n const models = await lmStudioService.getAvailableModels();\n\n if (models.length === 0) {\n spinner.fail('No models found. Download some models in LM Studio first.');\n exitWithError('No models available');\n }\n\n spinner.stop();\n\n let selectedModelId: string;\n\n if (options.model) {\n const foundModel = models.find(\n (m) => m.id === options.model || m.name.toLowerCase().includes(options.model!.toLowerCase())\n );\n\n if (!foundModel) {\n exitWithError(\n `Model \"${options.model}\" not found. Available models: ${models.map((m) => m.name).join(', ')}`\n );\n }\n\n selectedModelId = foundModel.id;\n } else {\n const lastUsedModel = configService.getLastUsedModel();\n const selectedModel = await selectModel(models, lastUsedModel);\n selectedModelId = selectedModel.id;\n }\n\n const loadSpinner = ora({\n text: `Loading model: ${chalk.cyan(selectedModelId)}`,\n color: 'cyan',\n }).start();\n\n await lmStudioService.loadModel(selectedModelId, loadSpinner);\n\n const modelIdentifier = selectedModelId.replace('/', '--');\n const fullModelName = `lmstudio/${modelIdentifier}`;\n\n success(chalk.green(`\\nStarting Claude Code with model: ${fullModelName}\\n`));\n\n try {\n await claudeService.run({\n model: fullModelName,\n args: options.args ?? [],\n verbose: options.verbose,\n });\n } catch (error) {\n exitWithError(\n `Failed to run Claude Code: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n}\n", "import chalk from \"chalk\";\nimport { lmStudioService } from \"../services/lmstudio.js\";\nimport { formatBytes } from \"../utils/format.js\";\n\nexport async function statusCommand(): Promise<void> {\n const status = await lmStudioService.getStatus();\n\n console.log();\n console.log(chalk.bold(\"LM Studio Status\"));\n console.log(chalk.dim(\"\u2500\".repeat(50)));\n console.log(\n ` ${status.running ? chalk.green(\"\u25CF\") : chalk.red(\"\u25CB\")} Server: ${status.running ? chalk.green(\"Running\") : chalk.red(\"Stopped\")}`,\n );\n console.log(` ${chalk.dim(\"\u25B8\")} Port: ${chalk.cyan(String(status.port))}`);\n console.log(\n ` ${chalk.dim(\"\u25B8\")} URL: ${chalk.cyan(`http://localhost:${status.port}`)}`,\n );\n\n if (status.activeModel) {\n console.log(\n ` ${chalk.dim(\"\u25B8\")} Active Model: ${chalk.green(status.activeModel)}`,\n );\n } else {\n console.log(` ${chalk.dim(\"\u25B8\")} Active Model: ${chalk.dim(\"None\")}`);\n }\n\n console.log();\n console.log(chalk.bold(\"Models\"));\n console.log(chalk.dim(\"\u2500\".repeat(50)));\n\n if (status.models.length === 0) {\n console.log(` ${chalk.dim(\"No models available\")}`);\n } else {\n status.models.forEach((model, index) => {\n const size = formatBytes(model.size);\n const loaded =\n model.id === status.activeModel ? ` ${chalk.green(\"[LOADED]\")}` : \"\";\n console.log(\n ` ${chalk.dim(String(index + 1) + \".\")} ${model.name}${loaded}`,\n );\n console.log(` ${chalk.dim(\"ID:\")} ${model.id}`);\n console.log(` ${chalk.dim(\"Size:\")} ${size}`);\n if (model.quantization) {\n console.log(` ${chalk.dim(\"Quantization:\")} ${model.quantization}`);\n }\n console.log();\n });\n }\n}\n"],
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AI,OAAO,EAAE,CAAC,CAAC,EACrC,QAAQ,IAAI,KAAKA,EAAM,IAAI,QAAG,CAAC,mBAAmBA,EAAM,KAAKD,EAAc,eAAe,CAAC,CAAC,EAAE,EAEzFG,IACH,QAAQ,IAAI,EACZ,QAAQ,IAAIF,EAAM,OAAO,sCAAiC,CAAC,EAC3D,QAAQ,IAAI,sBAAsBA,EAAM,KAAK,0CAA0C,CAAC,EAAE,GAGvFC,IACH,QAAQ,IAAI,EACZ,QAAQ,IAAID,EAAM,OAAO,kCAA6B,CAAC,EACvD,QAAQ,IACN,8DAA8DA,EAAM,KAAK,qBAAqB,CAAC,EACjG,EAEJ,CAAC,EAEHV,EAAQ,MAAM",
6
+ "names": ["config_exports", "__export", "ConfigService", "configService", "Conf", "init_config", "__esmMin", "key", "value", "model", "host", "port", "lmstudio_exports", "__export", "LMStudioService", "lmStudioService", "execa", "ora", "chalk", "LMSTUDIO_PORTS", "init_lmstudio", "__esmMin", "init_config", "configService", "path", "response", "error", "data", "modelId", "spinner", "loadSpinner", "startSpinner", "isMac", "isLinux", "isWindows", "lmStudioPath", "possiblePaths", "localAppData", "programFiles", "timeout", "startTime", "ms", "resolve", "port", "claude_exports", "__export", "ClaudeService", "claudeService", "execa", "chalk", "init_claude", "__esmMin", "options", "model", "args", "verbose", "provider", "modelName", "modelArg", "claudeArgs", "error", "exitCode", "parts", "Command", "chalk", "init_lmstudio", "init_config", "ora", "chalk", "inquirer", "selectModel", "models", "defaultModel", "choices", "model", "defaultIndex", "m", "confirmAction", "message", "defaultValue", "chalk", "formatBytes", "bytes", "k", "sizes", "i", "success", "message", "chalk", "error", "exitWithError", "message", "code", "error", "initCommand", "options", "spinner", "ora", "isRunning", "lmStudioService", "confirmAction", "exitWithError", "modelsSpinner", "models", "chalk", "model", "index", "size", "formatBytes", "loaded", "lastUsedModel", "configService", "modelSearch", "selectedModel", "m", "selectModel", "modelIdentifier", "success", "init_lmstudio", "init_claude", "init_config", "ora", "chalk", "runCommand", "options", "spinner", "ora", "isRunning", "lmStudioService", "confirmAction", "exitWithError", "models", "selectedModelId", "foundModel", "m", "lastUsedModel", "configService", "selectModel", "loadSpinner", "chalk", "fullModelName", "success", "claudeService", "error", "init_lmstudio", "chalk", "statusCommand", "status", "lmStudioService", "chalk", "model", "index", "size", "formatBytes", "loaded", "program", "Command", "initCommand", "args", "options", "runCommand", "statusCommand", "lmStudioService", "claudeService", "configService", "chalk", "lmStudioRunning", "claudeInstalled"]
7
+ }
@@ -0,0 +1,4 @@
1
+ export { initCommand } from "./init.js";
2
+ export { runCommand } from "./run.js";
3
+ export { statusCommand } from "./status.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { InitOptions } from '../types/index.js';
2
+ export declare function initCommand(options?: InitOptions): Promise<void>;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,wBAAsB,WAAW,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2E1E"}
@@ -0,0 +1,8 @@
1
+ interface RunOptions {
2
+ model?: string;
3
+ verbose?: boolean;
4
+ args?: string[];
5
+ }
6
+ export declare function runCommand(options?: RunOptions): Promise<void>;
7
+ export {};
8
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAQA,UAAU,UAAU;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAsB,UAAU,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA+ExE"}
@@ -0,0 +1,2 @@
1
+ export declare function statusCommand(): Promise<void>;
2
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAIA,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA4CnD"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export interface ClaudeOptions {
2
+ model: string;
3
+ args?: string[];
4
+ verbose?: boolean;
5
+ }
6
+ export declare class ClaudeService {
7
+ isClaudeCodeInstalled(): Promise<boolean>;
8
+ run(options: ClaudeOptions): Promise<void>;
9
+ private extractProvider;
10
+ private extractModelName;
11
+ getVersion(): Promise<string | undefined>;
12
+ }
13
+ export declare const claudeService: ClaudeService;
14
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/services/claude.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,aAAa;IAClB,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;IASzC,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAkChD,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAMlB,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAQhD;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { Config } from '../types/index.js';
2
+ export declare class ConfigService {
3
+ private store;
4
+ constructor();
5
+ get<K extends keyof Config>(key: K): Config[K];
6
+ set<K extends keyof Config>(key: K, value: Config[K]): void;
7
+ setModel(model: string): void;
8
+ getLastUsedModel(): string | undefined;
9
+ getLMStudioUrl(): string;
10
+ reset(): void;
11
+ }
12
+ export declare const configService: ConfigService;
13
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/services/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAe;;IAe5B,GAAG,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAI9C,GAAG,CAAC,CAAC,SAAS,MAAM,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI;IAI3D,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,gBAAgB,IAAI,MAAM,GAAG,SAAS;IAItC,cAAc,IAAI,MAAM;IAMxB,KAAK,IAAI,IAAI;CAGd;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type Ora } from 'ora';
2
+ import type { LMStudioStatus, LMStudioModel } from '../types/index.js';
3
+ export declare class LMStudioService {
4
+ private baseUrl;
5
+ constructor();
6
+ private getApiUrl;
7
+ checkStatus(): Promise<boolean>;
8
+ getAvailableModels(): Promise<LMStudioModel[]>;
9
+ getStatus(): Promise<LMStudioStatus>;
10
+ loadModel(modelId: string, spinner?: Ora): Promise<{
11
+ loadSpinner: Ora;
12
+ }>;
13
+ startServer(spinner?: Ora): Promise<void>;
14
+ private findLinuxBinary;
15
+ private findWindowsExecutable;
16
+ waitForServer(timeout?: number): Promise<boolean>;
17
+ private sleep;
18
+ findAvailablePort(): Promise<number>;
19
+ }
20
+ export declare const lmStudioService: LMStudioService;
21
+ //# sourceMappingURL=lmstudio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lmstudio.d.ts","sourceRoot":"","sources":["../../src/services/lmstudio.ts"],"names":[],"mappings":"AACA,OAAY,EAAE,KAAK,GAAG,EAAE,MAAM,KAAK,CAAC;AAGpC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvE,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;;IAMxB,OAAO,CAAC,SAAS;IAIX,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAY/B,kBAAkB,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAsB9C,SAAS,IAAI,OAAO,CAAC,cAAc,CAAC;IA6CpC,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;QAAE,WAAW,EAAE,GAAG,CAAA;KAAE,CAAC;IAkCxE,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YAgDjC,eAAe;YAmBf,qBAAqB;IAqB7B,aAAa,CAAC,OAAO,GAAE,MAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAa9D,OAAO,CAAC,KAAK;IAIP,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;CAkB3C;AAED,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ var J=Object.defineProperty;var P=(t,o)=>()=>(t&&(o=t(t=0)),o);var A=(t,o)=>{for(var e in o)J(t,e,{get:o[e],enumerable:!0})};var N={};A(N,{ConfigService:()=>w,configService:()=>d});import Q from"conf";var w,d,S=P(()=>{"use strict";w=class{store;constructor(){this.store=new Q({projectName:"aix",defaults:{lmStudioUrl:"http://localhost",lmStudioPort:1234,defaultTimeout:3e4,autoStartServer:!1},clearInvalidConfig:!0})}get(o){return this.store.get(o)}set(o,e){this.store.set(o,e)}setModel(o){this.store.set("model",o)}getLastUsedModel(){return this.store.get("model")}getLMStudioUrl(){let o=this.store.get("lmStudioUrl"),e=this.store.get("lmStudioPort");return`${o}:${e}`}reset(){this.store.clear()}},d=new w});var B={};A(B,{LMStudioService:()=>M,lmStudioService:()=>m});import{execa as k}from"execa";import D from"ora";import F from"chalk";var z,M,m,v=P(()=>{"use strict";S();z=[1234,1235,1236,1237],M=class{baseUrl;constructor(){this.baseUrl=d.getLMStudioUrl()}getApiUrl(o){return`${this.baseUrl}${o}`}async checkStatus(){try{return(await fetch(this.getApiUrl("/api/status"),{method:"GET",signal:AbortSignal.timeout(3e3)})).ok}catch{return!1}}async getAvailableModels(){try{let o=await fetch(this.getApiUrl("/api/models"),{method:"GET",signal:AbortSignal.timeout(1e4)});if(!o.ok)throw new Error(`Failed to fetch models: ${o.statusText}`);return(await o.json()).models??[]}catch(o){throw new Error(`Unable to fetch models from LM Studio: ${o instanceof Error?o.message:"Unknown error"}`)}}async getStatus(){if(!await this.checkStatus())return{running:!1,port:d.get("lmStudioPort"),models:[]};try{let e=await fetch(this.getApiUrl("/api/status"),{method:"GET",signal:AbortSignal.timeout(1e4)});if(!e.ok)return{running:!1,port:d.get("lmStudioPort"),models:[]};let n=await e.json();return{running:!0,port:d.get("lmStudioPort"),models:n.models??[],activeModel:n.active_model}}catch{return{running:!1,port:d.get("lmStudioPort"),models:[]}}}async loadModel(o,e){let n=e??D({text:`Loading model: ${F.cyan(o)}`,color:"cyan"}).start();try{let r=await fetch(this.getApiUrl("/api/model/load"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:o}),signal:AbortSignal.timeout(3e5)});if(!r.ok)throw new Error(`Failed to load model: ${r.statusText}`);return n.succeed(`Model ${F.green(o)} loaded successfully`),d.setModel(o),{loadSpinner:n}}catch(r){throw n.fail(`Failed to load model: ${r instanceof Error?r.message:"Unknown error"}`),r}}async startServer(o){let e=o??D({text:"Starting LM Studio server...",color:"cyan"}).start();try{let n=process.platform==="darwin",r=process.platform==="linux",l=process.platform==="win32",c;if(n?c="/Applications/LM Studio.app/Contents/MacOS/lm-studio":r?c=await this.findLinuxBinary():l&&(c=await this.findWindowsExecutable()),!c)throw e.fail("LM Studio not found. Please install it from https://lmstudio.ai"),new Error("LM Studio not installed");await k(c,["--server"],{detached:!0,stdio:"ignore",env:{...process.env,LM_STUDIO_SERVER_PORT:String(d.get("lmStudioPort"))}}),e.succeed("LM Studio server started"),await this.waitForServer(6e4)}catch(n){throw e.fail(`Failed to start LM Studio: ${n instanceof Error?n.message:"Unknown error"}`),n}}async findLinuxBinary(){let o=["/usr/bin/lm-studio","/usr/local/bin/lm-studio",`${process.env.HOME}/.local/bin/lm-studio`];for(let e of o)try{return await k("test",["-x",e]),e}catch{continue}}async findWindowsExecutable(){let o=process.env.LOCALAPPDATA,e=process.env.PROGRAMFILES,n=[o?`${o}\\Programs\\LM Studio\\lm-studio.exe`:"",e?`${e}\\LM Studio\\lm-studio.exe`:""].filter(Boolean);for(let r of n)try{return await k("cmd",["/c","if exist",`"${r}"`,"echo","yes"]),r}catch{continue}}async waitForServer(o=6e4){let e=Date.now();for(;Date.now()-e<o;){if(await this.checkStatus())return!0;await this.sleep(2e3)}return!1}sleep(o){return new Promise(e=>setTimeout(e,o))}async findAvailablePort(){for(let o of z)try{if((await fetch(`http://localhost:${o}/api/status`,{method:"GET",signal:AbortSignal.timeout(1e3)})).ok)return o}catch{return d.set("lmStudioPort",o),o}return z[0]??1234}},m=new M});var _={};A(_,{ClaudeService:()=>L,claudeService:()=>O});import{execa as U}from"execa";import Y from"chalk";var L,O,I=P(()=>{"use strict";L=class{async isClaudeCodeInstalled(){try{return await U("claude",["--version"],{stdio:"ignore"}),!0}catch{return!1}}async run(o){let{model:e,args:n=[],verbose:r=!1}=o,l=this.extractProvider(e),c=this.extractModelName(e);if(!l||!c)throw new Error(`Invalid model format: ${e}. Expected format: provider/model-name`);let g=`${l}/${c}`,u=["--model",g,...n];r&&console.log(Y.dim(`
3
+ Running: claude ${u.join(" ")}
4
+ `));try{await U("claude",u,{stdio:"inherit",env:{...process.env,ANTHROPIC_MODEL:g}})}catch(s){if(s instanceof Error&&"exitCode"in s){let C=s.exitCode;process.exit(C??1)}throw s}}extractProvider(o){return o.split("/")[0]}extractModelName(o){let e=o.split("/");if(!(e.length<2))return e.slice(1).join("/")}async getVersion(){try{return(await U("claude",["--version"])).stdout}catch{return}}},O=new L});import{Command as Z}from"commander";import a from"chalk";v();S();import W from"ora";import f from"chalk";import j from"inquirer";async function y(t,o){let e=t.map(l=>({name:`${l.name} (${l.id})`,value:l,short:l.name})),n=o?e.findIndex(l=>l.value.id===o):0;return(await j.prompt([{type:"list",name:"model",message:"Select a model to load:",choices:e,default:Math.max(0,n),pageSize:Math.min(t.length,15)}])).model}async function x(t,o=!0){return(await j.prompt([{type:"confirm",name:"confirm",message:t,default:o}])).confirm}import K from"chalk";function $(t){if(t===0)return"0 B";let o=1024,e=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(o));return`${parseFloat((t/Math.pow(o,n)).toFixed(2))} ${e[n]}`}function b(t){console.log(K.green("\u2713")+" "+t)}function X(t){console.error(K.red("\u2717")+" "+t)}function p(t,o=1){X(t),process.exit(o)}async function E(t={}){let o=W({text:"Checking LM Studio status...",color:"cyan"}).start(),e=await m.checkStatus();e||(o.info("LM Studio server not running"),o.stop(),await x("Would you like to start the LM Studio server?")||p("LM Studio server must be running. Start it manually or use the Server tab in LM Studio."),await m.startServer(),e=!0),o.succeed("Connected to LM Studio");let n=W({text:"Fetching available models...",color:"cyan"}).start(),r=await m.getAvailableModels();r.length===0&&(n.fail("No models found. Download some models in LM Studio first."),p("No models available")),n.succeed(`Found ${f.bold(r.length)} model${r.length===1?"":"s"}`),console.log(),console.log(f.bold("Available Models:")),console.log(f.dim("\u2500".repeat(process.stdout.columns||80))),r.forEach((s,C)=>{let H=$(s.size),V=s.loaded?f.green(" [LOADED]"):"";console.log(` ${f.dim(String(C+1).padStart(2))}. ${s.name} ${f.dim(`(${H})`)}${V}`)}),console.log();let l=d.getLastUsedModel(),c=t.model,g=c?r.find(s=>s.id===c||s.name.includes(c)):await y(r,l);g||p("No model selected"),await m.loadModel(g.id,o);let u=g.id.replace("/","--");b(f.bold(`
5
+ Model ready: ${g.name}`)),console.log(),console.log("Run Claude Code with this model:"),console.log(` ${f.cyan("claude --model lmstudio/"+u)}`),console.log(),console.log(`Or use ${f.cyan("npx aix run")} to start an interactive session`)}v();I();S();import G from"ora";import q from"chalk";async function R(t={}){let o=G({text:"Checking LM Studio status...",color:"cyan"}).start(),e=await m.checkStatus();e||(o.info("LM Studio server not running"),o.stop(),await x("Would you like to start the LM Studio server?")||p("LM Studio server must be running. Start it manually or use the Server tab in LM Studio."),await m.startServer(),e=!0),o.succeed("Connected to LM Studio"),o.text="Fetching available models...";let n=await m.getAvailableModels();n.length===0&&(o.fail("No models found. Download some models in LM Studio first."),p("No models available")),o.stop();let r;if(t.model){let u=n.find(s=>s.id===t.model||s.name.toLowerCase().includes(t.model.toLowerCase()));u||p(`Model "${t.model}" not found. Available models: ${n.map(s=>s.name).join(", ")}`),r=u.id}else{let u=d.getLastUsedModel();r=(await y(n,u)).id}let l=G({text:`Loading model: ${q.cyan(r)}`,color:"cyan"}).start();await m.loadModel(r,l);let g=`lmstudio/${r.replace("/","--")}`;b(q.green(`
6
+ Starting Claude Code with model: ${g}
7
+ `));try{await O.run({model:g,args:t.args??[],verbose:t.verbose})}catch(u){p(`Failed to run Claude Code: ${u instanceof Error?u.message:"Unknown error"}`)}}v();import i from"chalk";async function T(){let t=await m.getStatus();console.log(),console.log(i.bold("LM Studio Status")),console.log(i.dim("\u2500".repeat(50))),console.log(` ${t.running?i.green("\u25CF"):i.red("\u25CB")} Server: ${t.running?i.green("Running"):i.red("Stopped")}`),console.log(` ${i.dim("\u25B8")} Port: ${i.cyan(String(t.port))}`),console.log(` ${i.dim("\u25B8")} URL: ${i.cyan(`http://localhost:${t.port}`)}`),t.activeModel?console.log(` ${i.dim("\u25B8")} Active Model: ${i.green(t.activeModel)}`):console.log(` ${i.dim("\u25B8")} Active Model: ${i.dim("None")}`),console.log(),console.log(i.bold("Models")),console.log(i.dim("\u2500".repeat(50))),t.models.length===0?console.log(` ${i.dim("No models available")}`):t.models.forEach((o,e)=>{let n=$(o.size),r=o.id===t.activeModel?` ${i.green("[LOADED]")}`:"";console.log(` ${i.dim(String(e+1)+".")} ${o.name}${r}`),console.log(` ${i.dim("ID:")} ${o.id}`),console.log(` ${i.dim("Size:")} ${n}`),o.quantization&&console.log(` ${i.dim("Quantization:")} ${o.quantization}`),console.log()})}var h=new Z;h.name("aix").description("AI CLI tool integrating LM Studio with Claude Code").version("1.0.0");h.command("init").description("Initialize and load a model into LM Studio").option("-m, --model <name>","Model name or ID to load").action(E);h.command("run").description("Run Claude Code with a model from LM Studio").option("-m, --model <name>","Model name or ID to use").option("-v, --verbose","Show verbose output").argument("[args...]","Additional arguments for Claude Code").action(async(t,o)=>{await R({...o,args:t})});h.command("status").description("Show LM Studio status and available models").action(T);h.command("doctor").description("Check system requirements and configuration").action(async()=>{let{lmStudioService:t}=await Promise.resolve().then(()=>(v(),B)),{claudeService:o}=await Promise.resolve().then(()=>(I(),_)),{configService:e}=await Promise.resolve().then(()=>(S(),N));console.log(),console.log(a.bold("System Check")),console.log(a.dim("\u2500".repeat(50)));let n=await t.checkStatus();console.log(` ${n?a.green("\u2713"):a.yellow("\u26A0")} LM Studio: ${n?a.green("Running"):a.yellow("Not running")}`);let r=await o.isClaudeCodeInstalled();console.log(` ${r?a.green("\u2713"):a.red("\u2717")} Claude Code: ${r?a.green("Installed"):a.red("Not installed")}`),console.log(),console.log(a.bold("Configuration")),console.log(a.dim("\u2500".repeat(50))),console.log(` ${a.dim("\u25B8")} LM Studio URL: ${a.cyan(e.getLMStudioUrl())}`),r||(console.log(),console.log(a.yellow("\u26A0 Claude Code is not installed.")),console.log(` Install it with: ${a.cyan("npm install -g @anthropic-ai/claude-code")}`)),n||(console.log(),console.log(a.yellow("\u26A0 LM Studio is not running.")),console.log(` Start the server from the LM Studio app or download from ${a.cyan("https://lmstudio.ai")}`))});h.parse();
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/services/config.ts", "../../src/services/lmstudio.ts", "../../src/services/claude.ts", "../../src/index.ts", "../../src/commands/init.ts", "../../src/utils/prompt.ts", "../../src/utils/format.ts", "../../src/commands/run.ts", "../../src/commands/status.ts"],
4
+ "sourcesContent": ["import Conf from 'conf';\nimport type { Config } from '../types/index.js';\n\nexport class ConfigService {\n private store: Conf<Config>;\n\n constructor() {\n this.store = new Conf<Config>({\n projectName: 'aix',\n defaults: {\n lmStudioUrl: 'http://localhost',\n lmStudioPort: 1234,\n defaultTimeout: 30000,\n autoStartServer: false,\n },\n clearInvalidConfig: true,\n });\n }\n\n get<K extends keyof Config>(key: K): Config[K] {\n return this.store.get(key) as Config[K];\n }\n\n set<K extends keyof Config>(key: K, value: Config[K]): void {\n this.store.set(key, value as Config[K]);\n }\n\n setModel(model: string): void {\n this.store.set('model', model);\n }\n\n getLastUsedModel(): string | undefined {\n return this.store.get('model');\n }\n\n getLMStudioUrl(): string {\n const host = this.store.get('lmStudioUrl');\n const port = this.store.get('lmStudioPort');\n return `${host}:${port}`;\n }\n\n reset(): void {\n this.store.clear();\n }\n}\n\nexport const configService = new ConfigService();\n", "import { execa } from 'execa';\nimport ora, { type Ora } from 'ora';\nimport chalk from 'chalk';\nimport { configService } from './config.js';\nimport type { LMStudioStatus, LMStudioModel } from '../types/index.js';\n\nconst LMSTUDIO_PORTS = [1234, 1235, 1236, 1237];\n\nexport class LMStudioService {\n private baseUrl: string;\n\n constructor() {\n this.baseUrl = configService.getLMStudioUrl();\n }\n\n private getApiUrl(path: string): string {\n return `${this.baseUrl}${path}`;\n }\n\n async checkStatus(): Promise<boolean> {\n try {\n const response = await fetch(this.getApiUrl('/api/status'), {\n method: 'GET',\n signal: AbortSignal.timeout(3000),\n });\n return response.ok;\n } catch {\n return false;\n }\n }\n\n async getAvailableModels(): Promise<LMStudioModel[]> {\n try {\n const response = await fetch(this.getApiUrl('/api/models'), {\n method: 'GET',\n signal: AbortSignal.timeout(10000),\n });\n\n if (!response.ok) {\n throw new Error(`Failed to fetch models: ${response.statusText}`);\n }\n\n const data = (await response.json()) as {\n models: Array<{ id: string; name: string; size: number; quantization?: string }>;\n };\n return data.models ?? [];\n } catch (error) {\n throw new Error(\n `Unable to fetch models from LM Studio: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n }\n\n async getStatus(): Promise<LMStudioStatus> {\n const running = await this.checkStatus();\n\n if (!running) {\n return {\n running: false,\n port: configService.get('lmStudioPort'),\n models: [],\n };\n }\n\n try {\n const response = await fetch(this.getApiUrl('/api/status'), {\n method: 'GET',\n signal: AbortSignal.timeout(10000),\n });\n\n if (!response.ok) {\n return {\n running: false,\n port: configService.get('lmStudioPort'),\n models: [],\n };\n }\n\n const data = (await response.json()) as {\n models: LMStudioModel[];\n active_model?: string;\n };\n\n return {\n running: true,\n port: configService.get('lmStudioPort'),\n models: data.models ?? [],\n activeModel: data.active_model,\n };\n } catch {\n return {\n running: false,\n port: configService.get('lmStudioPort'),\n models: [],\n };\n }\n }\n\n async loadModel(modelId: string, spinner?: Ora): Promise<{ loadSpinner: Ora }> {\n const loadSpinner =\n spinner ??\n ora({\n text: `Loading model: ${chalk.cyan(modelId)}`,\n color: 'cyan',\n }).start();\n\n try {\n const response = await fetch(this.getApiUrl('/api/model/load'), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ model: modelId }),\n signal: AbortSignal.timeout(300000),\n });\n\n if (!response.ok) {\n throw new Error(`Failed to load model: ${response.statusText}`);\n }\n\n loadSpinner.succeed(`Model ${chalk.green(modelId)} loaded successfully`);\n configService.setModel(modelId);\n\n return { loadSpinner };\n } catch (error) {\n loadSpinner.fail(\n `Failed to load model: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n throw error;\n }\n }\n\n async startServer(spinner?: Ora): Promise<void> {\n const startSpinner =\n spinner ??\n ora({\n text: 'Starting LM Studio server...',\n color: 'cyan',\n }).start();\n\n try {\n const isMac = process.platform === 'darwin';\n const isLinux = process.platform === 'linux';\n const isWindows = process.platform === 'win32';\n\n let lmStudioPath: string | undefined;\n\n if (isMac) {\n lmStudioPath = '/Applications/LM Studio.app/Contents/MacOS/lm-studio';\n } else if (isLinux) {\n lmStudioPath = await this.findLinuxBinary();\n } else if (isWindows) {\n lmStudioPath = await this.findWindowsExecutable();\n }\n\n if (!lmStudioPath) {\n startSpinner.fail('LM Studio not found. Please install it from https://lmstudio.ai');\n throw new Error('LM Studio not installed');\n }\n\n await execa(lmStudioPath, ['--server'], {\n detached: true,\n stdio: 'ignore',\n env: {\n ...process.env,\n LM_STUDIO_SERVER_PORT: String(configService.get('lmStudioPort')),\n },\n });\n\n startSpinner.succeed('LM Studio server started');\n\n await this.waitForServer(60000);\n } catch (error) {\n startSpinner.fail(\n `Failed to start LM Studio: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n throw error;\n }\n }\n\n private async findLinuxBinary(): Promise<string | undefined> {\n const possiblePaths = [\n '/usr/bin/lm-studio',\n '/usr/local/bin/lm-studio',\n `${process.env.HOME}/.local/bin/lm-studio`,\n ];\n\n for (const path of possiblePaths) {\n try {\n await execa('test', ['-x', path]);\n return path;\n } catch {\n continue;\n }\n }\n\n return undefined;\n }\n\n private async findWindowsExecutable(): Promise<string | undefined> {\n const localAppData = process.env.LOCALAPPDATA;\n const programFiles = process.env.PROGRAMFILES;\n\n const possiblePaths = [\n localAppData ? `${localAppData}\\\\Programs\\\\LM Studio\\\\lm-studio.exe` : '',\n programFiles ? `${programFiles}\\\\LM Studio\\\\lm-studio.exe` : '',\n ].filter(Boolean);\n\n for (const path of possiblePaths) {\n try {\n await execa('cmd', ['/c', 'if exist', `\"${path}\"`, 'echo', 'yes']);\n return path;\n } catch {\n continue;\n }\n }\n\n return undefined;\n }\n\n async waitForServer(timeout: number = 60000): Promise<boolean> {\n const startTime = Date.now();\n\n while (Date.now() - startTime < timeout) {\n if (await this.checkStatus()) {\n return true;\n }\n await this.sleep(2000);\n }\n\n return false;\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n\n async findAvailablePort(): Promise<number> {\n for (const port of LMSTUDIO_PORTS) {\n try {\n const response = await fetch(`http://localhost:${port}/api/status`, {\n method: 'GET',\n signal: AbortSignal.timeout(1000),\n });\n if (response.ok) {\n return port;\n }\n } catch {\n configService.set('lmStudioPort', port);\n return port;\n }\n }\n\n return LMSTUDIO_PORTS[0] ?? 1234;\n }\n}\n\nexport const lmStudioService = new LMStudioService();\n", "import { execa } from 'execa';\nimport chalk from 'chalk';\n\nexport interface ClaudeOptions {\n model: string;\n args?: string[];\n verbose?: boolean;\n}\n\nexport class ClaudeService {\n async isClaudeCodeInstalled(): Promise<boolean> {\n try {\n await execa('claude', ['--version'], { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n }\n\n async run(options: ClaudeOptions): Promise<void> {\n const { model, args = [], verbose = false } = options;\n\n const provider = this.extractProvider(model);\n const modelName = this.extractModelName(model);\n\n if (!provider || !modelName) {\n throw new Error(`Invalid model format: ${model}. Expected format: provider/model-name`);\n }\n\n const modelArg = `${provider}/${modelName}`;\n const claudeArgs = ['--model', modelArg, ...args];\n\n if (verbose) {\n console.log(chalk.dim(`\\nRunning: claude ${claudeArgs.join(' ')}\\n`));\n }\n\n try {\n await execa('claude', claudeArgs, {\n stdio: 'inherit',\n env: {\n ...process.env,\n ANTHROPIC_MODEL: modelArg,\n },\n });\n } catch (error) {\n if (error instanceof Error && 'exitCode' in error) {\n const exitCode = (error as unknown as { exitCode: number }).exitCode;\n process.exit(exitCode ?? 1);\n }\n throw error;\n }\n }\n\n private extractProvider(model: string): string | undefined {\n const parts = model.split('/');\n return parts[0];\n }\n\n private extractModelName(model: string): string | undefined {\n const parts = model.split('/');\n if (parts.length < 2) return undefined;\n return parts.slice(1).join('/');\n }\n\n async getVersion(): Promise<string | undefined> {\n try {\n const result = await execa('claude', ['--version']);\n return result.stdout;\n } catch {\n return undefined;\n }\n }\n}\n\nexport const claudeService = new ClaudeService();\n", "#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport chalk from 'chalk';\nimport { initCommand, runCommand, statusCommand } from './commands/index.js';\n\nconst program = new Command();\n\nprogram\n .name('aix')\n .description('AI CLI tool integrating LM Studio with Claude Code')\n .version('1.0.0');\n\nprogram\n .command('init')\n .description('Initialize and load a model into LM Studio')\n .option('-m, --model <name>', 'Model name or ID to load')\n .action(initCommand);\n\nprogram\n .command('run')\n .description('Run Claude Code with a model from LM Studio')\n .option('-m, --model <name>', 'Model name or ID to use')\n .option('-v, --verbose', 'Show verbose output')\n .argument('[args...]', 'Additional arguments for Claude Code')\n .action(async (args: string[], options: Record<string, unknown>) => {\n await runCommand({\n ...options,\n args,\n });\n });\n\nprogram\n .command('status')\n .description('Show LM Studio status and available models')\n .action(statusCommand);\n\nprogram\n .command('doctor')\n .description('Check system requirements and configuration')\n .action(async () => {\n const { lmStudioService } = await import('./services/lmstudio.js');\n const { claudeService } = await import('./services/claude.js');\n const { configService } = await import('./services/config.js');\n\n console.log();\n console.log(chalk.bold('System Check'));\n console.log(chalk.dim('\u2500'.repeat(50)));\n\n const lmStudioRunning = await lmStudioService.checkStatus();\n console.log(\n ` ${lmStudioRunning ? chalk.green('\u2713') : chalk.yellow('\u26A0')} LM Studio: ${lmStudioRunning ? chalk.green('Running') : chalk.yellow('Not running')}`\n );\n\n const claudeInstalled = await claudeService.isClaudeCodeInstalled();\n console.log(\n ` ${claudeInstalled ? chalk.green('\u2713') : chalk.red('\u2717')} Claude Code: ${claudeInstalled ? chalk.green('Installed') : chalk.red('Not installed')}`\n );\n\n console.log();\n console.log(chalk.bold('Configuration'));\n console.log(chalk.dim('\u2500'.repeat(50)));\n console.log(` ${chalk.dim('\u25B8')} LM Studio URL: ${chalk.cyan(configService.getLMStudioUrl())}`);\n\n if (!claudeInstalled) {\n console.log();\n console.log(chalk.yellow('\u26A0 Claude Code is not installed.'));\n console.log(` Install it with: ${chalk.cyan('npm install -g @anthropic-ai/claude-code')}`);\n }\n\n if (!lmStudioRunning) {\n console.log();\n console.log(chalk.yellow('\u26A0 LM Studio is not running.'));\n console.log(\n ` Start the server from the LM Studio app or download from ${chalk.cyan('https://lmstudio.ai')}`\n );\n }\n });\n\nprogram.parse();\n", "import ora from 'ora';\nimport chalk from 'chalk';\nimport { lmStudioService } from '../services/lmstudio.js';\nimport { configService } from '../services/config.js';\nimport { selectModel, confirmAction } from '../utils/prompt.js';\nimport { formatBytes, success, exitWithError } from '../utils/format.js';\nimport type { InitOptions } from '../types/index.js';\n\nexport async function initCommand(options: InitOptions = {}): Promise<void> {\n const spinner = ora({\n text: 'Checking LM Studio status...',\n color: 'cyan',\n }).start();\n\n let isRunning = await lmStudioService.checkStatus();\n\n if (!isRunning) {\n spinner.info('LM Studio server not running');\n spinner.stop();\n\n const shouldStart = await confirmAction('Would you like to start the LM Studio server?');\n\n if (!shouldStart) {\n exitWithError(\n 'LM Studio server must be running. Start it manually or use the Server tab in LM Studio.'\n );\n }\n\n await lmStudioService.startServer();\n isRunning = true;\n }\n\n spinner.succeed('Connected to LM Studio');\n\n const modelsSpinner = ora({\n text: 'Fetching available models...',\n color: 'cyan',\n }).start();\n\n const models = await lmStudioService.getAvailableModels();\n\n if (models.length === 0) {\n modelsSpinner.fail('No models found. Download some models in LM Studio first.');\n exitWithError('No models available');\n }\n\n modelsSpinner.succeed(\n `Found ${chalk.bold(models.length)} model${models.length === 1 ? '' : 's'}`\n );\n\n console.log();\n console.log(chalk.bold('Available Models:'));\n console.log(chalk.dim('\u2500'.repeat(process.stdout.columns || 80)));\n\n models.forEach((model, index) => {\n const size = formatBytes(model.size);\n const loaded = model.loaded ? chalk.green(' [LOADED]') : '';\n console.log(\n ` ${chalk.dim(String(index + 1).padStart(2))}. ${model.name} ${chalk.dim(`(${size})`)}${loaded}`\n );\n });\n console.log();\n\n const lastUsedModel = configService.getLastUsedModel();\n const modelSearch = options.model;\n const selectedModel = modelSearch\n ? models.find((m) => m.id === modelSearch || m.name.includes(modelSearch))\n : await selectModel(models, lastUsedModel);\n\n if (!selectedModel) {\n exitWithError('No model selected');\n }\n\n await lmStudioService.loadModel(selectedModel.id, spinner);\n\n const modelIdentifier = selectedModel.id.replace('/', '--');\n\n success(chalk.bold(`\\nModel ready: ${selectedModel.name}`));\n console.log();\n console.log(`Run Claude Code with this model:`);\n console.log(` ${chalk.cyan('claude --model lmstudio/' + modelIdentifier)}`);\n console.log();\n console.log(`Or use ${chalk.cyan('npx aix run')} to start an interactive session`);\n}\n", "import inquirer from 'inquirer';\nimport type { LMStudioModel } from '../types/index.js';\n\nexport async function selectModel(\n models: LMStudioModel[],\n defaultModel?: string\n): Promise<LMStudioModel> {\n const choices = models.map((model) => ({\n name: `${model.name} (${model.id})`,\n value: model,\n short: model.name,\n }));\n\n const defaultIndex = defaultModel ? choices.findIndex((m) => m.value.id === defaultModel) : 0;\n\n const answers = await inquirer.prompt([\n {\n type: 'list',\n name: 'model',\n message: 'Select a model to load:',\n choices,\n default: Math.max(0, defaultIndex),\n pageSize: Math.min(models.length, 15),\n },\n ]);\n\n return answers['model'] as LMStudioModel;\n}\n\nexport async function confirmAction(\n message: string,\n defaultValue: boolean = true\n): Promise<boolean> {\n const answers = await inquirer.prompt([\n {\n type: 'confirm',\n name: 'confirm',\n message,\n default: defaultValue,\n },\n ]);\n\n return answers['confirm'] as boolean;\n}\n\nexport async function enterPrompt(message: string, defaultValue?: string): Promise<string> {\n const answers = await inquirer.prompt([\n {\n type: 'input',\n name: 'value',\n message,\n default: defaultValue,\n validate: (input: string) => input.trim().length > 0 || 'Please enter a value',\n },\n ]);\n\n return answers['value'] as string;\n}\n", "import chalk from \"chalk\";\n\nexport function formatBytes(bytes: number): string {\n if (bytes === 0) return \"0 B\";\n\n const k = 1024;\n const sizes = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;\n}\n\nexport function formatModelName(modelId: string): string {\n return modelId\n .replace(/^.*\\//, \"\")\n .replace(/[-_]/g, \" \")\n .replace(/\\b\\w/g, (c) => c.toUpperCase());\n}\n\nexport function truncate(str: string, maxLength: number): string {\n if (str.length <= maxLength) return str;\n return str.slice(0, maxLength - 3) + \"...\";\n}\n\nexport function promptSeparator(): void {\n console.log(chalk.dim(\"\u2500\".repeat(process.stdout.columns || 80)));\n}\n\nexport function success(message: string): void {\n console.log(chalk.green(\"\u2713\") + \" \" + message);\n}\n\nexport function error(message: string): void {\n console.error(chalk.red(\"\u2717\") + \" \" + message);\n}\n\nexport function info(message: string): void {\n console.log(chalk.blue(\"\u2139\") + \" \" + message);\n}\n\nexport function warn(message: string): void {\n console.log(chalk.yellow(\"\u26A0\") + \" \" + message);\n}\n\nexport function exitWithError(message: string, code: number = 1): never {\n error(message);\n process.exit(code);\n}\n", "import ora from 'ora';\nimport chalk from 'chalk';\nimport { lmStudioService } from '../services/lmstudio.js';\nimport { claudeService } from '../services/claude.js';\nimport { configService } from '../services/config.js';\nimport { selectModel, confirmAction } from '../utils/prompt.js';\nimport { exitWithError, success } from '../utils/format.js';\n\ninterface RunOptions {\n model?: string;\n verbose?: boolean;\n args?: string[];\n}\n\nexport async function runCommand(options: RunOptions = {}): Promise<void> {\n const spinner = ora({\n text: 'Checking LM Studio status...',\n color: 'cyan',\n }).start();\n\n let isRunning = await lmStudioService.checkStatus();\n\n if (!isRunning) {\n spinner.info('LM Studio server not running');\n spinner.stop();\n\n const shouldStart = await confirmAction('Would you like to start the LM Studio server?');\n\n if (!shouldStart) {\n exitWithError(\n 'LM Studio server must be running. Start it manually or use the Server tab in LM Studio.'\n );\n }\n\n await lmStudioService.startServer();\n isRunning = true;\n }\n\n spinner.succeed('Connected to LM Studio');\n\n spinner.text = 'Fetching available models...';\n const models = await lmStudioService.getAvailableModels();\n\n if (models.length === 0) {\n spinner.fail('No models found. Download some models in LM Studio first.');\n exitWithError('No models available');\n }\n\n spinner.stop();\n\n let selectedModelId: string;\n\n if (options.model) {\n const foundModel = models.find(\n (m) => m.id === options.model || m.name.toLowerCase().includes(options.model!.toLowerCase())\n );\n\n if (!foundModel) {\n exitWithError(\n `Model \"${options.model}\" not found. Available models: ${models.map((m) => m.name).join(', ')}`\n );\n }\n\n selectedModelId = foundModel.id;\n } else {\n const lastUsedModel = configService.getLastUsedModel();\n const selectedModel = await selectModel(models, lastUsedModel);\n selectedModelId = selectedModel.id;\n }\n\n const loadSpinner = ora({\n text: `Loading model: ${chalk.cyan(selectedModelId)}`,\n color: 'cyan',\n }).start();\n\n await lmStudioService.loadModel(selectedModelId, loadSpinner);\n\n const modelIdentifier = selectedModelId.replace('/', '--');\n const fullModelName = `lmstudio/${modelIdentifier}`;\n\n success(chalk.green(`\\nStarting Claude Code with model: ${fullModelName}\\n`));\n\n try {\n await claudeService.run({\n model: fullModelName,\n args: options.args ?? [],\n verbose: options.verbose,\n });\n } catch (error) {\n exitWithError(\n `Failed to run Claude Code: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n}\n", "import chalk from \"chalk\";\nimport { lmStudioService } from \"../services/lmstudio.js\";\nimport { formatBytes } from \"../utils/format.js\";\n\nexport async function statusCommand(): Promise<void> {\n const status = await lmStudioService.getStatus();\n\n console.log();\n console.log(chalk.bold(\"LM Studio Status\"));\n console.log(chalk.dim(\"\u2500\".repeat(50)));\n console.log(\n ` ${status.running ? chalk.green(\"\u25CF\") : chalk.red(\"\u25CB\")} Server: ${status.running ? chalk.green(\"Running\") : chalk.red(\"Stopped\")}`,\n );\n console.log(` ${chalk.dim(\"\u25B8\")} Port: ${chalk.cyan(String(status.port))}`);\n console.log(\n ` ${chalk.dim(\"\u25B8\")} URL: ${chalk.cyan(`http://localhost:${status.port}`)}`,\n );\n\n if (status.activeModel) {\n console.log(\n ` ${chalk.dim(\"\u25B8\")} Active Model: ${chalk.green(status.activeModel)}`,\n );\n } else {\n console.log(` ${chalk.dim(\"\u25B8\")} Active Model: ${chalk.dim(\"None\")}`);\n }\n\n console.log();\n console.log(chalk.bold(\"Models\"));\n console.log(chalk.dim(\"\u2500\".repeat(50)));\n\n if (status.models.length === 0) {\n console.log(` ${chalk.dim(\"No models available\")}`);\n } else {\n status.models.forEach((model, index) => {\n const size = formatBytes(model.size);\n const loaded =\n model.id === status.activeModel ? ` ${chalk.green(\"[LOADED]\")}` : \"\";\n console.log(\n ` ${chalk.dim(String(index + 1) + \".\")} ${model.name}${loaded}`,\n );\n console.log(` ${chalk.dim(\"ID:\")} ${model.id}`);\n console.log(` ${chalk.dim(\"Size:\")} ${size}`);\n if (model.quantization) {\n console.log(` ${chalk.dim(\"Quantization:\")} ${model.quantization}`);\n }\n console.log();\n });\n }\n}\n"],
5
+ "mappings": ";6HAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,EAAA,kBAAAC,IAAA,OAAOC,MAAU,OAAjB,IAGaF,EA2CAC,EA9CbE,EAAAC,EAAA,kBAGaJ,EAAN,KAAoB,CACjB,MAER,aAAc,CACZ,KAAK,MAAQ,IAAIE,EAAa,CAC5B,YAAa,MACb,SAAU,CACR,YAAa,mBACb,aAAc,KACd,eAAgB,IAChB,gBAAiB,EACnB,EACA,mBAAoB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,IAAID,EAAM,OAAO,kCAA6B,CAAC,EACvD,QAAQ,IACN,8DAA8DA,EAAM,KAAK,qBAAqB,CAAC,EACjG,EAEJ,CAAC,EAEHV,EAAQ,MAAM",
6
+ "names": ["config_exports", "__export", "ConfigService", "configService", "Conf", "init_config", "__esmMin", "key", "value", "model", "host", "port", "lmstudio_exports", "__export", "LMStudioService", "lmStudioService", "execa", "ora", "chalk", "LMSTUDIO_PORTS", "init_lmstudio", "__esmMin", "init_config", "configService", "path", "response", "error", "data", "modelId", "spinner", "loadSpinner", "startSpinner", "isMac", "isLinux", "isWindows", "lmStudioPath", "possiblePaths", "localAppData", "programFiles", "timeout", "startTime", "ms", "resolve", "port", "claude_exports", "__export", "ClaudeService", "claudeService", "execa", "chalk", "init_claude", "__esmMin", "options", "model", "args", "verbose", "provider", "modelName", "modelArg", "claudeArgs", "error", "exitCode", "parts", "Command", "chalk", "init_lmstudio", "init_config", "ora", "chalk", "inquirer", "selectModel", "models", "defaultModel", "choices", "model", "defaultIndex", "m", "confirmAction", "message", "defaultValue", "chalk", "formatBytes", "bytes", "k", "sizes", "i", "success", "message", "chalk", "error", "exitWithError", "message", "code", "error", "initCommand", "options", "spinner", "ora", "isRunning", "lmStudioService", "confirmAction", "exitWithError", "modelsSpinner", "models", "chalk", "model", "index", "size", "formatBytes", "loaded", "lastUsedModel", "configService", "modelSearch", "selectedModel", "m", "selectModel", "modelIdentifier", "success", "init_lmstudio", "init_claude", "init_config", "ora", "chalk", "runCommand", "options", "spinner", "ora", "isRunning", "lmStudioService", "confirmAction", "exitWithError", "models", "selectedModelId", "foundModel", "m", "lastUsedModel", "configService", "selectModel", "loadSpinner", "chalk", "fullModelName", "success", "claudeService", "error", "init_lmstudio", "chalk", "statusCommand", "status", "lmStudioService", "chalk", "model", "index", "size", "formatBytes", "loaded", "program", "Command", "initCommand", "args", "options", "runCommand", "statusCommand", "lmStudioService", "claudeService", "configService", "chalk", "lmStudioRunning", "claudeInstalled"]
7
+ }
@@ -0,0 +1,26 @@
1
+ export interface LMStudioModel {
2
+ id: string;
3
+ name: string;
4
+ size: number;
5
+ quantization?: string;
6
+ loaded?: boolean;
7
+ }
8
+ export interface LMStudioStatus {
9
+ running: boolean;
10
+ port: number;
11
+ models: LMStudioModel[];
12
+ activeModel?: string;
13
+ }
14
+ export interface Config {
15
+ lmStudioUrl: string;
16
+ lmStudioPort: number;
17
+ defaultTimeout: number;
18
+ autoStartServer: boolean;
19
+ model?: string;
20
+ }
21
+ export interface InitOptions {
22
+ model?: string;
23
+ port?: number;
24
+ }
25
+ export type ExitCode = 0 | 1;
26
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,MAAM;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare function formatBytes(bytes: number): string;
2
+ export declare function formatModelName(modelId: string): string;
3
+ export declare function truncate(str: string, maxLength: number): string;
4
+ export declare function promptSeparator(): void;
5
+ export declare function success(message: string): void;
6
+ export declare function error(message: string): void;
7
+ export declare function info(message: string): void;
8
+ export declare function warn(message: string): void;
9
+ export declare function exitWithError(message: string, code?: number): never;
10
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAU,GAAG,KAAK,CAGtE"}
@@ -0,0 +1,5 @@
1
+ import type { LMStudioModel } from '../types/index.js';
2
+ export declare function selectModel(models: LMStudioModel[], defaultModel?: string): Promise<LMStudioModel>;
3
+ export declare function confirmAction(message: string, defaultValue?: boolean): Promise<boolean>;
4
+ export declare function enterPrompt(message: string, defaultValue?: string): Promise<string>;
5
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/utils/prompt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,EAAE,EACvB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,CAAC,CAqBxB;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,YAAY,GAAE,OAAc,GAC3B,OAAO,CAAC,OAAO,CAAC,CAWlB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYzF"}
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@iamharshil/aix-cli",
3
+ "version": "1.0.2",
4
+ "description": "AI CLI tool that integrates LM Studio with Claude Code for enhanced development assistance",
5
+ "keywords": [
6
+ "cli",
7
+ "ai",
8
+ "lmstudio",
9
+ "claude",
10
+ "github",
11
+ "developer-tools",
12
+ "productivity",
13
+ "llm"
14
+ ],
15
+ "author": "Harshil <hello@iamharshil.com>",
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/iamharshil/aix-cli.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/iamharshil/aix-cli/issues"
23
+ },
24
+ "homepage": "https://github.com/iamharshil/aix-cli#readme",
25
+ "type": "module",
26
+ "main": "./dist/bin/aix.js",
27
+ "types": "./dist/index.d.ts",
28
+ "bin": {
29
+ "aix-cli": "./dist/bin/aix.js"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "README.md",
34
+ "LICENSE"
35
+ ],
36
+ "scripts": {
37
+ "build": "node scripts/build.js",
38
+ "prepublishOnly": "npm run build",
39
+ "dev": "tsx src/index.ts",
40
+ "start": "node bin/aix.js",
41
+ "test": "vitest run",
42
+ "test:watch": "vitest",
43
+ "lint": "eslint src --ext .ts",
44
+ "format": "prettier --write \"src/**/*.ts\"",
45
+ "typecheck": "tsc --noEmit"
46
+ },
47
+ "dependencies": {
48
+ "chalk": "^5.3.0",
49
+ "commander": "^12.0.0",
50
+ "conf": "^12.0.0",
51
+ "execa": "^9.0.0",
52
+ "inquirer": "^10.0.0",
53
+ "ora": "^8.0.0"
54
+ },
55
+ "devDependencies": {
56
+ "@types/inquirer": "^9.0.7",
57
+ "@types/node": "^20.11.0",
58
+ "@typescript-eslint/eslint-plugin": "^8.58.1",
59
+ "@typescript-eslint/parser": "^8.58.1",
60
+ "esbuild": "^0.28.0",
61
+ "eslint": "^8.56.0",
62
+ "prettier": "^3.2.0",
63
+ "tsx": "^4.7.0",
64
+ "typescript": "^5.3.0",
65
+ "vitest": "^1.2.0"
66
+ },
67
+ "engines": {
68
+ "node": ">=18.0.0"
69
+ },
70
+ "os": [
71
+ "darwin",
72
+ "linux",
73
+ "win32"
74
+ ]
75
+ }