first commit
This commit is contained in:
23
src/shared/package.json
Normal file
23
src/shared/package.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@mcpctl/shared",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc --build",
|
||||
"clean": "rimraf dist",
|
||||
"test": "vitest",
|
||||
"test:run": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"zod": "^3.24.0"
|
||||
}
|
||||
}
|
||||
5
src/shared/src/constants/index.ts
Normal file
5
src/shared/src/constants/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
// Shared constants
|
||||
export const APP_NAME = 'mcpctl';
|
||||
export const APP_VERSION = '0.1.0';
|
||||
export const DEFAULT_MCPD_URL = 'http://localhost:3000';
|
||||
export const DEFAULT_DB_PORT = 5432;
|
||||
4
src/shared/src/index.ts
Normal file
4
src/shared/src/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './types/index.js';
|
||||
export * from './validation/index.js';
|
||||
export * from './constants/index.js';
|
||||
export * from './utils/index.js';
|
||||
46
src/shared/src/types/index.ts
Normal file
46
src/shared/src/types/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
// Core domain types for mcpctl
|
||||
// These will be expanded as tasks are implemented
|
||||
|
||||
export interface McpServerConfig {
|
||||
name: string;
|
||||
type: string;
|
||||
command: string;
|
||||
args: string[];
|
||||
envTemplate: EnvTemplateEntry[];
|
||||
setupGuide?: string;
|
||||
}
|
||||
|
||||
export interface EnvTemplateEntry {
|
||||
name: string;
|
||||
description: string;
|
||||
isSecret: boolean;
|
||||
setupUrl?: string;
|
||||
defaultValue?: string;
|
||||
}
|
||||
|
||||
export interface McpProfile {
|
||||
name: string;
|
||||
serverId: string;
|
||||
config: Record<string, unknown>;
|
||||
filterRules?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface McpProject {
|
||||
name: string;
|
||||
description?: string;
|
||||
profileIds: string[];
|
||||
}
|
||||
|
||||
// Service interfaces for dependency injection
|
||||
export interface BackupService {
|
||||
exportConfig(): Promise<string>;
|
||||
importConfig(data: string): Promise<void>;
|
||||
}
|
||||
|
||||
export interface ConfigExporter {
|
||||
serialize(): Promise<Record<string, unknown>>;
|
||||
}
|
||||
|
||||
export interface ConfigImporter {
|
||||
deserialize(data: Record<string, unknown>): Promise<void>;
|
||||
}
|
||||
2
src/shared/src/utils/index.ts
Normal file
2
src/shared/src/utils/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
// Shared utility functions
|
||||
// Will be expanded as tasks are implemented
|
||||
4
src/shared/src/validation/index.ts
Normal file
4
src/shared/src/validation/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// Shared Zod validation schemas
|
||||
// Will be expanded as tasks are implemented
|
||||
|
||||
export { z } from 'zod';
|
||||
16
src/shared/tests/index.test.ts
Normal file
16
src/shared/tests/index.test.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { APP_NAME, APP_VERSION, DEFAULT_MCPD_URL } from '../src/constants/index.js';
|
||||
|
||||
describe('shared package', () => {
|
||||
it('exports APP_NAME constant', () => {
|
||||
expect(APP_NAME).toBe('mcpctl');
|
||||
});
|
||||
|
||||
it('exports APP_VERSION constant', () => {
|
||||
expect(APP_VERSION).toBe('0.1.0');
|
||||
});
|
||||
|
||||
it('exports DEFAULT_MCPD_URL constant', () => {
|
||||
expect(DEFAULT_MCPD_URL).toBe('http://localhost:3000');
|
||||
});
|
||||
});
|
||||
8
src/shared/tsconfig.json
Normal file
8
src/shared/tsconfig.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["src/**/*.ts"]
|
||||
}
|
||||
8
src/shared/vitest.config.ts
Normal file
8
src/shared/vitest.config.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { defineProject } from 'vitest/config';
|
||||
|
||||
export default defineProject({
|
||||
test: {
|
||||
name: 'shared',
|
||||
include: ['tests/**/*.test.ts'],
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user