Skip to content

Commit 434eeb5

Browse files
refactor: rename and reorganize files
1 parent dd39dfc commit 434eeb5

File tree

9 files changed

+26
-25
lines changed

9 files changed

+26
-25
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,13 +292,14 @@ All operations return a status code and message in their response:
292292

293293
```
294294
src/
295-
├── index.ts # Main entry point
296-
├── cli.ts # CLI for task approval and listing
295+
├── index.ts # Main entry point
296+
├── client/
297+
│ └── cli.ts # CLI for user task review and approval
297298
├── server/
298-
│ └── TaskManagerServer.ts # Core server functionality
299+
│ ├── TaskManager.ts # Core service functionality
300+
│ └── tools.ts # MCP tool definitions
299301
└── types/
300-
├── index.ts # Type definitions and schemas
301-
└── tools.ts # MCP tool definitions
302+
└── index.ts # Type definitions and schemas
302303
```
303304

304305
## Data Schema and Storage

index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
44
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5-
import { TaskManagerServer } from "./src/server/TaskManagerServer.js";
6-
import { ALL_TOOLS } from "./src/types/tools.js";
5+
import { TaskManager } from "./src/server/TaskManager.js";
6+
import { ALL_TOOLS } from "./src/server/tools.js";
77
import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
88

99
// Create server with capabilities BEFORE setting up handlers
@@ -29,7 +29,7 @@ console.error('Server starting with env:', {
2929
});
3030

3131
// Initialize task manager
32-
const taskManager = new TaskManagerServer();
32+
const taskManager = new TaskManager();
3333

3434
// Set up request handlers AFTER capabilities are configured
3535
server.setRequestHandler(ListToolsRequestSchema, async () => {

src/cli.ts renamed to src/client/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Command } from "commander";
44
import * as fs from "node:fs/promises";
55
import * as path from "node:path";
66
import * as os from "node:os";
7-
import { TaskManagerFile } from "./types/index.js";
7+
import { TaskManagerFile } from "../types/index.js";
88
import chalk from "chalk";
99

1010
const program = new Command();

src/server/TaskManagerServer.ts renamed to src/server/TaskManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const getAppDataDir = () => {
2525
const DEFAULT_PATH = path.join(getAppDataDir(), "tasks.json");
2626
const TASK_FILE_PATH = process.env.TASK_MANAGER_FILE_PATH || DEFAULT_PATH;
2727

28-
export class TaskManagerServer {
28+
export class TaskManager {
2929
private projectCounter = 0;
3030
private taskCounter = 0;
3131
private data: TaskManagerFile = { projects: [] };
File renamed without changes.

tests/integration/cli.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as os from "node:os";
55
import { promisify } from "util";
66

77
const execAsync = promisify(exec);
8-
const CLI_PATH = path.resolve(process.cwd(), "src/cli.ts");
8+
const CLI_PATH = path.resolve(process.cwd(), "src/client/cli.ts");
99

1010
describe("CLI Integration Tests", () => {
1111
let tempDir: string;

tests/integration/server.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { ALL_TOOLS } from '../../src/types/tools.js';
2-
import { TaskManagerServer } from '../../src/server/TaskManagerServer.js';
1+
import { ALL_TOOLS } from '../../src/server/tools.js';
2+
import { TaskManager } from '../../src/server/TaskManager.js';
33
import * as os from 'node:os';
44
import * as path from 'node:path';
55
import * as fs from 'node:fs/promises';
66
import { Task } from '../../src/types/index.js';
77

8-
describe('TaskManagerServer Integration', () => {
9-
let server: TaskManagerServer;
8+
describe('TaskManager Integration', () => {
9+
let server: TaskManager;
1010
let tempDir: string;
1111
let testFilePath: string;
1212

@@ -17,7 +17,7 @@ describe('TaskManagerServer Integration', () => {
1717
testFilePath = path.join(tempDir, 'test-tasks.json');
1818

1919
// Initialize the server with the test file path
20-
server = new TaskManagerServer(testFilePath);
20+
server = new TaskManager(testFilePath);
2121
});
2222

2323
afterEach(async () => {
@@ -484,7 +484,7 @@ describe('TaskManagerServer Integration', () => {
484484
]);
485485

486486
// Create a new server instance pointing to the same file
487-
const newServer = new TaskManagerServer(testFilePath);
487+
const newServer = new TaskManager(testFilePath);
488488

489489
// Verify the data was loaded correctly
490490
const result = await newServer.listProjects("open");
@@ -499,13 +499,13 @@ describe('TaskManagerServer Integration', () => {
499499
}
500500

501501
// Create another server instance and verify the changes persisted
502-
const thirdServer = new TaskManagerServer(testFilePath);
502+
const thirdServer = new TaskManager(testFilePath);
503503
const pendingResult = await thirdServer.listTasks(project.projectId, "pending_approval");
504504
expect(pendingResult.tasks!.length).toBe(1);
505505
});
506506

507507
it("should handle tool/rule recommendations end-to-end", async () => {
508-
const server = new TaskManagerServer(testFilePath);
508+
const server = new TaskManager(testFilePath);
509509

510510
// Create a project with tasks that have recommendations
511511
const { projectId } = await server.createProject("Test Project", [

tests/unit/TaskManagerServer.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import { describe, it, expect } from '@jest/globals';
2-
import { ALL_TOOLS } from '../../src/types/tools.js';
2+
import { ALL_TOOLS } from '../../src/server/tools.js';
33
import { VALID_STATUS_TRANSITIONS, Task } from '../../src/types/index.js';
4-
import { TaskManagerServer } from '../../src/server/TaskManagerServer.js';
4+
import { TaskManager } from '../../src/server/TaskManager.js';
55
import { mockTaskManagerData } from '../helpers/mocks.js';
66
import * as os from 'node:os';
77
import * as path from 'node:path';
88
import * as fs from 'node:fs/promises';
99

10-
describe('TaskManagerServer', () => {
11-
let server: TaskManagerServer;
10+
describe('TaskManager', () => {
11+
let server: TaskManager;
1212
let tempDir: string;
1313
let tasksFilePath: string;
1414

1515
beforeEach(async () => {
1616
tempDir = path.join(os.tmpdir(), `task-manager-test-${Date.now()}`);
1717
await fs.mkdir(tempDir, { recursive: true });
1818
tasksFilePath = path.join(tempDir, "test-tasks.json");
19-
server = new TaskManagerServer(tasksFilePath);
19+
server = new TaskManager(tasksFilePath);
2020
});
2121

2222
afterEach(async () => {

tests/unit/tools.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { jest, describe, it, expect } from '@jest/globals';
2-
import { ALL_TOOLS } from '../../src/types/tools.js';
2+
import { ALL_TOOLS } from '../../src/server/tools.js';
33
import { Tool } from '@modelcontextprotocol/sdk/types.js';
44

55
interface SchemaProperty {

0 commit comments

Comments
 (0)