Skip to content

Commit 98da0d0

Browse files
committed
added mcp ci config, upgrade all packages
1 parent b1f6afa commit 98da0d0

File tree

8 files changed

+149
-30
lines changed

8 files changed

+149
-30
lines changed

.github/workflows/mcp.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: MCP Server CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'renamify-mcp/**'
8+
- '.github/workflows/mcp.yml'
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- 'renamify-mcp/**'
13+
- '.github/workflows/mcp.yml'
14+
15+
defaults:
16+
run:
17+
working-directory: renamify-mcp
18+
19+
jobs:
20+
test:
21+
name: Test MCP Server
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, macos-latest, windows-latest]
26+
node-version: [18.x, 20.x]
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- uses: pnpm/action-setup@v2
32+
with:
33+
version: 8
34+
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: ${{ matrix.node-version }}
39+
cache: 'pnpm'
40+
cache-dependency-path: renamify-mcp/pnpm-lock.yaml
41+
42+
- name: Install dependencies
43+
run: pnpm install --frozen-lockfile
44+
45+
- name: Run TypeScript checks
46+
run: pnpm exec tsc --noEmit
47+
48+
- name: Run Biome checks
49+
run: pnpm run check
50+
51+
- name: Run tests
52+
run: pnpm test
53+
54+
- name: Build
55+
run: pnpm run build
56+
57+
coverage:
58+
name: Code Coverage
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- uses: pnpm/action-setup@v2
65+
with:
66+
version: 8
67+
68+
- name: Setup Node.js
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: 20.x
72+
cache: 'pnpm'
73+
cache-dependency-path: renamify-mcp/pnpm-lock.yaml
74+
75+
- name: Install dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Run tests with coverage
79+
run: pnpm exec vitest run --coverage
80+
81+
- name: Upload coverage to Codecov
82+
uses: codecov/codecov-action@v3
83+
with:
84+
files: ./renamify-mcp/coverage/coverage-final.json
85+
flags: mcp
86+
name: mcp-coverage

lefthook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ pre-commit:
3333
glob: "*.ts"
3434
run: pnpm run test
3535

36+
mcp-tsc:
37+
root: renamify-mcp/
38+
glob: "*.ts"
39+
run: tsc --noEmit
40+
3641
# pre-push:
3742
# commands:
3843
# test-all:

renamify-mcp/RELEASES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ cd renamify-mcp
4646
npm login
4747

4848
# Test the publish (dry run)
49-
npm publish --access public --dry-run
49+
npm publish --dry-run
5050

