Skip to content

Commit b30fbae

Browse files
committed
format
1 parent 77d9203 commit b30fbae

File tree

87 files changed

+1265
-597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+1265
-597
lines changed

β€Žepicshop/fix.jsβ€Ž

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ const VERBOSE = false
1212
const logVerbose = (...args) => (VERBOSE ? console.log(...args) : undefined)
1313

1414
const workshopRoot = here('..')
15-
const examples = (await readDir(here('../examples'))).map(dir =>
15+
const examples = (await readDir(here('../examples'))).map((dir) =>
1616
here(`../examples/${dir}`),
1717
)
1818
const exercises = (await readDir(here('../exercises')))
19-
.map(name => here(`../exercises/${name}`))
20-
.filter(filepath => fs.statSync(filepath).isDirectory())
19+
.map((name) => here(`../exercises/${name}`))
20+
.filter((filepath) => fs.statSync(filepath).isDirectory())
2121
const exerciseApps = (
2222
await Promise.all(
23-
exercises.flatMap(async exercise => {
23+
exercises.flatMap(async (exercise) => {
2424
return (await readDir(exercise))
25-
.filter(dir => {
25+
.filter((dir) => {
2626
return /(problem|solution)/.test(dir)
2727
})
28-
.map(dir => path.join(exercise, dir))
28+
.map((dir) => path.join(exercise, dir))
2929
}),
3030
)
3131
).flat()
32-
const exampleApps = (await readDir(here('../examples'))).map(dir =>
32+
const exampleApps = (await readDir(here('../examples'))).map((dir) =>
3333
here(`../examples/${dir}`),
3434
)
3535
const apps = [...exampleApps, ...exerciseApps]
3636

37-
const appsWithPkgJson = [...examples, ...apps].filter(app => {
37+
const appsWithPkgJson = [...examples, ...apps].filter((app) => {
3838
const pkgjsonPath = path.join(app, 'package.json')
3939
return exists(pkgjsonPath)
4040
})
@@ -70,7 +70,7 @@ async function updateTsconfig() {
7070
const tsconfig = {
7171
files: [],
7272
exclude: ['node_modules'],
73-
references: appsWithPkgJson.map(a => ({
73+
references: appsWithPkgJson.map((a) => ({
7474
path: relativeToWorkshopRoot(a).replace(/\\/g, '/'),
7575
})),
7676
}

β€Žexercises/01.ping/01.problem.connect/src/index.test.tsβ€Ž

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ beforeAll(async () => {
1313
command: 'tsx',
1414
args: ['src/index.ts'],
1515
})
16-
16+
1717
try {
1818
await client.connect(transport)
1919
} catch (error: any) {
20-
console.error('🚨 Connection failed! This exercise requires implementing the main function in src/index.ts')
21-
console.error('🚨 Replace the "throw new Error(\'Not implemented\')" with the actual MCP server setup')
22-
console.error('🚨 You need to: 1) Create an EpicMeMCP instance, 2) Initialize it, 3) Connect to stdio transport')
20+
console.error(
21+
'🚨 Connection failed! This exercise requires implementing the main function in src/index.ts',
22+
)
23+
console.error(
24+
'🚨 Replace the "throw new Error(\'Not implemented\')" with the actual MCP server setup',
25+
)
26+
console.error(
27+
'🚨 You need to: 1) Create an EpicMeMCP instance, 2) Initialize it, 3) Connect to stdio transport',
28+
)
2329
console.error('Original error:', error.message || error)
2430
throw error
2531
}
@@ -36,9 +42,16 @@ test('Ping', async () => {
3642
} catch (error: any) {
3743
if (error.message?.includes('Connection closed') || error.code === -32000) {
3844
console.error('🚨 Ping failed because the MCP server crashed!')
39-
console.error('🚨 This means the main() function in src/index.ts is not properly implemented')
40-
console.error('🚨 Check that you\'ve replaced the "Not implemented" error with actual server setup code')
41-
const enhancedError = new Error('🚨 MCP server implementation required in main() function. ' + (error.message || error))
45+
console.error(
46+
'🚨 This means the main() function in src/index.ts is not properly implemented',
47+
)
48+
console.error(
49+
'🚨 Check that you\'ve replaced the "Not implemented" error with actual server setup code',
50+
)
51+
const enhancedError = new Error(
52+
'🚨 MCP server implementation required in main() function. ' +
53+
(error.message || error),
54+
)
4255
enhancedError.stack = error.stack
4356
throw enhancedError
4457
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"extends": ["@epic-web/config/typescript"],
3-
"include": ["types/**/*.d.ts", "src/**/*.ts"]
2+
"extends": ["@epic-web/config/typescript"],
3+
"include": ["types/**/*.d.ts", "src/**/*.ts"]
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import "@epic-web/config/reset.d.ts";
1+
import '@epic-web/config/reset.d.ts'

β€Žexercises/01.ping/01.solution.connect/src/index.test.tsβ€Ž

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ beforeAll(async () => {
1313
command: 'tsx',
1414
args: ['src/index.ts'],
1515
})
16-
16+
1717
try {
1818
await client.connect(transport)
1919
} catch (error: any) {
20-
console.error('🚨 Connection failed! This exercise requires implementing the main function in src/index.ts')
21-
console.error('🚨 Replace the "throw new Error(\'Not implemented\')" with the actual MCP server setup')
22-
console.error('🚨 You need to: 1) Create an EpicMeMCP instance, 2) Initialize it, 3) Connect to stdio transport')
20+
console.error(
21+
'🚨 Connection failed! This exercise requires implementing the main function in src/index.ts',
22+
)
23+
console.error(
24+
'🚨 Replace the "throw new Error(\'Not implemented\')" with the actual MCP server setup',
25+
)
26+
console.error(
27+
'🚨 You need to: 1) Create an EpicMeMCP instance, 2) Initialize it, 3) Connect to stdio transport',
28+
)
2329
console.error('Original error:', error.message || error)
2430
throw error
2531
}
@@ -36,9 +42,16 @@ test('Ping', async () => {
3642
} catch (error: any) {
3743
if (error.message?.includes('Connection closed') || error.code === -32000) {
3844
console.error('🚨 Ping failed because the MCP server crashed!')
39-
console.error('🚨 This means the main() function in src/index.ts is not properly implemented')
40-
console.error('🚨 Check that you\'ve replaced the "Not implemented" error with actual server setup code')
41-
const enhancedError = new Error('🚨 MCP server implementation required in main() function. ' + (error.message || error))
45+
console.error(
46+
'🚨 This means the main() function in src/index.ts is not properly implemented',
47+
)
48+
console.error(
49+
'🚨 Check that you\'ve replaced the "Not implemented" error with actual server setup code',
50+
)
51+
const enhancedError = new Error(
52+
'🚨 MCP server implementation required in main() function. ' +
53+
(error.message || error),
54+
)
4255
enhancedError.stack = error.stack
4356
throw enhancedError
4457
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"extends": ["@epic-web/config/typescript"],
3-
"include": ["types/**/*.d.ts", "src/**/*.ts"]
2+
"extends": ["@epic-web/config/typescript"],
3+
"include": ["types/**/*.d.ts", "src/**/*.ts"]
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import "@epic-web/config/reset.d.ts";
1+
import '@epic-web/config/reset.d.ts'

β€Žexercises/02.tools/01.problem.simple/src/index.test.tsβ€Ž

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,19 @@ test('Tool Definition', async () => {
3939
} catch (error: any) {
4040
if (error.code === -32601) {
4141
console.error('🚨 Tools capability not implemented!')
42-
console.error('🚨 This exercise requires registering tools with the MCP server')
43-
console.error('🚨 You need to: 1) Add tools: {} to server capabilities, 2) Register an "add" tool in initializeTools()')
44-
console.error('🚨 Check src/tools.ts and make sure you implement the "add" tool')
45-
const enhancedError = new Error('🚨 Tools capability required. Register an "add" tool that hardcodes 1 + 2 = 3. ' + (error.message || error))
42+
console.error(
43+
'🚨 This exercise requires registering tools with the MCP server',
44+
)
45+
console.error(
46+
'🚨 You need to: 1) Add tools: {} to server capabilities, 2) Register an "add" tool in initializeTools()',
47+
)
48+
console.error(
49+
'🚨 Check src/tools.ts and make sure you implement the "add" tool',
50+
)
51+
const enhancedError = new Error(
52+
'🚨 Tools capability required. Register an "add" tool that hardcodes 1 + 2 = 3. ' +
53+
(error.message || error),
54+
)
4655
enhancedError.stack = error.stack
4756
throw enhancedError
4857
}
@@ -70,10 +79,18 @@ test('Tool Call', async () => {
7079
} catch (error: any) {
7180
if (error.code === -32601) {
7281
console.error('🚨 Tool call failed - tools capability not implemented!')
73-
console.error('🚨 This means you haven\'t registered the "add" tool properly')
74-
console.error('🚨 In src/tools.ts, use agent.server.registerTool() to create a simple "add" tool')
75-
console.error('🚨 The tool should return "1 + 2 = 3" (hardcoded for this simple exercise)')
76-
const enhancedError = new Error('🚨 "add" tool registration required. ' + (error.message || error))
82+
console.error(
83+
'🚨 This means you haven\'t registered the "add" tool properly',
84+
)
85+
console.error(
86+
'🚨 In src/tools.ts, use agent.server.registerTool() to create a simple "add" tool',
87+
)
88+
console.error(
89+
'🚨 The tool should return "1 + 2 = 3" (hardcoded for this simple exercise)',
90+
)
91+
const enhancedError = new Error(
92+
'🚨 "add" tool registration required. ' + (error.message || error),
93+
)
7794
enhancedError.stack = error.stack
7895
throw enhancedError
7996
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"extends": ["@epic-web/config/typescript"],
3-
"include": ["types/**/*.d.ts", "src/**/*.ts"]
2+
"extends": ["@epic-web/config/typescript"],
3+
"include": ["types/**/*.d.ts", "src/**/*.ts"]
44
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import "@epic-web/config/reset.d.ts";
1+
import '@epic-web/config/reset.d.ts'

0 commit comments

Comments
Β (0)