Skip to content

Commit c9667f1

Browse files
committed
Model Context Protocol (MCP) implementation ; increase coverage
1 parent 50c6b50 commit c9667f1

391 files changed

Lines changed: 95998 additions & 77286 deletions

File tree

Some content is hidden

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

.biomeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
ts-morph-as/
2+
coverage/
3+
dist/
4+
docs/

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: npm ci
5555

5656
- name: Check Code Formatting
57-
run: npx prettier --check 'src/**/*.ts' 'tests/**/*.ts'
57+
run: npx @biomejs/biome format .
5858

5959
- name: Run Lint
6060
run: npm run lint

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
- name: Install requirements
3939
run: npm ci
4040

41-
- name: Run ESLint
41+
- name: Run Biome lint
4242
run: npm run lint
4343

44-
- name: Run Prettier check
45-
run: npx prettier --check 'src/**/*.ts' 'tests/**/*.ts'
44+
- name: Run Biome format check
45+
run: npx @biomejs/biome format .

.husky/pre-commit

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ set -e
33

44
echo "Running Auto-Code-Format Fix..."
55
npm run format || true
6-
npx prettier --write 'src/**/*.ts' 'tests/**/*.ts' || true
6+
npx @biomejs/biome format --write .
77
git add src/ tests/
88

99
echo "Checking Code Formatting..."
10-
npx prettier --check 'src/**/*.ts' 'tests/**/*.ts'
10+
npx @biomejs/biome format .
1111

1212
echo "Running Lint..."
1313
npm run lint
@@ -37,7 +37,7 @@ rm -rf .test_out_openapi
3737

3838

3939
echo "Updating Badges in README.md..."
40-
npx esbuild scripts/update-badges.ts --bundle --platform=node --outfile=scripts/update-badges.cjs
41-
node scripts/update-badges.cjs
42-
rm scripts/update-badges.cjs
40+
41+
npx swc-node scripts/update-badges.ts
42+
4343
git add README.md

.prettierignore

Lines changed: 0 additions & 7 deletions
This file was deleted.

.prettierrc

Lines changed: 0 additions & 9 deletions
This file was deleted.

.swcrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"jsc": {
3+
"target": "es2020"
4+
}
5+
}

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ run: build
4747

4848
build_wasm: build
4949
@echo "Building WASM (browser bundle)..."
50-
npx esbuild dist/cli.js --bundle --platform=browser --target=es2020 --format=esm --inject:./wasm-stubs/inject.js --alias:path=path-browserify --alias:node:path=path-browserify --alias:url=./wasm-stubs/node-url.js --alias:node:url=./wasm-stubs/node-url.js --alias:fs=./wasm-stubs/node-fs.js --alias:node:fs=./wasm-stubs/node-fs.js --alias:fs/promises=./wasm-stubs/node-fs-promises.js --alias:node:fs/promises=./wasm-stubs/node-fs-promises.js --alias:os=./wasm-stubs/node-os.js --alias:node:os=./wasm-stubs/node-os.js --alias:http=./wasm-stubs/node-http.js --alias:node:http=./wasm-stubs/node-http.js --alias:events=./wasm-stubs/node-events.js --alias:node:events=./wasm-stubs/node-events.js --alias:child_process=./wasm-stubs/node-child_process.js --alias:node:child_process=./wasm-stubs/node-child_process.js --alias:process=./wasm-stubs/node-process.js --alias:node:process=./wasm-stubs/node-process.js --outfile=bin/cdd-ts.js --define:__filename="\"/cli.js\"" --define:__dirname="\"\/\""
50+
npx rolldown -c rolldown.config.js
5151
@echo "Compiling to WebAssembly..."
52+
node scripts/fix-bundle.cjs
5253
npx -y javy-cli compile bin/cdd-ts.js -o bin/cdd-ts-javy.wasm
5354

