Skip to content

Commit 7ecf2d7

Browse files
committed
chore: bump version to 1.0.6 and clean up README
- Remove version badge from README header for cleaner presentation - Update package.json version to 1.0.6 - Include build system improvements and plugin registry updates - Add build utilities for shebang handling Prepares for npm package publication with improved documentation and build process.
1 parent fc25599 commit 7ecf2d7

File tree

9 files changed

+76
-21
lines changed

9 files changed

+76
-21
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Houtini LM - LM Studio MCP Server with Expert Prompt Library and Custom Prompting
22

3-
**Version**: 1.0.1
43
**Your unlimited AI companion: This MCP server connects Claude to LM Studio for code analysis, generation, and creativity**
54

65
Transform your development workflow with our expert-level prompt library for code analysis, professional documentation generation, and creative project scaffolding - all running locally without API costs. For developers, vibe coders and creators alike.

add-shebang.mjs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import fs from 'fs';
2+
import path from 'path';
3+
import { fileURLToPath } from 'url';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
7+
8+
// Add shebang to index.js
9+
const indexPath = path.join(__dirname, 'dist', 'index.js');
10+
const content = fs.readFileSync(indexPath, 'utf8');
11+
12+
if (!content.startsWith('#!/usr/bin/env node')) {
13+
fs.writeFileSync(indexPath, '#!/usr/bin/env node\n' + content);
14+
console.log('Added shebang to dist/index.js');
15+
} else {
16+
console.log('Shebang already present in dist/index.js');
17+
}

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
"name": "@houtini/lm",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
4+
"type": "module",
45
"description": "Houtini LM - LM Studio MCP Server with Expert Prompt Library and Custom Prompting",
56
"main": "dist/index.js",
6-
"type": "module",
7+
"bin": {
8+
"houtini-lm": "dist/index.js"
9+
},
710
"scripts": {
8-
"build": "tsc && node add-shebang.js",
11+
"build": "tsc && node add-shebang.mjs",
912
"clean": "rimraf dist",
1013
"rebuild": "npm run clean && npm run build",
1114
"start": "node dist/index.js",

src/index.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ import {
1414
import { LMStudioClient } from '@lmstudio/sdk';
1515
import path from 'path';
1616
import { fileURLToPath } from 'url';
17+
import { dirname } from 'path';
18+
import { pathToFileURL } from 'url';
19+
import fs from 'fs';
1720
import { config } from './config.js';
1821
import { PluginLoader, PluginRegistry } from './plugins/index.js';
1922

20-
// Get current directory for plugin loading
23+
// ES module __dirname equivalent
2124
const __filename = fileURLToPath(import.meta.url);
22-
const __dirname = path.dirname(__filename);
25+
const __dirname = dirname(__filename);
2326

2427
class HoutiniLMServer {
2528
private server: Server;
@@ -99,18 +102,19 @@ class HoutiniLMServer {
99102
if (this.pluginsInitialized) return;
100103

101104
try {
102-
// Removed console.log to avoid JSON-RPC interference
105+
console.error('DEBUG: Starting plugin initialization...');
103106

104107
// Load plugins from prompts directory
105108
const promptsDir = path.join(__dirname, 'prompts');
109+
console.error('DEBUG: Loading from:', promptsDir);
106110
await this.pluginLoader.loadPlugins(promptsDir);
107111

108112
// Load system plugins
109113
await this.loadSystemPlugins();
110114

111115
this.pluginsInitialized = true;
112116

113-
// Silent initialization - no console output
117+
console.error('DEBUG: Plugins initialized successfully');
114118

115119
} catch (error) {
116120
// Silent error handling to avoid JSON-RPC interference
@@ -124,9 +128,8 @@ class HoutiniLMServer {
124128
private async loadSystemPlugins(): Promise<void> {
125129
try {
126130
const systemDir = path.join(__dirname, 'system');
127-
const { promises: fs } = await import('fs');
128131

129-
const files = await fs.readdir(systemDir);
132+
const files = fs.readdirSync(systemDir);
130133

131134
for (const file of files) {
132135
if (file.endsWith('.js')) { // Only load .js files, skip .d.ts
@@ -145,10 +148,10 @@ class HoutiniLMServer {
145148
*/
146149
private async loadSystemPlugin(filePath: string): Promise<void> {
147150
try {
148-
// Convert to proper file:// URL for Windows
149-
const fileUrl = `file:///${filePath.replace(/\\/g, '/')}`;
151+
// Use ES module dynamic import with proper URL
152+
const fileUrl = pathToFileURL(filePath).href;
150153
const module = await import(fileUrl);
151-
const PluginClass = module.default;
154+
const PluginClass = module.default || module.HealthCheckPlugin || module.PathResolverPlugin || Object.values(module)[0];
152155

153156
if (PluginClass && typeof PluginClass === 'function') {
154157
const plugin = new PluginClass();
@@ -198,8 +201,11 @@ class HoutiniLMServer {
198201
}
199202

200203
try {
204+
// Strip the houtini-lm: prefix to get the actual plugin name
205+
const pluginName = toolName.replace(/^houtini-lm:/, '');
206+
201207
// Execute plugin
202-
const result = await this.pluginLoader.executePlugin(toolName, args, this.lmStudioClient);
208+
const result = await this.pluginLoader.executePlugin(pluginName, args, this.lmStudioClient);
203209

204210
// Silent success - no console output
205211

src/plugins/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { IPromptPlugin } from './types.js';
88
import { BasePlugin } from './base-plugin.js';
99
import path from 'path';
1010
import { promises as fs } from 'fs';
11+
import { pathToFileURL } from 'url';
1112

1213
export class PluginLoader {
1314
private plugins: Map<string, IPromptPlugin> = new Map();
@@ -59,8 +60,8 @@ export class PluginLoader {
5960
return;
6061
}
6162

62-
// Convert Windows path to proper file:// URL
63-
const fileUrl = `file:///${filePath.replace(/\\/g, '/')}`;
63+
// Use pathToFileURL for proper ES module loading on Windows
64+
const fileUrl = pathToFileURL(filePath).href;
6465
const module = await import(fileUrl);
6566
const PluginClass = module.default;
6667

src/system/function-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { readdirSync, readFileSync } from 'fs';
22
import { join, extname, basename, dirname } from 'path';
33
import { fileURLToPath } from 'url';
44

5-
// ES module equivalent of __dirname
5+
// ES module __dirname equivalent
66
const __filename = fileURLToPath(import.meta.url);
77
const __dirname = dirname(__filename);
88

test-imports.mjs.bak

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { pathToFileURL } from 'url';
2+
import path from 'path';
3+
4+
async function testImport() {
5+
try {
6+
const filePath = path.join(process.cwd(), 'dist', 'prompts', 'analyze', 'single-file.js');
7+
console.log('Testing import of:', filePath);
8+
9+
const fileUrl = pathToFileURL(filePath).href;
10+
console.log('File URL:', fileUrl);
11+
12+
const module = await import(fileUrl);
13+
console.log('Module loaded:', Object.keys(module));
14+
15+
const PluginClass = module.default;
16+
console.log('Plugin class:', PluginClass?.name);
17+
18+
if (PluginClass) {
19+
const plugin = new PluginClass();
20+
console.log('Plugin instance:', plugin.name);
21+
}
22+
23+
} catch (error) {
24+
console.error('Import failed:', error);
25+
}
26+
}
27+
28+
testImport();

test-plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'console.log("Testing plugin load"); const plugin = require("./dist/system/health-check.js"); console.log("Plugin loaded:", plugin.HealthCheckPlugin);'

tsconfig.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
{
22
"compilerOptions": {
33
"target": "ES2020",
4-
"module": "ESNext",
4+
"module": "ES2020",
5+
"moduleResolution": "bundler",
56
"lib": ["ES2020"],
67
"outDir": "./dist",
78
"rootDir": "./src",
89
"strict": false,
910
"esModuleInterop": true,
11+
"allowSyntheticDefaultImports": true,
1012
"skipLibCheck": true,
1113
"forceConsistentCasingInFileNames": true,
12-
"moduleResolution": "node",
13-
"allowSyntheticDefaultImports": true,
1414
"resolveJsonModule": true,
1515
"declaration": true,
1616
"declarationMap": true,
@@ -26,4 +26,4 @@
2626
"src/__tests__",
2727
"src/enhanced-index.ts"
2828
]
29-
}
29+
}

0 commit comments

Comments
 (0)