hono-mcp 1.4.2 → 1.4.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/dist/commands/prompt.js +102 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { Command, Param } from "../decorators/command.js";
|
|
12
|
+
const GIT_COMMIT_EMOJIS = {
|
|
13
|
+
feat: "✨",
|
|
14
|
+
fix: "🐛",
|
|
15
|
+
docs: "📝",
|
|
16
|
+
style: "🎨",
|
|
17
|
+
refactor: "♻️",
|
|
18
|
+
perf: "⚡",
|
|
19
|
+
test: "✅",
|
|
20
|
+
build: "📦",
|
|
21
|
+
ci: "👷",
|
|
22
|
+
chore: "🔧",
|
|
23
|
+
revert: "⏪",
|
|
24
|
+
};
|
|
25
|
+
let GitCommitPromptCommand = class GitCommitPromptCommand {
|
|
26
|
+
includeExamples;
|
|
27
|
+
async execute(params) {
|
|
28
|
+
const includeExamples = params.includeExamples ?? true;
|
|
29
|
+
let prompt = `# Git Commit Convention
|
|
30
|
+
|
|
31
|
+
Please format your git commit messages using the following convention:
|
|
32
|
+
|
|
33
|
+
## Format
|
|
34
|
+
\`\`\`
|
|
35
|
+
<emoji> <type>: <description>
|
|
36
|
+
\`\`\`
|
|
37
|
+
|
|
38
|
+
## Commit Types
|
|
39
|
+
`;
|
|
40
|
+
for (const [type, emoji] of Object.entries(GIT_COMMIT_EMOJIS)) {
|
|
41
|
+
prompt += `- ${emoji} **${type}**: ${this.getTypeDescription(type)}\n`;
|
|
42
|
+
}
|
|
43
|
+
if (includeExamples) {
|
|
44
|
+
prompt += `
|
|
45
|
+
## Examples
|
|
46
|
+
\`\`\`
|
|
47
|
+
${GIT_COMMIT_EMOJIS.feat} feat: add user authentication
|
|
48
|
+
${GIT_COMMIT_EMOJIS.fix} fix: resolve login timeout issue
|
|
49
|
+
${GIT_COMMIT_EMOJIS.docs} docs: update API documentation
|
|
50
|
+
${GIT_COMMIT_EMOJIS.style} style: format code with prettier
|
|
51
|
+
${GIT_COMMIT_EMOJIS.refactor} refactor: simplify user service logic
|
|
52
|
+
${GIT_COMMIT_EMOJIS.perf} perf: optimize database queries
|
|
53
|
+
${GIT_COMMIT_EMOJIS.test} test: add unit tests for auth module
|
|
54
|
+
${GIT_COMMIT_EMOJIS.build} build: upgrade webpack to v5
|
|
55
|
+
${GIT_COMMIT_EMOJIS.ci} ci: add GitHub Actions workflow
|
|
56
|
+
${GIT_COMMIT_EMOJIS.chore} chore: update dependencies
|
|
57
|
+
${GIT_COMMIT_EMOJIS.revert} revert: remove deprecated feature
|
|
58
|
+
\`\`\`
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
prompt += `
|
|
62
|
+
## Guidelines
|
|
63
|
+
- Keep the description concise and clear
|
|
64
|
+
- Use imperative mood (e.g., "add" not "added" or "adds")
|
|
65
|
+
- Limit the first line to 50 characters
|
|
66
|
+
- Reference issues in the description if applicable
|
|
67
|
+
- Break long descriptions into multiple paragraphs
|
|
68
|
+
`;
|
|
69
|
+
return {
|
|
70
|
+
content: [
|
|
71
|
+
{
|
|
72
|
+
type: "text",
|
|
73
|
+
text: prompt,
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
getTypeDescription(type) {
|
|
79
|
+
const descriptions = {
|
|
80
|
+
feat: "A new feature",
|
|
81
|
+
fix: "A bug fix",
|
|
82
|
+
docs: "Documentation only changes",
|
|
83
|
+
style: "Code style changes (formatting, etc.)",
|
|
84
|
+
refactor: "Code refactoring",
|
|
85
|
+
perf: "Performance improvements",
|
|
86
|
+
test: "Adding or updating tests",
|
|
87
|
+
build: "Build system or dependencies",
|
|
88
|
+
ci: "CI/CD configuration changes",
|
|
89
|
+
chore: "Other changes that don't fit above",
|
|
90
|
+
revert: "Revert a previous commit",
|
|
91
|
+
};
|
|
92
|
+
return descriptions[type] || "Other changes";
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
__decorate([
|
|
96
|
+
Param(z.boolean().optional().describe("Include examples in the prompt")),
|
|
97
|
+
__metadata("design:type", Boolean)
|
|
98
|
+
], GitCommitPromptCommand.prototype, "includeExamples", void 0);
|
|
99
|
+
GitCommitPromptCommand = __decorate([
|
|
100
|
+
Command("prompt.git-commit", "Inject git commit convention prompt")
|
|
101
|
+
], GitCommitPromptCommand);
|
|
102
|
+
export { GitCommitPromptCommand };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import 'reflect-metadata';
|
|
|
4
4
|
import vscodeSettings from './data/vscode-settings.json' with { type: 'json' };
|
|
5
5
|
import { executeCommandTool, helpTool } from "./tools/decorator-tools.js";
|
|
6
6
|
import './commands/math.js';
|
|
7
|
+
import './commands/prompt.js';
|
|
7
8
|
const app = new Hono();
|
|
8
9
|
const tools = [executeCommandTool, helpTool];
|
|
9
10
|
var ToolName;
|