feat: create tm-core and apps/cli (#1093)
- add typescript - add npm workspaces
This commit is contained in:
@@ -7,6 +7,7 @@ import logger from './logger.js';
|
||||
import { registerTaskMasterTools } from './tools/index.js';
|
||||
import ProviderRegistry from '../../src/provider-registry/index.js';
|
||||
import { MCPProvider } from './providers/mcp-provider.js';
|
||||
import packageJson from '../../package.json' with { type: 'json' };
|
||||
|
||||
// Load environment variables
|
||||
dotenv.config();
|
||||
@@ -20,10 +21,6 @@ const __dirname = path.dirname(__filename);
|
||||
*/
|
||||
class TaskMasterMCPServer {
|
||||
constructor() {
|
||||
// Get version from package.json using synchronous fs
|
||||
const packagePath = path.join(__dirname, '../../package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf8'));
|
||||
|
||||
this.options = {
|
||||
name: 'Task Master MCP Server',
|
||||
version: packageJson.version
|
||||
|
||||
@@ -8,6 +8,7 @@ import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { contextManager } from '../core/context-manager.js'; // Import the singleton
|
||||
import { fileURLToPath } from 'url';
|
||||
import packageJson from '../../../package.json' with { type: 'json' };
|
||||
import { getCurrentTag } from '../../../scripts/modules/utils.js';
|
||||
|
||||
// Import path utilities to ensure consistent path resolution
|
||||
@@ -31,33 +32,12 @@ function getVersionInfo() {
|
||||
return cachedVersionInfo;
|
||||
}
|
||||
|
||||
try {
|
||||
// Navigate to the project root from the tools directory
|
||||
const packageJsonPath = path.join(
|
||||
path.dirname(__filename),
|
||||
'../../../package.json'
|
||||
);
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
||||
cachedVersionInfo = {
|
||||
version: packageJson.version,
|
||||
name: packageJson.name
|
||||
};
|
||||
return cachedVersionInfo;
|
||||
}
|
||||
cachedVersionInfo = {
|
||||
version: 'unknown',
|
||||
name: 'task-master-ai'
|
||||
};
|
||||
return cachedVersionInfo;
|
||||
} catch (error) {
|
||||
// Fallback version info if package.json can't be read
|
||||
cachedVersionInfo = {
|
||||
version: 'unknown',
|
||||
name: 'task-master-ai'
|
||||
};
|
||||
return cachedVersionInfo;
|
||||
}
|
||||
// Use the imported packageJson directly
|
||||
cachedVersionInfo = {
|
||||
version: packageJson.version || 'unknown',
|
||||
name: packageJson.name || 'task-master-ai'
|
||||
};
|
||||
return cachedVersionInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user