5151
# Actually publish
52-
npm publish --access public
52+
npm publish
5353
```
5454

5555
## Release Process

renamify-mcp/biome.jsonc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.1.4/schema.json",
3-
"extends": ["ultracite"]
2+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
3+
"extends": ["ultracite"],
4+
"overrides": [
5+
{
6+
"includes": ["**/*.test.ts", "**/*.spec.ts"],
7+
"linter": {
8+
"rules": {
9+
"style": {
10+
"noMagicNumbers": "off"
11+
}
12+
}
13+
}
14+
}
15+
]
416
}

renamify-mcp/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,17 @@
4040
"license": "MIT",
4141
"dependencies": {
4242
"@modelcontextprotocol/sdk": "^1.17.3",
43-
"execa": "^8.0.1",
44-
"zod": "^3.22.0"
43+
"execa": "^9.6.0",
44+
"zod": "^3.25.76"
4545
},
4646
"devDependencies": {
47-
"@biomejs/biome": "2.1.2",
48-
"@types/node": "^20.0.0",
49-
"tsx": "^4.0.0",
50-
"typescript": "^5.0.0",
51-
"ultracite": "5.1.2",
52-
"vitest": "^1.0.0"
47+
"@biomejs/biome": "2.2.0",
48+
"@types/node": "^24.3.0",
49+
"@vitest/coverage-v8": "^3.2.4",
50+
"tsx": "^4.20.4",
51+
"typescript": "^5.9.2",
52+
"ultracite": "5.1.8",
53+
"vitest": "^3.2.4"
5354
},
5455
"engines": {
5556
"node": ">=18.0.0"

renamify-mcp/src/renamify-service.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { access } from 'node:fs/promises';
22
import { join } from 'node:path';
33
import { type ExecaError, execa } from 'execa';
44

5-
export interface PlanOptions {
5+
export type PlanOptions = {
66
old: string;
77
new: string;
88
includes?: string[];
@@ -12,23 +12,23 @@ export interface PlanOptions {
1212
dryRun?: boolean;
1313
renameFiles?: boolean;
1414
renameDirs?: boolean;
15-
}
15+
};
1616

17-
export interface ApplyOptions {
17+
export type ApplyOptions = {
1818
planId?: string;
1919
planPath?: string;
2020
atomic?: boolean;
2121
commit?: boolean;
22-
}
22+
};
2323

24-
export interface PreviewOptions {
24+
export type PreviewOptions = {
2525
planId?: string;
2626
planPath?: string;
2727
format?: 'table' | 'diff' | 'json' | 'summary';
28-
}
28+
};
2929

3030
export class RenamifyService {
31-
private renamifyPath: string;
31+
private readonly renamifyPath: string;
3232

3333
constructor(renamifyPath?: string) {
3434
// Default to 'renamify' which should be in PATH
@@ -70,23 +70,23 @@ export class RenamifyService {
7070
}
7171

7272
private addIncludeArgs(args: string[], includes?: string[]): void {
73-
if (includes && includes.length > 0) {
73+
if (includes?.length) {
7474
for (const pattern of includes) {
7575
args.push('--include', pattern);
7676
}
7777
}
7878
}
7979

8080
private addExcludeArgs(args: string[], excludes?: string[]): void {
81-
if (excludes && excludes.length > 0) {
81+
if (excludes?.length) {
8282
for (const pattern of excludes) {
8383
args.push('--exclude', pattern);
8484
}
8585
}
8686
}
8787

8888
private addStylesArg(args: string[], styles?: string[]): void {
89-
if (styles && styles.length > 0) {
89+
if (styles?.length) {
9090
args.push('--styles', styles.join(','));
9191
}
9292
}
@@ -165,15 +165,23 @@ export class RenamifyService {
165165
/**
166166
* Undo a renaming
167167
*/
168-
async undo(id: string): Promise<string> {
169-
return await this.executeCommand(['undo', id], 'undo');
168+
async undo(id?: string): Promise<string> {
169+
const args = ['undo'];
170+
if (id) {
171+
args.push(id);
172+
}
173+
return await this.executeCommand(args, 'undo');
170174
}
171175

172176
/**
173177
* Redo a renaming
174178
*/
175-
async redo(id: string): Promise<string> {
176-
return await this.executeCommand(['redo', id], 'redo');
179+
async redo(id?: string): Promise<string> {
180+
const args = ['redo'];
181+
if (id) {
182+
args.push(id);
183+
}
184+
return await this.executeCommand(args, 'redo');
177185
}
178186

179187
/**

renamify-mcp/src/tools.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type {
66
} from './renamify-service.js';
77

88
export class RenamifyTools {
9-
private renamifyService: RenamifyService;
9+
private readonly renamifyService: RenamifyService;
1010

1111
constructor(renamifyService: RenamifyService) {
1212
this.renamifyService = renamifyService;
@@ -82,7 +82,7 @@ TROUBLESHOOTING:
8282
/**
8383
* Undo a renaming
8484
*/
85-
async undo(params: { id: string }): Promise<string> {
85+
async undo(params: { id?: string }): Promise<string> {
8686
try {
8787
const result = await this.renamifyService.undo(params.id);
8888
return `${result}
@@ -96,7 +96,7 @@ Renaming has been undone successfully.`;
9696
/**
9797
* Redo a renaming
9898
*/
99-
async redo(params: { id: string }): Promise<string> {
99+
async redo(params: { id?: string }): Promise<string> {
100100
try {
101101
const result = await this.renamifyService.redo(params.id);
102102
return `${result}

renamify-mcp/vitest.config.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ export default defineConfig({
66
environment: 'node',
77
coverage: {
88
provider: 'v8',
9-
reporter: ['text', 'json', 'html'],
9+
reporter: ['text', 'json', 'html', 'lcov'],
1010
exclude: [
1111
'node_modules/**',
1212
'dist/**',
1313
'**/*.test.ts',
1414
'**/*.spec.ts',
1515
'vitest.config.ts',
16+
'biome.config.ts',
1617
],
18+
thresholds: {
19+
branches: 80,
20+
functions: 80,
21+
lines: 80,
22+
statements: 80,
23+
},
1724
},
1825
},
1926
});

0 commit comments

Comments
 (0)