create-mcp-kit 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/index.js +89 -2
- package/package.json +5 -5
- package/template/standard-js/LICENSE +21 -0
- package/template/standard-js/_env +1 -0
- package/template/standard-js/_github/workflows/build.yml +37 -0
- package/template/standard-js/_github/workflows/npm-publish.yml +39 -0
- package/template/standard-js/_gitignore +112 -0
- package/template/standard-js/_husky/commit-msg +1 -0
- package/template/standard-js/_husky/pre-commit +1 -0
- package/template/standard-js/_nvmrc +1 -0
- package/template/standard-js/_prettierrc +11 -0
- package/template/standard-js/changelog-option.js +87 -0
- package/template/standard-js/commitlint.config.js +25 -0
- package/template/standard-js/eslint.config.js +42 -0
- package/template/standard-js/jsconfig.json +17 -0
- package/template/standard-js/lint-staged.config.js +3 -0
- package/template/standard-js/package.json +62 -0
- package/template/standard-js/scripts/base.js +82 -0
- package/template/standard-js/scripts/build.js +4 -0
- package/template/standard-js/scripts/dev.js +7 -0
- package/template/standard-js/src/constants/index.js +1 -0
- package/template/standard-js/src/index.js +50 -0
- package/template/standard-js/src/prompts/index.js +27 -0
- package/template/standard-js/src/resources/index.js +24 -0
- package/template/standard-js/src/services/index.js +27 -0
- package/template/standard-js/src/services/stdio.js +6 -0
- package/template/standard-js/src/services/web.js +88 -0
- package/template/standard-js/src/tools/index.js +5 -0
- package/template/standard-js/src/tools/registerGetData.js +38 -0
- package/template/standard-js/src/utils/index.js +7 -0
- package/template/standard-js/tests/prompts/index.test.js +24 -0
- package/template/standard-js/tests/resources/index.test.js +18 -0
- package/template/standard-js/tests/tools/index.test.js +42 -0
- package/template/standard-js/vitest.config.js +10 -0
- package/template/standard-js/vitest.setup.js +19 -0
- package/template/standard-ts/_github/workflows/build.yml +3 -0
- package/template/standard-ts/_github/workflows/npm-publish.yml +3 -0
- package/template/standard-ts/commitlint.config.js +13 -15
- package/template/standard-ts/package.json +4 -4
- package/template/standard-ts/src/prompts/index.ts +1 -1
- package/template/standard-ts/src/resources/index.ts +1 -1
- package/template/standard-ts/src/services/web.ts +1 -1
- package/template/standard-ts/vitest.setup.ts +1 -1
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
# create-mcp-kit
|
|
2
2
|
A CLI tool to create MCP (Model Context Protocol) applications with ease.
|
|
3
3
|
|
|
4
|
+
[![][npm-release-shield]][npm-release-link]
|
|
5
|
+
[![][codecov-shield]][codecov-link]
|
|
6
|
+
[![][github-release-date-shield]][github-release-date-link]
|
|
7
|
+
[![][github-action-build-shield]][github-action-build-link]
|
|
8
|
+
[![][github-license-shield]][github-license-link]
|
|
9
|
+
|
|
4
10
|
## Features
|
|
5
11
|
- 🚀 Quick project scaffolding
|
|
6
12
|
- 📦 TypeScript support out of the box
|
|
@@ -123,3 +129,14 @@ This project exists thanks to all the people who contribute.
|
|
|
123
129
|
## License
|
|
124
130
|
|
|
125
131
|
[MIT](LICENSE) © MichaelSun
|
|
132
|
+
|
|
133
|
+
[npm-release-link]: https://www.npmjs.com/package/create-mcp-kit
|
|
134
|
+
[npm-release-shield]: https://img.shields.io/npm/v/create-mcp-kit?color=1677FF&labelColor=black&logo=npm&logoColor=white&style=flat-square
|
|
135
|
+
[codecov-link]: https://coveralls.io/github/my-mcp-hub/mcp-kit?branch=main
|
|
136
|
+
[codecov-shield]: https://img.shields.io/coverallsCoverage/github/my-mcp-hub/mcp-kit?color=1677FF&labelColor=black&style=flat-square&logo=codecov&logoColor=white
|
|
137
|
+
[github-release-date-link]: https://github.com/my-mcp-hub/mcp-kit/releases
|
|
138
|
+
[github-release-date-shield]: https://img.shields.io/github/release-date/my-mcp-hub/mcp-kit?color=1677FF&labelColor=black&style=flat-square
|
|
139
|
+
[github-action-build-link]: https://github.com/my-mcp-hub/mcp-kit/actions/workflows/build.yml
|
|
140
|
+
[github-action-build-shield]: https://img.shields.io/github/actions/workflow/status/my-mcp-hub/mcp-kit/build.yml?branch=main&color=1677FF&label=build&labelColor=black&logo=githubactions&logoColor=white&style=flat-square
|
|
141
|
+
[github-license-link]: https://github.com/my-mcp-hub/mcp-kit/blob/main/LICENSE
|
|
142
|
+
[github-license-shield]: https://img.shields.io/github/license/my-mcp-hub/mcp-kit?color=1677FF&labelColor=black&style=flat-square
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import*as
|
|
3
|
-
|
|
2
|
+
import * as clack from "@clack/prompts";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { dirname, join, resolve } from "path";
|
|
6
|
+
import { stat } from "fs/promises";
|
|
7
|
+
import { createProject, installDependencies, sleep } from "@mcp-tool-kit/shared";
|
|
8
|
+
|
|
9
|
+
//#region src/index.ts
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = dirname(__filename);
|
|
12
|
+
clack.intro(pc.inverse(" create-mcp-kit "));
|
|
13
|
+
const group = await clack.group({
|
|
14
|
+
type: () => clack.select({
|
|
15
|
+
message: "Project type:",
|
|
16
|
+
options: [{
|
|
17
|
+
value: "server",
|
|
18
|
+
label: pc.magenta("MCP Server")
|
|
19
|
+
}]
|
|
20
|
+
}),
|
|
21
|
+
name: ({ results }) => clack.text({
|
|
22
|
+
message: "Project name:",
|
|
23
|
+
defaultValue: `mcp-${results.type}-starter`,
|
|
24
|
+
placeholder: `mcp-${results.type}-starter`
|
|
25
|
+
}),
|
|
26
|
+
language: () => clack.select({
|
|
27
|
+
message: "Project language:",
|
|
28
|
+
options: [{
|
|
29
|
+
value: "ts",
|
|
30
|
+
label: pc.magenta("TypeScript")
|
|
31
|
+
}, {
|
|
32
|
+
value: "js",
|
|
33
|
+
label: pc.blue("JavaScript")
|
|
34
|
+
}]
|
|
35
|
+
}),
|
|
36
|
+
template: () => clack.select({
|
|
37
|
+
message: "Project template:",
|
|
38
|
+
options: [{
|
|
39
|
+
value: "standard",
|
|
40
|
+
label: pc.magenta("Standard")
|
|
41
|
+
}]
|
|
42
|
+
}),
|
|
43
|
+
install: () => clack.confirm({ message: "Do you want to install dependencies?" })
|
|
44
|
+
}, { onCancel: () => {
|
|
45
|
+
clack.cancel("Operation cancelled.");
|
|
46
|
+
process.exit(0);
|
|
47
|
+
} });
|
|
48
|
+
const templatePath = join(__dirname, "../template", `${group.template}-${group.language}`);
|
|
49
|
+
const targetPath = resolve(process.cwd(), group.name);
|
|
50
|
+
try {
|
|
51
|
+
await stat(templatePath);
|
|
52
|
+
} catch {
|
|
53
|
+
clack.log.error(`Template not found: ${templatePath}`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
await stat(targetPath);
|
|
58
|
+
clack.log.error(`Directory ${group.name} already exists`);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
} catch {}
|
|
61
|
+
{
|
|
62
|
+
const createSpinner = clack.spinner();
|
|
63
|
+
createSpinner.start("Creating project...");
|
|
64
|
+
await sleep(100);
|
|
65
|
+
try {
|
|
66
|
+
await createProject(targetPath, templatePath, { projectName: group.name });
|
|
67
|
+
} catch (error) {
|
|
68
|
+
createSpinner.stop("Failed to create project");
|
|
69
|
+
clack.log.error(error.message);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
createSpinner.stop(pc.green("Project created!"));
|
|
73
|
+
}
|
|
74
|
+
if (group.install) {
|
|
75
|
+
const spinner = clack.spinner();
|
|
76
|
+
spinner.start("Installing dependencies...");
|
|
77
|
+
await installDependencies(targetPath);
|
|
78
|
+
spinner.stop(pc.green("Dependencies installed!"));
|
|
79
|
+
}
|
|
80
|
+
clack.outro(`
|
|
81
|
+
${pc.green("✓")} Project created successfully!
|
|
82
|
+
|
|
83
|
+
${pc.cyan("Next steps:")}
|
|
84
|
+
${pc.dim("cd")} ${group.name}
|
|
85
|
+
${group.install ? "" : `${pc.dim("npm install")}\n `}${pc.dim("npm run dev")}
|
|
86
|
+
|
|
87
|
+
Enjoy coding! 🎉
|
|
88
|
+
`);
|
|
89
|
+
|
|
90
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mcp-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "create mcp tool kit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "zhensherlock",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@clack/prompts": "^0.11.0",
|
|
43
43
|
"picocolors": "^1.1.1",
|
|
44
|
-
"@mcp-tool-kit/shared": "^0.0.
|
|
44
|
+
"@mcp-tool-kit/shared": "^0.0.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@modelcontextprotocol/sdk": "^1.17.
|
|
47
|
+
"@modelcontextprotocol/sdk": "^1.17.1",
|
|
48
48
|
"@types/express": "^5.0.3",
|
|
49
49
|
"@types/yargs": "^17.0.33",
|
|
50
50
|
"express": "^5.1.0",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"scripts": {
|
|
56
56
|
"clean:dist": "rimraf dist",
|
|
57
57
|
"build:types": "tsc --noEmit",
|
|
58
|
-
"build": "npm run clean:dist && npm run build:types && rolldown -c rolldown.config.ts",
|
|
59
|
-
"dev": "rolldown -c rolldown.config.ts --watch",
|
|
58
|
+
"build": "cross-env NODE_ENV=production && npm run clean:dist && npm run build:types && rolldown -c rolldown.config.ts",
|
|
59
|
+
"dev": "cross-env NODE_ENV=local && rolldown -c rolldown.config.ts --watch",
|
|
60
60
|
"start": "node ./dist/index.js"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) {{YEAR}} {{PROJECT_NAME}}
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PORT=8401
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
if: github.repository == '{{PROJECT_NAME}}'
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
fetch-depth: 0
|
|
17
|
+
|
|
18
|
+
- name: Install Node
|
|
19
|
+
uses: actions/setup-node@v4
|
|
20
|
+
with:
|
|
21
|
+
node-version: 22
|
|
22
|
+
cache: npm
|
|
23
|
+
|
|
24
|
+
- name: Install Package
|
|
25
|
+
run: npm i
|
|
26
|
+
|
|
27
|
+
- name: Lint
|
|
28
|
+
run: npm run lint
|
|
29
|
+
|
|
30
|
+
- name: Build Package
|
|
31
|
+
run: npm run build
|
|
32
|
+
|
|
33
|
+
- name: Test Package
|
|
34
|
+
run: npm run coverage
|
|
35
|
+
|
|
36
|
+
- name: Coveralls
|
|
37
|
+
uses: coverallsapp/github-action@v2
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: npm-publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
if: github.repository == '{{PROJECT_NAME}}'
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
id-token: write
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: Install Node
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: 22
|
|
24
|
+
registry-url: https://registry.npmjs.org/
|
|
25
|
+
cache: npm
|
|
26
|
+
|
|
27
|
+
- name: Install Package
|
|
28
|
+
run: npm i
|
|
29
|
+
|
|
30
|
+
- name: Lint
|
|
31
|
+
run: npm run lint
|
|
32
|
+
|
|
33
|
+
- name: Build Package
|
|
34
|
+
run: npm run build
|
|
35
|
+
|
|
36
|
+
- name: Publish NPM Package
|
|
37
|
+
run: npm publish --provenance --access public
|
|
38
|
+
env:
|
|
39
|
+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.DS_Store
|
|
2
|
+
.idea/
|
|
3
|
+
# Logs
|
|
4
|
+
logs
|
|
5
|
+
*.log
|
|
6
|
+
npm-debug.log*
|
|
7
|
+
yarn-debug.log*
|
|
8
|
+
yarn-error.log*
|
|
9
|
+
lerna-debug.log*
|
|
10
|
+
|
|
11
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
12
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
13
|
+
|
|
14
|
+
# Runtime data
|
|
15
|
+
pids
|
|
16
|
+
*.pid
|
|
17
|
+
*.seed
|
|
18
|
+
*.pid.lock
|
|
19
|
+
|
|
20
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
21
|
+
lib-cov
|
|
22
|
+
|
|
23
|
+
# Coverage directory used by tools like istanbul
|
|
24
|
+
coverage
|
|
25
|
+
*.lcov
|
|
26
|
+
|
|
27
|
+
# nyc test coverage
|
|
28
|
+
.nyc_output
|
|
29
|
+
|
|
30
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
31
|
+
.grunt
|
|
32
|
+
|
|
33
|
+
# Bower dependency directory (https://bower.io/)
|
|
34
|
+
bower_components
|
|
35
|
+
|
|
36
|
+
# node-waf configuration
|
|
37
|
+
.lock-wscript
|
|
38
|
+
|
|
39
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
40
|
+
build/Release
|
|
41
|
+
|
|
42
|
+
# Dependency directories
|
|
43
|
+
node_modules/
|
|
44
|
+
jspm_packages/
|
|
45
|
+
|
|
46
|
+
# TypeScript v1 declaration files
|
|
47
|
+
typings/
|
|
48
|
+
|
|
49
|
+
# TypeScript cache
|
|
50
|
+
*.tsbuildinfo
|
|
51
|
+
|
|
52
|
+
# Optional npm cache directory
|
|
53
|
+
.npm
|
|
54
|
+
|
|
55
|
+
# Optional eslint cache
|
|
56
|
+
.eslintcache
|
|
57
|
+
|
|
58
|
+
# Microbundle cache
|
|
59
|
+
.rpt2_cache/
|
|
60
|
+
.rts2_cache_cjs/
|
|
61
|
+
.rts2_cache_es/
|
|
62
|
+
.rts2_cache_umd/
|
|
63
|
+
|
|
64
|
+
# Optional REPL history
|
|
65
|
+
.node_repl_history
|
|
66
|
+
|
|
67
|
+
# Output of 'npm pack'
|
|
68
|
+
*.tgz
|
|
69
|
+
|
|
70
|
+
# Yarn Integrity file
|
|
71
|
+
.yarn-integrity
|
|
72
|
+
|
|
73
|
+
# dotenv environment variables file
|
|
74
|
+
#.env
|
|
75
|
+
.env.test
|
|
76
|
+
|
|
77
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
78
|
+
.cache
|
|
79
|
+
|
|
80
|
+
# Next.js build output
|
|
81
|
+
.next
|
|
82
|
+
|
|
83
|
+
# Nuxt.js build / generate output
|
|
84
|
+
.nuxt
|
|
85
|
+
dist
|
|
86
|
+
|
|
87
|
+
# Gatsby files
|
|
88
|
+
.cache/
|
|
89
|
+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
|
90
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
91
|
+
# public
|
|
92
|
+
|
|
93
|
+
# vuepress build output
|
|
94
|
+
.vuepress/dist
|
|
95
|
+
|
|
96
|
+
# Serverless directories
|
|
97
|
+
.serverless/
|
|
98
|
+
|
|
99
|
+
# FuseBox cache
|
|
100
|
+
.fusebox/
|
|
101
|
+
|
|
102
|
+
# DynamoDB Local files
|
|
103
|
+
.dynamodb/
|
|
104
|
+
|
|
105
|
+
# TernJS port file
|
|
106
|
+
.tern-port
|
|
107
|
+
|
|
108
|
+
/docs/.vitepress/cache/
|
|
109
|
+
|
|
110
|
+
stats.html
|
|
111
|
+
|
|
112
|
+
build/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx --no-install commitlint --edit $1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v22
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import compareFunc from 'compare-func'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
writerOpts: {
|
|
5
|
+
transform: (commit, context) => {
|
|
6
|
+
let discard = true
|
|
7
|
+
const issues = []
|
|
8
|
+
|
|
9
|
+
const newCommit = {
|
|
10
|
+
...commit,
|
|
11
|
+
notes: commit.notes.map(note => ({
|
|
12
|
+
...note,
|
|
13
|
+
title: 'BREAKING CHANGES',
|
|
14
|
+
})),
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (newCommit.notes.length > 0) {
|
|
18
|
+
discard = false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const typeMap = {
|
|
22
|
+
feat: '✨ Features | 新功能',
|
|
23
|
+
fix: '🐛 Bug Fixes | Bug 修复',
|
|
24
|
+
perf: '⚡ Performance Improvements | 性能优化',
|
|
25
|
+
revert: '⏪ Reverts | 回退',
|
|
26
|
+
refactor: '♻ Code Refactoring | 代码重构',
|
|
27
|
+
test: '✅ Tests | 测试',
|
|
28
|
+
build: '👷 Build System | 构建',
|
|
29
|
+
chore: '🎫 Chores | 其他更新',
|
|
30
|
+
style: '💄 Styles | 风格',
|
|
31
|
+
ci: '🔧 Continuous Integration | CI 配置',
|
|
32
|
+
docs: '📝 Documentation | 文档',
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (typeMap[newCommit.type]) {
|
|
36
|
+
newCommit.type = typeMap[newCommit.type]
|
|
37
|
+
} else if (newCommit.type === 'revert' || newCommit.revert) {
|
|
38
|
+
newCommit.type = typeMap['revert']
|
|
39
|
+
} else if (discard) {
|
|
40
|
+
return
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (newCommit.scope === '*') {
|
|
44
|
+
newCommit.scope = ''
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof newCommit.hash === 'string') {
|
|
48
|
+
newCommit.shortHash = newCommit.hash.substring(0, 7)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof newCommit.subject === 'string') {
|
|
52
|
+
let url = context.repository ? `${context.host}/${context.owner}/${context.repository}` : context.repoUrl
|
|
53
|
+
|
|
54
|
+
if (url) {
|
|
55
|
+
url = `${url}/issues/`
|
|
56
|
+
newCommit.subject = newCommit.subject.replace(/#([0-9]+)/g, (_, issue) => {
|
|
57
|
+
issues.push(issue)
|
|
58
|
+
return `[#${issue}](${url}${issue})`
|
|
59
|
+
})
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (context.host) {
|
|
63
|
+
newCommit.subject = newCommit.subject.replace(/\B@([a-z0-9](?:-?[a-z0-9/]){0,38})/g, (_, username) => {
|
|
64
|
+
if (username.includes('/')) {
|
|
65
|
+
return `@${username}`
|
|
66
|
+
}
|
|
67
|
+
return `[@${username}](${context.host}/${username})`
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
newCommit.references = newCommit.references.filter(reference => {
|
|
73
|
+
if (issues.indexOf(reference.issue) === -1) {
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
76
|
+
return false
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return newCommit
|
|
80
|
+
},
|
|
81
|
+
groupBy: 'type',
|
|
82
|
+
commitGroupsSort: 'title',
|
|
83
|
+
commitsSort: ['scope', 'subject'],
|
|
84
|
+
noteGroupsSort: 'title',
|
|
85
|
+
notesSort: compareFunc,
|
|
86
|
+
},
|
|
87
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
extends: ['@commitlint/config-conventional'],
|
|
3
|
+
rules: {
|
|
4
|
+
'type-enum': [
|
|
5
|
+
2,
|
|
6
|
+
'always',
|
|
7
|
+
[
|
|
8
|
+
'feat',
|
|
9
|
+
'fix',
|
|
10
|
+
'docs',
|
|
11
|
+
'style',
|
|
12
|
+
'refactor',
|
|
13
|
+
'perf',
|
|
14
|
+
'test',
|
|
15
|
+
'build',
|
|
16
|
+
'ci',
|
|
17
|
+
'chore',
|
|
18
|
+
'revert',
|
|
19
|
+
'build',
|
|
20
|
+
'release',
|
|
21
|
+
],
|
|
22
|
+
],
|
|
23
|
+
'subject-case': [0],
|
|
24
|
+
},
|
|
25
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import importPlugin from 'eslint-plugin-import'
|
|
2
|
+
import prettierPlugin from 'eslint-plugin-prettier'
|
|
3
|
+
import globals from 'globals'
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
ignores: ['**/build', '**/node_modules', '**/.*', '**/*.d.ts', '.husky/'],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
files: ['src/**/*.js', 'tests/**/*.js'],
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parserOptions: {
|
|
15
|
+
ecmaVersion: 'latest',
|
|
16
|
+
sourceType: 'module',
|
|
17
|
+
},
|
|
18
|
+
globals: {
|
|
19
|
+
...globals.es2022,
|
|
20
|
+
...globals.node,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
plugins: {
|
|
24
|
+
import: importPlugin,
|
|
25
|
+
prettier: prettierPlugin,
|
|
26
|
+
},
|
|
27
|
+
rules: {
|
|
28
|
+
'prettier/prettier': 'error',
|
|
29
|
+
'no-console': 'off',
|
|
30
|
+
semi: ['warn', 'never'],
|
|
31
|
+
quotes: ['warn', 'single'],
|
|
32
|
+
'no-unused-vars': 'off',
|
|
33
|
+
},
|
|
34
|
+
settings: {
|
|
35
|
+
'import/resolver': {
|
|
36
|
+
node: {
|
|
37
|
+
extensions: ['.js'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"outDir": "./build",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"paths": {
|
|
12
|
+
"@/*": ["./src/*"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"include": ["src", "tests", "vitest.setup.js", "vitest.config.js"],
|
|
16
|
+
"exclude": ["node_modules"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{PROJECT_NAME}}",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "{{PROJECT_NAME}}",
|
|
5
|
+
"author": "zhensherlock",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"{{PROJECT_NAME}}": "./build/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"build",
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"main": "build/index.js",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"prepare": "husky",
|
|
19
|
+
"lint": "npx eslint \"src/**/*.js\"",
|
|
20
|
+
"build": "cross-env NODE_ENV=production node scripts/build.js",
|
|
21
|
+
"dev": "npm run dev:stdio",
|
|
22
|
+
"dev:stdio": "cross-env NODE_ENV=local node scripts/dev.js",
|
|
23
|
+
"dev:web": "cross-env NODE_ENV=local TRANSPORT=web node scripts/dev.js",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"coverage": "rimraf coverage && npm run test && c8 report --reporter=lcov --reporter=html",
|
|
26
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0 -n changelog-option.js"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@modelcontextprotocol/sdk": "^1.17.1",
|
|
30
|
+
"cors": "^2.8.5",
|
|
31
|
+
"dotenv": "^17.2.1",
|
|
32
|
+
"express": "^5.1.0",
|
|
33
|
+
"nanoid": "^5.1.5",
|
|
34
|
+
"node-fetch": "^3.3.2",
|
|
35
|
+
"yargs": "^17.7.2",
|
|
36
|
+
"zod": "^3.25.76"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@commitlint/cli": "^19.8.1",
|
|
40
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
41
|
+
"@modelcontextprotocol/inspector": "^0.16.2",
|
|
42
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
43
|
+
"c8": "^10.1.3",
|
|
44
|
+
"compare-func": "^2.0.0",
|
|
45
|
+
"concurrently": "^9.2.0",
|
|
46
|
+
"conventional-changelog-angular": "^8.0.0",
|
|
47
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
48
|
+
"cross-env": "^10.0.0",
|
|
49
|
+
"esbuild": "^0.25.8",
|
|
50
|
+
"eslint": "^9.32.0",
|
|
51
|
+
"eslint-plugin-import": "^2.32.0",
|
|
52
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
53
|
+
"globals": "^16.3.0",
|
|
54
|
+
"husky": "^9.1.7",
|
|
55
|
+
"lint-staged": "^16.1.4",
|
|
56
|
+
"nyc": "^17.1.0",
|
|
57
|
+
"prettier": "^3.6.2",
|
|
58
|
+
"rimraf": "^6.0.1",
|
|
59
|
+
"tree-kill": "^1.2.2",
|
|
60
|
+
"vitest": "^3.2.4"
|
|
61
|
+
}
|
|
62
|
+
}
|