lynkr 3.0.0 → 3.2.0

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/docs/index.md CHANGED
@@ -4,8 +4,9 @@
4
4
  <script defer data-url="https://devhunt.org/tool/lynkr" src="https://cdn.jsdelivr.net/gh/sidiDev/devhunt-banner/indexV0.js"></script>
5
5
 
6
6
 
7
- # Lynkr – Claude Code-Compatible Proxy for Databricks
8
- #### Lynkr is an open-source Claude Code-compatible proxy that allows the Claude Code CLI to run directly with any LLMs without losing the features offered by Anthropic backend. It supports MCP servers, Git workflows, repo intelligence, workspace tools, prompt caching for LLM-powered development and many other features.
7
+ # Lynkr - Production-Ready Claude Code Proxy with Multi-Provider Support, MCP Integration & Token Optimization
8
+
9
+ #### Lynkr is an open-source, production-ready Claude Code proxy that enables the Claude Code CLI to work with any LLM provider (Databricks, OpenRouter, Ollama, Azure, OpenAI, llama.cpp) without losing Anthropic backend features. It features MCP server orchestration, Git workflows, repo intelligence, workspace tools, prompt caching, and 60-80% token optimization for cost-effective LLM-powered development.
9
10
  <!--
10
11
  SEO Keywords:
11
12
  Databricks, Claude Code, Anthropic, Azure Anthropic,
@@ -14,6 +15,9 @@ developer tools, proxy, git automation, AI developer tools,
14
15
  prompt caching, Node.js
15
16
  -->
16
17
 
18
+ ## šŸ”– Keywords
19
+
20
+ `claude-code` `claude-proxy` `anthropic-api` `databricks-llm` `openrouter-integration` `ollama-local` `llama-cpp` `azure-openai` `azure-anthropic` `mcp-server` `prompt-caching` `token-optimization` `ai-coding-assistant` `llm-proxy` `self-hosted-ai` `git-automation` `code-generation` `developer-tools` `ci-cd-automation` `llm-gateway` `cost-reduction` `multi-provider-llm`
17
21
 
18
22
  ---
19
23
 
@@ -28,21 +32,21 @@ prompt caching, Node.js
28
32
 
29
33
  # šŸš€ What is Lynkr?
30
34
 
