feat: migrate hello baseline from Python to TypeScript
sonar / sonar (push) Skipped
sonar / sonar (pull_request) Successful in 39s
sonar / sonar (push) Skipped
sonar / sonar (pull_request) Successful in 39s
Replace the greenfield Python hello world with a Node.js 22/TypeScript/npm toolchain while preserving the existing greeting behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import { greet } from "./hello.js";
|
||||
|
||||
describe("greet", () => {
|
||||
it("returns the default greeting", () => {
|
||||
assert.equal(greet(), "Hello, TicketLab MCP!");
|
||||
});
|
||||
|
||||
it("returns a greeting for a custom name", () => {
|
||||
assert.equal(greet("World"), "Hello, World!");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
/** Hello world for TicketLab_MCP. */
|
||||
|
||||
/** Return a greeting for the given name. */
|
||||
export function greet(name: string = "TicketLab MCP"): string {
|
||||
return `Hello, ${name}!`;
|
||||
}
|
||||
|
||||
export function main(): void {
|
||||
console.log(greet());
|
||||
}
|
||||
|
||||
const entry = process.argv[1];
|
||||
const isMain =
|
||||
entry !== undefined && import.meta.url === pathToFileURL(entry).href;
|
||||
|
||||
if (isMain) {
|
||||
main();
|
||||
}
|
||||
Reference in New Issue
Block a user