5455
build_docker:
@@ -67,8 +68,9 @@ build_with_ts_go:
6768
@echo "Building cdd-ts using local ts-morph fork..."
6869
npm run build
6970
@echo "Building WASM (browser bundle)..."
70-
npx esbuild dist/cli.js --bundle --platform=browser --target=es2020 --format=esm --inject:./wasm-stubs/inject.js --alias:path=path-browserify --alias:node:path=path-browserify --alias:url=./wasm-stubs/node-url.js --alias:node:url=./wasm-stubs/node-url.js --alias:fs=./wasm-stubs/node-fs.js --alias:node:fs=./wasm-stubs/node-fs.js --alias:fs/promises=./wasm-stubs/node-fs-promises.js --alias:node:fs/promises=./wasm-stubs/node-fs-promises.js --alias:os=./wasm-stubs/node-os.js --alias:node:os=./wasm-stubs/node-os.js --alias:http=./wasm-stubs/node-http.js --alias:node:http=./wasm-stubs/node-http.js --alias:events=./wasm-stubs/node-events.js --alias:node:events=./wasm-stubs/node-events.js --alias:child_process=./wasm-stubs/node-child_process.js --alias:node:child_process=./wasm-stubs/node-child_process.js --alias:process=./wasm-stubs/node-process.js --alias:node:process=./wasm-stubs/node-process.js --outfile=bin/cdd-ts.js --define:__filename="\"/cli.js\"" --define:__dirname="\"\/\""
71+
npx rolldown -c rolldown.config.js
7172
@echo "Compiling to WebAssembly via javy..."
73+
node scripts/fix-bundle.cjs
7274
npx -y javy-cli compile bin/cdd-ts.js -o bin/cdd-ts-go-javy.wasm
7375
@echo "build_with_ts_go completed successfully!"
7476

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ The CLI—at a minimum—has:
2828
- `cdd-ts to_openapi -f path/to/code`
2929
- `cdd-ts to_docs_json --no-imports --no-wrapping -i spec.json`
3030
- `cdd-ts serve_json_rpc --port 8080 --listen 0.0.0.0`
31+
- `cdd-ts mcp`
3132

3233
## SDK Example
3334

@@ -83,6 +84,7 @@ The `cdd-ts` compiler leverages a unified architecture to support various facets
8384
- **`TypeScript` → OpenAPI**: Statically parse existing `TypeScript` source code and emit compliant OpenAPI specifications.
8485
- **AST-Driven & Safe**: Employs static analysis instead of unsafe dynamic execution or reflection, allowing it to safely parse and emit code even for incomplete or un-compilable project states.
8586
- **Seamless Sync**: Keep your docs, tests, database, clients, and routing in perfect harmony. Update your code, and generate the docs; or update the docs, and generate the code.
87+
- **Model Context Protocol (MCP)**: Native integration exposes CLI capabilities seamlessly as AI agent tools via MCP over stdio.
8688

8789
**Uncommon Features:**
8890

@@ -105,6 +107,7 @@ Commands:
105107
to_docs_json [options] Generate JSON containing how to call operations in
106108
the target language
107109
serve_json_rpc [options] Expose CLI interface as JSON-RPC server
110+
mcp Start Model Context Protocol (MCP) server over stdio
108111
help [command] display help for command
109112
```
110113

biome.json

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/2.4.16/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"includes": ["src/**/*.ts", "tests/**/*.ts", "node-client/src/**/*.ts"]
10+
},
11+
"formatter": {
12+
"enabled": true,
13+
"indentStyle": "tab"
14+
},
15+
"linter": {
16+
"enabled": true,
17+
"rules": {
18+
"recommended": true,
19+
"suspicious": {
20+
"noExplicitAny": "off",
21+
"noAsyncPromiseExecutor": "off",
22+
"useIterableCallbackReturn": "off",
23+
"noAssignInExpressions": "off",
24+
"noNonNullAssertedOptionalChain": "off",
25+
"noTemplateCurlyInString": "off",
26+
"noThenProperty": "off",
27+
"noImplicitAnyLet": "off",
28+
"noDoubleEquals": "off",
29+
"noEmptyBlockStatements": "off",
30+
"noConfusingVoidType": "off",
31+
"noArrayIndexKey": "off"
32+
},
33+
"complexity": {
34+
"noStaticOnlyClass": "off"
35+
},
36+
"style": {
37+
"useNodejsImportProtocol": "off",
38+
"noNonNullAssertion": "off"
39+
},
40+
"correctness": {
41+
"noUnusedImports": "off"
42+
}
43+
}
44+
},
45+
"javascript": {
46+
"parser": {
47+
"unsafeParameterDecoratorsEnabled": true
48+
}
49+
},
50+
"assist": {
51+
"enabled": true,
52+
"actions": {
53+
"source": {
54+
"organizeImports": "on"
55+
}
56+
}
57+
}
58+
}

0 commit comments

Comments
 (0)