31
- **Lynkr** is an open-source **Claude Code-compatible backend proxy** that lets you run the **Claude Code CLI** and Claude-style tools **directly against Databricks** or **Azure-hosted Anthropic models** instead of the default Anthropic cloud.
35
+ **Lynkr** is an open-source **Claude Code-compatible backend proxy** that lets you run the **Claude Code CLI** and Claude-style tools **directly against [Databricks, Azure, OpenRouter, Ollama, and llama.cpp](#-configuration-guide-for-multi-provider-support-databricks-azure-openrouter-ollama-llamacpp)** instead of the default Anthropic cloud.
32
36
 
33
37
  It enables full repo-aware LLM workflows:
34
38
 
35
- - code navigation
36
- - diff review
37
- - Git operations
38
- - test execution
39
- - workspace tools
40
- - Model Context Protocol (MCP) servers
41
- - repo indexing and project intelligence
42
- - prompt caching
43
- - conversational sessions
39
+ - code navigation
40
+ - diff review
41
+ - [Git operations](#git-tools-and-workflow-automation)
42
+ - test execution
43
+ - workspace tools
44
+ - [Model Context Protocol (MCP) servers](#full-model-context-protocol-mcp-integration)
45
+ - [repo indexing and project intelligence](#-repo-intelligence--indexing)
46
+ - [prompt caching](#prompt-caching-lru--ttl)
47
+ - [conversational sessions with long-term memory](#-long-term-memory-system-titans-inspired)
44
48
 
45
- This makes Databricks a first-class environment for **AI-assisted software development**, **LLM agents**, **automated refactoring**, **debugging**, and **ML/ETL workflow exploration**.
49
+ This makes Databricks and other providers a first-class environment for **AI-assisted software development**, **LLM agents**, **automated refactoring**, **debugging**, and **ML/ETL workflow exploration**.
46
50
 
47
51
  ---
48
52
 
@@ -170,7 +174,60 @@ Databricks / Azure Anthropic / OpenRouter / Ollama / llama.cpp
170
174
 
171
175
  ````
172
176
 
173
- Key directories:
177
+ ## Request Flow Visualization
178
+
179
+ ```mermaid
180
+ graph TB
181
+ A[Claude Code CLI] -->|HTTP POST /v1/messages| B[Lynkr Proxy Server]
182
+ B --> C{Middleware Stack}
183
+ C -->|Load Shedding| D{Load OK?}
184
+ D -->|Yes| E[Request Logging]
185
+ D -->|No| Z1[503 Service Unavailable]
186
+ E --> F[Metrics Collection]
187
+ F --> G[Input Validation]
188
+ G --> H[Orchestrator]
189
+
190
+ H --> I{Check Prompt Cache}
191
+ I -->|Cache Hit| J[Return Cached Response]
192
+ I -->|Cache Miss| K{Determine Provider}
193
+
194
+ K -->|Simple 0-2 tools| L[Ollama Local]
195
+ K -->|Moderate 3-14 tools| M[OpenRouter / Azure]
196
+ K -->|Complex 15+ tools| N[Databricks]
197
+
198
+ L --> O[Circuit Breaker Check]
199
+ M --> O
200
+ N --> O
201
+
202
+ O -->|Closed| P{Provider API}
203
+ O -->|Open| Z2[Fallback Provider]
204
+
205
+ P -->|Databricks| Q1[Databricks API]
206
+ P -->|OpenRouter| Q2[OpenRouter API]
207
+ P -->|Ollama| Q3[Ollama Local]
208
+ P -->|Azure| Q4[Azure Anthropic API]
209
+ P -->|llama.cpp| Q5[llama.cpp Server]
210
+
211
+ Q1 --> R[Response Processing]
212
+ Q2 --> R
213
+ Q3 --> R
214
+ Q4 --> R
215
+ Q5 --> R
216
+ Z2 --> R
217
+
218
+ R --> S[Format Conversion]
219
+ S --> T[Cache Response]
220
+ T --> U[Update Metrics]
221
+ U --> V[Return to Client]
222
+ J --> V
223
+
224
+ style B fill:#4a90e2,stroke:#333,stroke-width:2px,color:#fff
225
+ style H fill:#7b68ee,stroke:#333,stroke-width:2px,color:#fff
226
+ style K fill:#f39c12,stroke:#333,stroke-width:2px
227
+ style P fill:#2ecc71,stroke:#333,stroke-width:2px,color:#fff
228
+ ```
229
+
230
+ **Key directories:**
174
231
 
175
232
  - `src/api` → Claude-compatible API proxy
176
233
  - `src/orchestrator` → LLM agent runtime loop
@@ -182,7 +239,7 @@ Key directories:
182
239
 
183
240
  ---
184
241
 
185
- # āš™ Installation
242
+ # āš™ Getting Started: Installation & Setup Guide
186
243
 
187
244
  ## Global install (recommended)
188
245
  ```bash
@@ -208,7 +265,7 @@ npm start
208
265
 
209
266
  ---
210
267
 
211
- # šŸ”§ Configuring Providers
268
+ # šŸ”§ Configuration Guide for Multi-Provider Support (Databricks, Azure, OpenRouter, Ollama, llama.cpp)
212
269
 
213
270
  ## Databricks Setup
214
271
 
@@ -664,12 +721,87 @@ This "working nature" allows Lynkr to not just execute commands, but to **learn
664
721
 
665
722
  ---
666
723
 
724
+ # šŸ“š References & Further Reading
725
+
726
+ ## Academic & Technical Resources
727
+
728
+ **Agentic AI Systems:**
729
+ - **Zhang et al. (2024)**. *Agentic Context Engineering*. arXiv:2510.04618. [arXiv](https://arxiv.org/abs/2510.04618)
730
+
731
+ **Long-Term Memory & RAG:**
732
+ - **Mohtashami & Jaggi (2023)**. *Landmark Attention: Random-Access Infinite Context Length for Transformers*. [arXiv](https://arxiv.org/abs/2305.16300)
733
+ - **Google DeepMind (2024)**. *Titans: Learning to Memorize at Test Time*. [arXiv](https://arxiv.org/abs/2411.07043)
734
+
735
+ ## Official Documentation
736
+
737
+ - [Claude Code CLI Documentation](https://docs.anthropic.com/en/docs/build-with-claude/claude-for-sheets) - Official Claude Code reference
738
+ - [Model Context Protocol (MCP) Specification](https://spec.modelcontextprotocol.io/) - MCP protocol documentation
739
+ - [Databricks Foundation Models](https://docs.databricks.com/en/machine-learning/foundation-models/index.html) - Databricks LLM documentation
740
+ - [Anthropic API Documentation](https://docs.anthropic.com/en/api/getting-started) - Claude API reference
741
+
742
+ ## Related Projects & Tools
743
+
744
+ - [Ollama](https://ollama.ai/) - Local LLM runtime for running open-source models
745
+ - [OpenRouter](https://openrouter.ai/) - Multi-provider LLM API gateway (100+ models)
746
+ - [llama.cpp](https://github.com/ggerganov/llama.cpp) - High-performance C++ LLM inference engine
747
+ - [LiteLLM](https://github.com/BerriAI/litellm) - Multi-provider LLM proxy (alternative approach)
748
+ - [Awesome MCP Servers](https://github.com/punkpeye/awesome-mcp-servers) - Curated list of MCP server implementations
749
+
750
+ ---
751
+
752
+ # 🌟 Community & Adoption
753
+
754
+ ## Get Involved
755
+
756
+ **⭐ Star this repository** to show your support and help others discover Lynkr!
757
+
758
+ [![GitHub stars](https://img.shields.io/github/stars/vishalveerareddy123/Lynkr?style=social)](https://github.com/vishalveerareddy123/Lynkr)
759
+
760
+ ## Support & Resources
761
+
762
+ - šŸ› **Report Issues:** [GitHub Issues](https://github.com/vishalveerareddy123/Lynkr/issues) - Bug reports and feature requests
763
+ - šŸ’¬ **Discussions:** [GitHub Discussions](https://github.com/vishalveerareddy123/Lynkr/discussions) - Questions, ideas, and community help
764
+ - šŸ“š **Documentation:** [DeepWiki](https://deepwiki.com/vishalveerareddy123/Lynkr) - Comprehensive guides and examples
765
+ - šŸ”§ **Contributing:** [CONTRIBUTING.md](https://github.com/vishalveerareddy123/Lynkr/blob/main/CONTRIBUTING.md) - How to contribute to Lynkr
766
+
767
+ ## Share Lynkr
768
+
769
+ Help spread the word about Lynkr:
770
+
771
+ - 🐦 [Share on Twitter](https://twitter.com/intent/tweet?text=Check%20out%20Lynkr%20-%20a%20production-ready%20Claude%20Code%20proxy%20with%20multi-provider%20support%20and%2060-80%25%20token%20savings!&url=https://github.com/vishalveerareddy123/Lynkr&hashtags=AI,ClaudeCode,LLM,OpenSource)
772
+ - šŸ’¼ [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https://github.com/vishalveerareddy123/Lynkr)
773
+ - šŸ“° [Share on Hacker News](https://news.ycombinator.com/submitlink?u=https://github.com/vishalveerareddy123/Lynkr&t=Lynkr%20-%20Production-Ready%20Claude%20Code%20Proxy)
774
+ - šŸ“± [Share on Reddit](https://www.reddit.com/submit?url=https://github.com/vishalveerareddy123/Lynkr&title=Lynkr%20-%20Production-Ready%20Claude%20Code%20Proxy%20with%20Multi-Provider%20Support)
775
+
776
+ ## Why Developers Choose Lynkr
777
+
778
+ - šŸ’° **Massive cost savings** - Save 60-80% on token costs with built-in optimization
779
+ - šŸ”“ **Provider freedom** - Choose from 7+ LLM providers (Databricks, OpenRouter, Ollama, Azure, llama.cpp)
780
+ - šŸ  **Privacy & control** - Self-hosted, open-source, no vendor lock-in
781
+ - šŸš€ **Production-ready** - Enterprise features: circuit breakers, metrics, health checks
782
+ - šŸ› ļø **Active development** - Regular updates, responsive maintainers, growing community
783
+
784
+ ---
785
+
667
786
  # šŸ”— Links
668
787
 
669
788
  * **GitHub**: [https://github.com/vishalveerareddy123/Lynkr](https://github.com/vishalveerareddy123/Lynkr)
670
789
  * **Docs**: [https://deepwiki.com/vishalveerareddy123/Lynkr](https://deepwiki.com/vishalveerareddy123/Lynkr)
671
790
  * **Issues**: [https://github.com/vishalveerareddy123/Lynkr/issues](https://github.com/vishalveerareddy123/Lynkr/issues)
672
791
 
673
- If you use Databricks or Azure Anthropic and want rich Claude Code workflows, Lynkr gives you the control and extensibility you need.
792
+ ---
793
+
794
+ ## šŸš€ Ready to Get Started?
795
+
796
+ **Reduce your Claude Code costs by 60-80% today:**
797
+
798
+ 1. ⭐ **[Star this repo](https://github.com/vishalveerareddy123/Lynkr)** to show support and stay updated
799
+ 2. šŸ“– **[Install Lynkr](#-getting-started-installation--setup-guide)** and configure your preferred provider
800
+ 3. šŸ’¬ **[Join the Discussion](https://github.com/vishalveerareddy123/Lynkr/discussions)** for community support
801
+ 4. šŸ› **[Report Issues](https://github.com/vishalveerareddy123/Lynkr/issues)** to help improve Lynkr
802
+
803
+ ---
804
+
805
+ If you use Databricks, Azure Anthropic, OpenRouter, Ollama, or llama.cpp and want rich Claude Code workflows with massive cost savings, Lynkr gives you the control, flexibility, and extensibility you need.
674
806
 
675
- Feel free to open issues, contribute tools, or integrate with MCP servers!
807
+ Feel free to open issues, contribute tools, integrate with MCP servers, or help us improve the documentation!
package/install.sh CHANGED
@@ -16,7 +16,7 @@ BLUE='\033[0;34m'
16
16
  NC='\033[0m' # No Color
17
17
 
18
18
  # Configuration
19
- REPO_URL="https://github.com/vishalveerareddy123/Lynkr"
19
+ REPO_URL="https://github.com/Fast-Editor/Lynkr"
20
20
  INSTALL_DIR="${LYNKR_INSTALL_DIR:-$HOME/.lynkr}"
21
21
  BRANCH="${LYNKR_BRANCH:-main}"
22
22
 
@@ -115,12 +115,19 @@ install_dependencies() {
115
115
  # Create default .env file
116
116
  create_env_file() {
117
117
  if [ ! -f "$INSTALL_DIR/.env" ]; then
118
- print_info "Creating default .env file..."
119
- cp "$INSTALL_DIR/.env.example" "$INSTALL_DIR/.env" 2>/dev/null || cat > "$INSTALL_DIR/.env" << 'EOF'
118
+ print_info "Creating .env configuration file..."
119
+
120
+ # Try to copy from .env.example (comprehensive configuration)
121
+ if [ -f "$INSTALL_DIR/.env.example" ]; then
122
+ cp "$INSTALL_DIR/.env.example" "$INSTALL_DIR/.env"
123
+ print_success "Created .env from .env.example (all features documented)"
124
+ else
125
+ # Fallback: create minimal .env if .env.example doesn't exist
126
+ cat > "$INSTALL_DIR/.env" << 'EOF'
120
127
  # Lynkr Configuration
121
- # See .env.example for all options
128
+ # For full options, see: https://github.com/vishalveerareddy123/Lynkr/blob/main/.env.example
122
129
 
123
- # Model Provider (databricks, openai, azure-openai, azure-anthropic, openrouter, ollama)
130
+ # Model Provider (databricks, openai, azure-openai, azure-anthropic, openrouter, ollama, llamacpp)
124
131
  MODEL_PROVIDER=ollama
125
132
 
126
133
  # Server Configuration
@@ -131,13 +138,29 @@ PREFER_OLLAMA=true
131
138
  OLLAMA_MODEL=qwen2.5-coder:7b
132
139
  OLLAMA_ENDPOINT=http://localhost:11434
133
140
 
134
- # Uncomment and configure your preferred provider:
141
+ # Long-Term Memory System (Titans-Inspired) - Enabled by default
142
+ MEMORY_ENABLED=true
143
+ MEMORY_RETRIEVAL_LIMIT=5
144
+ MEMORY_SURPRISE_THRESHOLD=0.3
145
+
146
+ # Uncomment and configure your preferred cloud provider:
135
147
  # OPENAI_API_KEY=sk-your-key
136
148
  # OPENROUTER_API_KEY=your-key
137
149
  # DATABRICKS_API_KEY=your-key
138
150
  # DATABRICKS_API_BASE=https://your-workspace.databricks.com
139
151
  EOF
140
- print_success "Created .env file (edit to configure your API keys)"
152
+ print_success "Created basic .env file"
153
+ fi
154
+
155
+ echo ""
156
+ print_info "šŸ“ Configuration ready! Key settings:"
157
+ echo " • Default provider: Ollama (local, offline)"
158
+ echo " • Memory system: Enabled (learns from conversations)"
159
+ echo " • Port: 8080"
160
+ echo ""
161
+ print_warning "To use cloud providers (Databricks/OpenAI/Azure):"
162
+ echo " Edit: ${BLUE}nano $INSTALL_DIR/.env${NC}"
163
+ echo " Add your API keys and change MODEL_PROVIDER"
141
164
  else
142
165
  print_warning ".env file already exists, skipping"
143
166
  fi
@@ -180,23 +203,47 @@ print_next_steps() {
180
203
  print_success "Lynkr installed successfully!"
181
204
  echo "=============================="
182
205
  echo ""
183
- echo "Next steps:"
206
+ echo "šŸš€ Quick Start Guide:"
184
207
  echo ""
185
- echo " 1. Configure your API keys:"
186
- echo " ${BLUE}nano $INSTALL_DIR/.env${NC}"
208
+ echo " ${GREEN}Option A: Use Ollama (Free, Local, Offline)${NC}"
209
+ echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
210
+ echo ""
211
+ echo " 1. Install Ollama (if not already installed):"
212
+ echo " ${BLUE}lynkr-setup${NC} ${GREEN}← Automatic Ollama installer${NC}"
187
213
  echo ""
188
214
  echo " 2. Start Lynkr:"
189
- echo " ${BLUE}cd $INSTALL_DIR && npm start${NC}"
190
- echo " or"
191
- echo " ${BLUE}lynkr${NC} (if in PATH)"
215
+ echo " ${BLUE}lynkr${NC}"
192
216
  echo ""
193
- echo " 3. Configure Claude CLI to use Lynkr:"
217
+ echo " 3. Configure Claude Code CLI:"
194
218
  echo " ${BLUE}export ANTHROPIC_BASE_URL=http://localhost:8080${NC}"
219
+ echo " ${BLUE}claude${NC}"
195
220
  echo ""
196
- echo " 4. Run Claude Code:"
221
+ echo " ${YELLOW}Option B: Use Cloud Providers (Databricks/OpenAI/Azure)${NC}"
222
+ echo " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
223
+ echo ""
224
+ echo " 1. Edit configuration file:"
225
+ echo " ${BLUE}nano $INSTALL_DIR/.env${NC}"
226
+ echo ""
227
+ echo " Update these lines:"
228
+ echo " ${BLUE}MODEL_PROVIDER=databricks${NC} ${GREEN}← Change from 'ollama'${NC}"
229
+ echo " ${BLUE}DATABRICKS_API_KEY=dapi_xxxxx${NC} ${GREEN}← Add your key${NC}"
230
+ echo " ${BLUE}DATABRICKS_API_BASE=https://your-workspace.databricks.com${NC}"
231
+ echo ""
232
+ echo " 2. Start Lynkr:"
233
+ echo " ${BLUE}lynkr${NC}"
234
+ echo ""
235
+ echo " 3. Configure Claude Code CLI:"
236
+ echo " ${BLUE}export ANTHROPIC_BASE_URL=http://localhost:8080${NC}"
237
+ echo " ${BLUE}export ANTHROPIC_API_KEY=any-non-empty-value${NC} ${GREEN}← Placeholder${NC}"
197
238
  echo " ${BLUE}claude${NC}"
198
239
  echo ""
199
- echo "Documentation: https://github.com/vishalveerareddy123/Lynkr"
240
+ echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
241
+ echo ""
242
+ echo "šŸ’” ${YELLOW}Tip:${NC} Memory system is enabled by default"
243
+ echo " Lynkr remembers preferences and project context across sessions"
244
+ echo ""
245
+ echo "šŸ“š Documentation: ${BLUE}https://github.com/vishalveerareddy123/Lynkr${NC}"
246
+ echo "šŸ’¬ Discord: ${BLUE}https://discord.gg/qF7DDxrX${NC}"
200
247
  echo ""
201
248
  }
202
249
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lynkr",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Self-hosted Claude Code proxy with Databricks,Azure adapters, openrouter, Ollama,llamacpp, workspace tooling, and MCP integration.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "mcp"
30
30
  ],
31
31
  "author": "Vishal Veera Reddy",
32
- "license": "MIT",
32
+ "license": "Apache-2.0",
33
33
  "repository": {
34
34
  "type": "git",
35
35
  "url": "https://github.com/vishalveerareddy123/Lynkr.git"
package/scripts/setup.js CHANGED
@@ -192,17 +192,18 @@ async function startOllama() {
192
192
  return true;
193
193
  }
194
194
 
195
- async function pullModel(modelName = "llama3.1:8b") {
195
+ async function pullModel(modelName = "qwen2.5-coder:7b") {
196
196
  log(`\nšŸ“¦ Downloading ${modelName} model...`, "cyan");
197
197
  log(" Model size: ~4.7GB", "blue");
198
+ log(" Best for: Code generation, tool calling, technical tasks", "blue");
198
199
  log(" This may take 10-30 minutes depending on your connection.", "yellow");
199
- log(" You can cancel and run this later with: ollama pull llama3.1:8b\n", "yellow");
200
+ log(` You can cancel and run this later with: ollama pull ${modelName}\n`, "yellow");
200
201
 
201
202
  const answer = await promptUser(" Continue with model download? [Y/n]: ");
202
203
 
203
204
  if (answer === "n" || answer === "no") {
204
205
  log("\nā­ļø Skipping model download", "yellow");
205
- log(" You can download it later with: ollama pull llama3.1:8b", "cyan");
206
+ log(` You can download it later with: ollama pull ${modelName}`, "cyan");
206
207
  return false;
207
208
  }
208
209
 
@@ -212,7 +213,7 @@ async function pullModel(modelName = "llama3.1:8b") {
212
213
  return true;
213
214
  } catch (error) {
214
215
  log(`\nāŒ Failed to download model: ${error.message}`, "red");
215
- log(" You can download it later with: ollama pull llama3.1:8b", "yellow");
216
+ log(` You can download it later with: ollama pull ${modelName}`, "yellow");
216
217
  return false;
217
218
  }
218
219
  }
@@ -230,90 +231,163 @@ async function createEnvFile() {
230
231
 
231
232
  if (answer !== "y" && answer !== "yes") {
232
233
  log(" Keeping existing .env file", "yellow");
233
- return;
234
+ return "existing";
234
235
  }
235
236
  }
236
237
 
238
+ // Ask user about their setup preference
239
+ log("\n Configuration Mode:", "cyan");
240
+ log(" 1. Ollama Only (Free, Local, Offline)", "blue");
241
+ log(" 2. Hybrid (Ollama + Cloud Fallback)", "blue");
242
+ const mode = await promptUser(" Choose [1/2] (default: 1): ");
243
+
244
+ const ollamaOnly = !mode || mode === "1";
245
+
237
246
  // Copy .env.example to .env if it exists
238
247
  if (fs.existsSync(envExamplePath)) {
239
248
  fs.copyFileSync(envExamplePath, envPath);
240
- log("āœ… Created .env file from template", "green");
241
- log("\n āš ļø Please edit .env and add your Databricks credentials:", "yellow");
242
- log(" - DATABRICKS_API_BASE", "cyan");
243
- log(" - DATABRICKS_API_KEY", "cyan");
249
+
250
+ // Update for Ollama-only mode if selected
251
+ if (ollamaOnly) {
252
+ let envContent = fs.readFileSync(envPath, "utf-8");
253
+ envContent = envContent.replace(/^# MODEL_PROVIDER=databricks/m, "MODEL_PROVIDER=ollama");
254
+ envContent = envContent.replace(/^PREFER_OLLAMA=true/m, "# PREFER_OLLAMA=true # Not needed when MODEL_PROVIDER=ollama");
255
+ envContent = envContent.replace(/^FALLBACK_ENABLED=true/m, "FALLBACK_ENABLED=false");
256
+ fs.writeFileSync(envPath, envContent);
257
+ }
258
+
259
+ log("āœ… Created .env file from comprehensive template", "green");
260
+
261
+ if (ollamaOnly) {
262
+ log("\n āœ… Configured for Ollama-only mode (no cloud credentials needed)", "green");
263
+ log(" šŸ’” Memory system enabled by default (learns from conversations)", "cyan");
264
+ } else {
265
+ log("\n āš ļø To enable cloud fallback, edit .env and add your credentials:", "yellow");
266
+ log(" - DATABRICKS_API_KEY (or OPENAI_API_KEY, etc.)", "cyan");
267
+ log(" šŸ’” Memory system enabled by default (learns from conversations)", "cyan");
268
+ }
269
+
270
+ return ollamaOnly ? "ollama-only" : "hybrid";
244
271
  } else {
245
- // Create minimal .env file
246
- const envContent = `# Lynkr Configuration
247
- PREFER_OLLAMA=true
272
+ // Create minimal .env file if .env.example doesn't exist
273
+ const envContent = `# Lynkr Configuration (Generated by lynkr-setup)
274
+ # Full options: https://github.com/vishalveerareddy123/Lynkr/blob/main/.env.example
275
+
276
+ # Model Provider
277
+ MODEL_PROVIDER=${ollamaOnly ? "ollama" : "databricks"}
278
+
279
+ # Ollama Configuration
248
280
  OLLAMA_ENDPOINT=http://localhost:11434
249
- OLLAMA_MODEL=llama3.1:8b
250
- FALLBACK_PROVIDER=databricks
251
- FALLBACK_ENABLED=true
281
+ OLLAMA_MODEL=qwen2.5-coder:7b
252
282
 
253
- # Add your Databricks credentials below
254
- DATABRICKS_API_BASE=https://your-workspace.cloud.databricks.com
255
- DATABRICKS_API_KEY=your-databricks-pat-token
283
+ # Fallback Configuration
284
+ FALLBACK_ENABLED=${ollamaOnly ? "false" : "true"}
285
+ FALLBACK_PROVIDER=databricks
256
286
 
287
+ # Server Configuration
257
288
  PORT=8080
258
289
  LOG_LEVEL=info
259
- `;
290
+
291
+ # Long-Term Memory System (Titans-Inspired)
292
+ MEMORY_ENABLED=true
293
+ MEMORY_RETRIEVAL_LIMIT=5
294
+ MEMORY_SURPRISE_THRESHOLD=0.3
295
+ MEMORY_FORMAT=compact
296
+
297
+ ${ollamaOnly ? "# Cloud credentials not needed for Ollama-only mode\n" : "# Add your cloud provider credentials:\n# DATABRICKS_API_BASE=https://your-workspace.cloud.databricks.com\n# DATABRICKS_API_KEY=your-key\n"}`;
260
298
 
261
299
  fs.writeFileSync(envPath, envContent);
262
300
  log("āœ… Created .env file with default configuration", "green");
263
- log("\n āš ļø Please edit .env and add your Databricks credentials:", "yellow");
264
- log(" - DATABRICKS_API_BASE", "cyan");
265
- log(" - DATABRICKS_API_KEY", "cyan");
301
+
302
+ if (ollamaOnly) {
303
+ log("\n āœ… Configured for Ollama-only mode (no cloud credentials needed)", "green");
304
+ log(" šŸ’” Memory system enabled by default", "cyan");
305
+ } else {
306
+ log("\n āš ļø Please edit .env and add your cloud credentials", "yellow");
307
+ log(" šŸ’” Memory system enabled by default", "cyan");
308
+ }
309
+
310
+ return ollamaOnly ? "ollama-only" : "hybrid";
266
311
  }
267
312
  }
268
313
 
269
- async function printSummary(modelDownloaded) {
314
+ async function printSummary(modelDownloaded, mode) {
270
315
  log("\n" + "=".repeat(60), "green");
271
316
  log("šŸŽ‰ Lynkr Setup Complete!", "green");
272
317
  log("=".repeat(60), "green");
273
318
 
274
- log("\nšŸ“‹ What was installed:", "cyan");
275
- log(" āœ… Ollama service", "green");
319
+ log("\nšŸ“‹ What was configured:", "cyan");
320
+ log(" āœ… Ollama service (running)", "green");
276
321
  if (modelDownloaded) {
277
- log(" āœ… llama3.1:8b model", "green");
322
+ log(" āœ… qwen2.5-coder:7b model (ready)", "green");
278
323
  } else {
279
- log(" ā­ļø Model (skipped - run: ollama pull llama3.1:8b)", "yellow");
324
+ log(" ā­ļø Model (skipped - run: ollama pull qwen2.5-coder:7b)", "yellow");
280
325
  }
326
+ log(` āœ… Configuration mode: ${mode === "ollama-only" ? "Ollama Only" : mode === "hybrid" ? "Hybrid" : "Unknown"}`, "green");
327
+ log(" āœ… Long-term memory system (enabled)", "green");
328
+ log(" āœ… Token optimization (60-80% savings)", "green");
281
329
 
282
330
  log("\nšŸš€ Next Steps:", "cyan");
283
331
 
284
332
  if (!modelDownloaded) {
285
- log(" 1. Download model: ollama pull llama3.1:8b", "blue");
286
- log(" 2. Edit .env with your Databricks credentials", "blue");
287
- log(" 3. Start Lynkr: lynkr", "blue");
333
+ log(" 1. Download model: ollama pull qwen2.5-coder:7b", "blue");
334
+ if (mode === "hybrid") {
335
+ log(" 2. Edit .env with your cloud provider credentials", "blue");
336
+ log(" 3. Start Lynkr: lynkr", "blue");
337
+ log(" 4. Configure Claude Code CLI:", "blue");
338
+ } else {
339
+ log(" 2. Start Lynkr: lynkr", "blue");
340
+ log(" 3. Configure Claude Code CLI:", "blue");
341
+ }
288
342
  } else {
289
- log(" 1. Edit .env with your Databricks credentials", "blue");
290
- log(" 2. Start Lynkr: lynkr", "blue");
343
+ if (mode === "hybrid") {
344
+ log(" 1. Edit .env with your cloud provider credentials", "blue");
345
+ log(" 2. Start Lynkr: lynkr", "blue");
346
+ log(" 3. Configure Claude Code CLI:", "blue");
347
+ } else {
348
+ log(" 1. Start Lynkr: lynkr", "blue");
349
+ log(" 2. Configure Claude Code CLI:", "blue");
350
+ }
291
351
  }
292
352
 
293
- log("\nšŸ“š Documentation:", "cyan");
294
- log(" - README.md - Full documentation", "blue");
295
- log(" - DEPLOYMENT.md - Deployment options", "blue");
296
- log(" - TESTING.md - Testing guide", "blue");
353
+ log(" export ANTHROPIC_BASE_URL=http://localhost:8080", "cyan");
354
+ log(" export ANTHROPIC_API_KEY=placeholder", "cyan");
355
+ log(" " + (mode === "hybrid" && !modelDownloaded ? "4" : modelDownloaded && mode === "ollama-only" ? "3" : "4") + ". Run Claude Code: claude", "blue");
297
356
 
298
357
  log("\nšŸ’” Quick Commands:", "cyan");
299
358
  log(" lynkr Start Lynkr server", "blue");
300
359
  log(" ollama list List downloaded models", "blue");
301
360
  log(" ollama pull <model> Download a model", "blue");
302
- log(" ollama serve Start Ollama manually", "blue");
361
+ log(" ollama serve Start Ollama service", "blue");
303
362
 
304
363
  log("\n🌐 Endpoints:", "cyan");
305
- log(" http://localhost:8080 Lynkr API", "blue");
306
- log(" http://localhost:11434 Ollama API", "blue");
364
+ log(" http://localhost:8080 Lynkr API", "blue");
365
+ log(" http://localhost:11434 Ollama API", "blue");
366
+ log(" http://localhost:8080/health Health check", "blue");
367
+
368
+ log("\nšŸ“š Resources:", "cyan");
369
+ log(" Documentation: https://github.com/vishalveerareddy123/Lynkr", "blue");
370
+ log(" Discord: https://discord.gg/qF7DDxrX", "blue");
371
+ log(" Issues: https://github.com/vishalveerareddy123/Lynkr/issues", "blue");
372
+
373
+ if (mode === "ollama-only") {
374
+ log("\nšŸ’” Tip: You're running in Ollama-only mode (100% free!)", "cyan");
375
+ log(" No API keys needed. All processing happens locally.", "cyan");
376
+ log(" To enable cloud fallback later, edit .env", "cyan");
377
+ } else if (mode === "hybrid") {
378
+ log("\nšŸ’” Tip: Hybrid mode saves costs by using Ollama for simple requests", "cyan");
379
+ log(" and cloud providers only when needed.", "cyan");
380
+ }
307
381
 
308
382
  log("\n");
309
383
  }
310
384
 
311
385
  async function main() {
312
386
  log("\n" + "=".repeat(60), "bright");
313
- log("šŸ”§ Lynkr Setup Wizard", "bright");
387
+ log("šŸ”§ Lynkr Setup Wizard v3.1.0", "bright");
314
388
  log("=".repeat(60), "bright");
315
389
  log("\nThis wizard will help you set up Lynkr with Ollama.", "blue");
316
- log("Ollama enables local, cost-free AI inference with hybrid routing.\n", "blue");
390
+ log("Ollama enables local, cost-free AI inference with optional cloud fallback.\n", "blue");
317
391
 
318
392
  try {
319
393
  // Step 1: Check/Install Ollama
@@ -342,10 +416,10 @@ async function main() {
342
416
  const modelDownloaded = await pullModel();
343
417
 
344
418
  // Step 4: Create .env file
345
- await createEnvFile();
419
+ const mode = await createEnvFile();
346
420
 
347
421
  // Step 5: Print summary
348
- await printSummary(modelDownloaded);
422
+ await printSummary(modelDownloaded, mode);
349
423
 
350
424
  } catch (error) {
351
425
  log(`\nāŒ Setup failed: ${error.message}`, "red");