forgecraft-mcp 1.0.0 → 1.0.2

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.
Files changed (45) hide show
  1. package/README.md +95 -49
  2. package/dist/analyzers/anti-pattern.d.ts.map +1 -1
  3. package/dist/analyzers/anti-pattern.js +28 -0
  4. package/dist/analyzers/anti-pattern.js.map +1 -1
  5. package/dist/cli/assistant-detector.d.ts +28 -0
  6. package/dist/cli/assistant-detector.d.ts.map +1 -0
  7. package/dist/cli/assistant-detector.js +107 -0
  8. package/dist/cli/assistant-detector.js.map +1 -0
  9. package/dist/cli/commands.d.ts.map +1 -1
  10. package/dist/cli/commands.js +18 -3
  11. package/dist/cli/commands.js.map +1 -1
  12. package/dist/cli/help.js +44 -44
  13. package/dist/http-server-contribute.d.ts +21 -0
  14. package/dist/http-server-contribute.d.ts.map +1 -0
  15. package/dist/http-server-contribute.js +168 -0
  16. package/dist/http-server-contribute.js.map +1 -0
  17. package/dist/http-server.d.ts +16 -0
  18. package/dist/http-server.d.ts.map +1 -0
  19. package/dist/http-server.js +200 -0
  20. package/dist/http-server.js.map +1 -0
  21. package/dist/registry/remote-gates.js +10 -4
  22. package/dist/registry/remote-gates.js.map +1 -1
  23. package/dist/tools/check-cascade-report.js +64 -64
  24. package/dist/tools/forgecraft-dispatch.d.ts.map +1 -1
  25. package/dist/tools/forgecraft-dispatch.js +1 -0
  26. package/dist/tools/forgecraft-dispatch.js.map +1 -1
  27. package/dist/tools/forgecraft-schema.d.ts +2 -2
  28. package/dist/tools/scaffold-spec-stubs.js +24 -24
  29. package/dist/tools/scaffold-templates.d.ts +1 -1
  30. package/dist/tools/scaffold-templates.d.ts.map +1 -1
  31. package/dist/tools/scaffold-templates.js +73 -64
  32. package/dist/tools/scaffold-templates.js.map +1 -1
  33. package/dist/tools/setup-phase2.d.ts +1 -0
  34. package/dist/tools/setup-phase2.d.ts.map +1 -1
  35. package/dist/tools/setup-phase2.js +24 -6
  36. package/dist/tools/setup-phase2.js.map +1 -1
  37. package/dist/tools/setup-project.d.ts +6 -0
  38. package/dist/tools/setup-project.d.ts.map +1 -1
  39. package/dist/tools/setup-project.js +25 -8
  40. package/dist/tools/setup-project.js.map +1 -1
  41. package/dist/tools/spec-parser-inference.d.ts +10 -0
  42. package/dist/tools/spec-parser-inference.d.ts.map +1 -1
  43. package/dist/tools/spec-parser-inference.js +134 -31
  44. package/dist/tools/spec-parser-inference.js.map +1 -1
  45. package/package.json +7 -2
package/dist/cli/help.js CHANGED
@@ -5,50 +5,50 @@
5
5
  * Print usage help to stdout.
6
6
  */
7
7
  export function showHelp() {
8
- console.log(`
9
- ForgeCraft MCP — engineering standards for AI coding assistants
10
-
11
- USAGE
12
- npx forgecraft-mcp <command> [arguments] [flags]
13
- npx forgecraft-mcp serve (default — starts MCP server)
14
-
15
- COMMANDS
16
- setup <dir> First-time project setup (auto-detects stack)
17
- refresh <dir> Re-sync instruction files after project changes
18
- audit <dir> Check project against configured standards
19
- scaffold <dir> Generate project structure and instruction files
20
- review [dir] Generate code review checklist
21
- list [tags|hooks|skills] Discover available resources
22
- classify [dir] Suggest tags for a project
23
- generate <dir> Generate instruction files only
24
- convert <dir> Generate migration plan
25
- add-hook <name> <dir> Install a quality-gate hook
26
- add-module <name> <dir> Scaffold a feature module
27
- verify [dir] Run tests + score §4.3 GS properties + report layer violations
28
- advice [dir] Quality cycle checklist + tool stack + example configs for your tags
29
- metrics [dir] External quality report: LOC, coverage, layer violations, dead code, complexity
30
- FLAGS (vary by command)
31
- --tags <tags...> Project classification tags (or read from forgecraft.yaml)
32
- --tier <tier> Content depth: core | recommended | optional
33
- --targets <targets...> AI assistant targets: claude cursor copilot windsurf cline aider
34
- --name <name> Project name
35
- --description <text> Project description for tag detection
36
- --dry-run Preview without writing files
37
- --apply Apply changes (for refresh, default is preview)
38
- --add-tags <tags...> Add tags during refresh
39
- --remove-tags <tags...> Remove tags during refresh
40
- --no-anti-patterns Skip anti-pattern scanning (for audit)
41
- --language <lang> typescript | python (default: typescript)
42
- --scope <scope> comprehensive | focused (for review)
43
- --test-cmd <cmd> Test command override for verify (default: npm test)
44
- --timeout <ms> Test suite timeout in milliseconds (default: 120000)
45
- --threshold <n> Minimum GS score out of 12 for pass (default: 10)
46
- --mutation Run Stryker mutation testing (slow, opt-in; used by metrics)
47
- --coverage-dir <path> Path to existing coverage report directory (used by metrics)
48
- --force Overwrite existing files
49
- --compact Strip explanatory bullet tails and deduplicate lines (~20-40% smaller output)
50
- --tag <tag> Single tag filter (for add-hook)
51
- --check Drift-check mode for refresh: exit 1 if tag/tier drift detected (CI gate)
8
+ console.log(`
9
+ ForgeCraft MCP — engineering standards for AI coding assistants
10
+
11
+ USAGE
12
+ npx forgecraft-mcp <command> [arguments] [flags]
13
+ npx forgecraft-mcp serve (default — starts MCP server)
14
+
15
+ COMMANDS
16
+ setup <dir> First-time project setup (auto-detects stack)
17
+ refresh <dir> Re-sync instruction files after project changes
18
+ audit <dir> Check project against configured standards
19
+ scaffold <dir> Generate project structure and instruction files
20
+ review [dir] Generate code review checklist
21
+ list [tags|hooks|skills] Discover available resources
22
+ classify [dir] Suggest tags for a project
23
+ generate <dir> Generate instruction files only
24
+ convert <dir> Generate migration plan
25
+ add-hook <name> <dir> Install a quality-gate hook
26
+ add-module <name> <dir> Scaffold a feature module
27
+ verify [dir] Run tests + score §4.3 GS properties + report layer violations
28
+ advice [dir] Quality cycle checklist + tool stack + example configs for your tags
29
+ metrics [dir] External quality report: LOC, coverage, layer violations, dead code, complexity
30
+ FLAGS (vary by command)
31
+ --tags <tags...> Project classification tags (or read from forgecraft.yaml)
32
+ --tier <tier> Content depth: core | recommended | optional
33
+ --targets <targets...> AI assistant targets: claude cursor copilot windsurf cline aider
34
+ --name <name> Project name
35
+ --description <text> Project description for tag detection
36
+ --dry-run Preview without writing files
37
+ --apply Apply changes (for refresh, default is preview)
38
+ --add-tags <tags...> Add tags during refresh
39
+ --remove-tags <tags...> Remove tags during refresh
40
+ --no-anti-patterns Skip anti-pattern scanning (for audit)
41
+ --language <lang> typescript | python (default: typescript)
42
+ --scope <scope> comprehensive | focused (for review)
43
+ --test-cmd <cmd> Test command override for verify (default: npm test)
44
+ --timeout <ms> Test suite timeout in milliseconds (default: 120000)
45
+ --threshold <n> Minimum GS score out of 12 for pass (default: 10)
46
+ --mutation Run Stryker mutation testing (slow, opt-in; used by metrics)
47
+ --coverage-dir <path> Path to existing coverage report directory (used by metrics)
48
+ --force Overwrite existing files
49
+ --compact Strip explanatory bullet tails and deduplicate lines (~20-40% smaller output)
50
+ --tag <tag> Single tag filter (for add-hook)
51
+ --check Drift-check mode for refresh: exit 1 if tag/tier drift detected (CI gate)
52
52
  `);
53
53
  }
54
54
  //# sourceMappingURL=help.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ForgeCraft — Gate Contribution Route.
3
+ *
4
+ * Extracted from http-server.ts so it can be unit-tested without
5
+ * starting a live Express server (which calls app.listen at module load).
6
+ *
7
+ * Usage:
8
+ * app.use(createContributeGateRouter())
9
+ */
10
+ import { Router } from "express";
11
+ export interface ContributeGateRouterOptions {
12
+ /** Max gate proposals per IP per 15-minute window. Default: 5. */
13
+ maxRequestsPerWindow?: number;
14
+ }
15
+ /**
16
+ * Creates an Express Router with POST /contribute/gate.
17
+ * Requires GITHUB_TOKEN env var at request time.
18
+ * Rate-limited to maxRequestsPerWindow per IP per 15 minutes.
19
+ */
20
+ export declare function createContributeGateRouter(options?: ContributeGateRouterOptions): Router;
21
+ //# sourceMappingURL=http-server-contribute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-server-contribute.d.ts","sourceRoot":"","sources":["../src/http-server-contribute.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAkGjC,MAAM,WAAW,2BAA2B;IAC1C,kEAAkE;IAClE,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,GAAE,2BAAgC,GACxC,MAAM,CAsFR"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * ForgeCraft — Gate Contribution Route.
3
+ *
4
+ * Extracted from http-server.ts so it can be unit-tested without
5
+ * starting a live Express server (which calls app.listen at module load).
6
+ *
7
+ * Usage:
8
+ * app.use(createContributeGateRouter())
9
+ */
10
+ import { Router } from "express";
11
+ import { rateLimit } from "express-rate-limit";
12
+ import { z } from "zod";
13
+ const QUALITY_GATES_REPO = "jghiringhelli/generative-specification";
14
+ const GITHUB_API = "https://api.github.com";
15
+ const gateContributionSchema = z.object({
16
+ gate: z.object({
17
+ id: z.string(),
18
+ title: z.string().optional(),
19
+ description: z.string().optional(),
20
+ domain: z.string().optional(),
21
+ gsProperty: z.string().optional(),
22
+ phase: z.string().optional(),
23
+ hook: z.string().optional(),
24
+ check: z.string().optional(),
25
+ passCriterion: z.string().optional(),
26
+ tags: z.array(z.string()).optional(),
27
+ evidence: z.string(),
28
+ convergenceAttributes: z.record(z.boolean()).optional(),
29
+ }),
30
+ mode: z.enum(["anonymous", "attributed"]),
31
+ attribution: z
32
+ .object({
33
+ github: z.string().optional(),
34
+ projectType: z.string().optional(),
35
+ })
36
+ .optional(),
37
+ experimentId: z.string().optional(),
38
+ });
39
+ /**
40
+ * Formats a gate proposal as a GitHub Issue body in Markdown.
41
+ */
42
+ function formatIssueBody(payload) {
43
+ const { gate, mode, attribution, experimentId } = payload;
44
+ const lines = [
45
+ `## Gate Proposal: \`${gate.id}\``,
46
+ "",
47
+ `**Mode:** ${mode}`,
48
+ ];
49
+ if (mode === "attributed" && attribution?.github) {
50
+ lines.push(`**Contributor:** @${attribution.github}`);
51
+ }
52
+ if (attribution?.projectType) {
53
+ lines.push(`**Project type:** ${attribution.projectType}`);
54
+ }
55
+ if (experimentId) {
56
+ lines.push(`**Experiment:** \`${experimentId}\``);
57
+ }
58
+ lines.push("", "---", "");
59
+ if (gate.title)
60
+ lines.push(`### ${gate.title}`, "");
61
+ if (gate.description)
62
+ lines.push(gate.description, "");
63
+ const fields = [
64
+ ["GS Property", gate.gsProperty],
65
+ ["Phase", gate.phase],
66
+ ["Hook", gate.hook],
67
+ ["Domain", gate.domain],
68
+ ["Tags", gate.tags?.join(", ")],
69
+ ];
70
+ const populated = fields.filter(([, v]) => v);
71
+ if (populated.length > 0) {
72
+ lines.push("| Field | Value |", "|---|---|");
73
+ for (const [k, v] of populated)
74
+ lines.push(`| ${k} | ${v} |`);
75
+ lines.push("");
76
+ }
77
+ if (gate.check) {
78
+ lines.push("**Check:**", "```", gate.check, "```", "");
79
+ }
80
+ if (gate.passCriterion) {
81
+ lines.push(`**Pass criterion:** ${gate.passCriterion}`, "");
82
+ }
83
+ if (gate.evidence) {
84
+ lines.push("**Evidence:**", gate.evidence, "");
85
+ }
86
+ if (gate.convergenceAttributes) {
87
+ const attrs = Object.entries(gate.convergenceAttributes)
88
+ .map(([k, v]) => `- ${k}: ${v ? "✅" : "❌"}`)
89
+ .join("\n");
90
+ lines.push("**Convergence attributes:**", attrs, "");
91
+ }
92
+ lines.push("---", "_Submitted via ForgeCraft `contribute_gate`. Review and label `approved` to graduate._");
93
+ return lines.join("\n");
94
+ }
95
+ /**
96
+ * Creates an Express Router with POST /contribute/gate.
97
+ * Requires GITHUB_TOKEN env var at request time.
98
+ * Rate-limited to maxRequestsPerWindow per IP per 15 minutes.
99
+ */
100
+ export function createContributeGateRouter(options = {}) {
101
+ const { maxRequestsPerWindow = 5 } = options;
102
+ const router = Router();
103
+ router.use(rateLimit({
104
+ windowMs: 15 * 60 * 1000,
105
+ max: maxRequestsPerWindow,
106
+ standardHeaders: true,
107
+ legacyHeaders: false,
108
+ message: {
109
+ error: "Too many gate proposals from this IP. Please wait before submitting again.",
110
+ },
111
+ }));
112
+ router.post("/contribute/gate", async (req, res) => {
113
+ const githubToken = process.env.GITHUB_TOKEN;
114
+ if (!githubToken) {
115
+ res.status(503).json({
116
+ error: "Gate contributions unavailable: GITHUB_TOKEN not set",
117
+ });
118
+ return;
119
+ }
120
+ const parsed = gateContributionSchema.safeParse(req.body);
121
+ if (!parsed.success) {
122
+ res
123
+ .status(422)
124
+ .json({ error: "Invalid payload", details: parsed.error.flatten() });
125
+ return;
126
+ }
127
+ const { gate, mode, attribution } = parsed.data;
128
+ const title = `[Gate Proposal] ${gate.id}${mode === "attributed" && attribution?.github
129
+ ? ` — @${attribution.github}`
130
+ : ""}`;
131
+ const body = formatIssueBody(parsed.data);
132
+ const labels = ["gate-proposal", "quarantine", "status:pending-review"];
133
+ try {
134
+ const response = await fetch(`${GITHUB_API}/repos/${QUALITY_GATES_REPO}/issues`, {
135
+ method: "POST",
136
+ headers: {
137
+ Authorization: `Bearer ${githubToken}`,
138
+ Accept: "application/vnd.github+json",
139
+ "Content-Type": "application/json",
140
+ "X-GitHub-Api-Version": "2022-11-28",
141
+ },
142
+ body: JSON.stringify({ title, body, labels }),
143
+ signal: AbortSignal.timeout(10000),
144
+ });
145
+ if (!response.ok) {
146
+ const err = await response.text();
147
+ console.error(`GitHub API error ${response.status}: ${err}`);
148
+ res
149
+ .status(502)
150
+ .json({ error: "GitHub API error", status: response.status });
151
+ return;
152
+ }
153
+ const issue = (await response.json());
154
+ console.log(`Gate proposal submitted: ${gate.id} → ${issue.html_url}`);
155
+ res.status(200).json({
156
+ status: "submitted",
157
+ issueUrl: issue.html_url,
158
+ issueNumber: issue.number,
159
+ });
160
+ }
161
+ catch (err) {
162
+ console.error("Gate contribution failed:", err);
163
+ res.status(503).json({ error: "Failed to reach GitHub API" });
164
+ }
165
+ });
166
+ return router;
167
+ }
168
+ //# sourceMappingURL=http-server-contribute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-server-contribute.js","sourceRoot":"","sources":["../src/http-server-contribute.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,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Q,CAAC,MAAM,EAAE,CAAC,CAAC;gBAChE,OAAO;YACT,CAAC;YAED,MAAM,KAAK,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAGnC,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,4BAA4B,IAAI,CAAC,EAAE,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;YAEvE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACnB,MAAM,EAAE,WAAW;gBACnB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,WAAW,EAAE,KAAK,CAAC,MAAM;aAC1B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;YAChD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC,CAAC;QAChE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ForgeCraft — HTTP Server Entry Point.
4
+ *
5
+ * Exposes the ForgeCraft sentinel and tag classifier over Streamable HTTP
6
+ * for hosted deployment (Smithery, Railway). Tools accept file CONTENTS
7
+ * rather than local paths — the AI agent reads files locally and sends
8
+ * them here; the server returns CLI command guidance.
9
+ *
10
+ * Also exposes POST /contribute/gate — receives gate proposals from
11
+ * forgecraft clients and opens GitHub Issues on jghiringhelli/quality-gates.
12
+ *
13
+ * Local / CLI usage stays on stdio via the main entry point (index.ts).
14
+ */
15
+ export {};
16
+ //# sourceMappingURL=http-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-server.d.ts","sourceRoot":"","sources":["../src/http-server.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG"}
@@ -0,0 +1,200 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ForgeCraft — HTTP Server Entry Point.
4
+ *
5
+ * Exposes the ForgeCraft sentinel and tag classifier over Streamable HTTP
6
+ * for hosted deployment (Smithery, Railway). Tools accept file CONTENTS
7
+ * rather than local paths — the AI agent reads files locally and sends
8
+ * them here; the server returns CLI command guidance.
9
+ *
10
+ * Also exposes POST /contribute/gate — receives gate proposals from
11
+ * forgecraft clients and opens GitHub Issues on jghiringhelli/quality-gates.
12
+ *
13
+ * Local / CLI usage stays on stdio via the main entry point (index.ts).
14
+ */
15
+ import express from "express";
16
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
18
+ import { z } from "zod";
19
+ import { ALL_TAGS } from "./shared/types.js";
20
+ import { createContributeGateRouter } from "./http-server-contribute.js";
21
+ const PORT = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
22
+ const HOST = process.env.HOST ?? "0.0.0.0";
23
+ // ── Tool: hosted sentinel ─────────────────────────────────────────────
24
+ const hostedSentinelSchema = z.object({
25
+ forgecraft_yaml_content: z
26
+ .string()
27
+ .optional()
28
+ .describe("Contents of forgecraft.yaml if it exists in the project root."),
29
+ claude_md_exists: z
30
+ .boolean()
31
+ .optional()
32
+ .describe("Whether CLAUDE.md exists in the project root."),
33
+ hooks_dir_exists: z
34
+ .boolean()
35
+ .optional()
36
+ .describe("Whether .claude/hooks/ directory exists."),
37
+ project_name: z
38
+ .string()
39
+ .optional()
40
+ .describe("Project name for display purposes."),
41
+ });
42
+ /**
43
+ * Cloud sentinel: accepts project state as arguments, returns CLI commands.
44
+ * Mirror of the local sentinel but file-content-based instead of path-based.
45
+ */
46
+ function hostedSentinelHandler(args) {
47
+ const { forgecraft_yaml_content, claude_md_exists, hooks_dir_exists } = args;
48
+ const hasConfig = Boolean(forgecraft_yaml_content);
49
+ const hasClaudeMd = claude_md_exists ?? false;
50
+ const hasHooks = hooks_dir_exists ?? false;
51
+ const validTagList = ALL_TAGS.join(" | ");
52
+ const lines = [];
53
+ if (!hasConfig && !hasClaudeMd) {
54
+ lines.push("## Project has no engineering standards configured.", "", "Run in your project root:", "```bash", "npx forgecraft-mcp setup .", "```", "", "This analyzes your project, infers tags from spec files, and generates", "CLAUDE.md, .github/copilot-instructions.md, hooks, and skills.", "", `Available tags (pass only these to --tags): ${validTagList}`, "", "To set tags explicitly:", "```bash", "npx forgecraft-mcp setup . --tags UNIVERSAL API", "```");
55
+ }
56
+ else if (hasConfig && !hasHooks) {
57
+ lines.push("## forgecraft.yaml found but hooks are missing.", "", "Run in your project root:", "```bash", "npx forgecraft-mcp scaffold .", "```");
58
+ }
59
+ else {
60
+ const configStatus = hasConfig ? "forgecraft.yaml ✓" : "no forgecraft.yaml";
61
+ const mdStatus = hasClaudeMd ? "CLAUDE.md ✓" : "no CLAUDE.md";
62
+ const hooksStatus = hasHooks ? ".claude/hooks ✓" : "no hooks";
63
+ lines.push(`## Project status: ${configStatus} | ${mdStatus} | ${hooksStatus}`, "", "Available commands (run in your project root):", "```bash", "npx forgecraft-mcp refresh . # re-sync after project changes", "npx forgecraft-mcp audit . # score compliance 0-100", "npx forgecraft-mcp verify . # run tests + GS property scores", "```");
64
+ }
65
+ lines.push("", "---", "ForgeCraft runs locally via npx — your project files never leave your machine.", "Docs: https://github.com/jghiringhelli/forgecraft-mcp");
66
+ return { content: [{ type: "text", text: lines.join("\n") }] };
67
+ }
68
+ // ── Tool: list tags ───────────────────────────────────────────────────
69
+ function listTagsHandler() {
70
+ const rows = ALL_TAGS.map((tag) => `- \`${tag}\``).join("\n");
71
+ return {
72
+ content: [
73
+ {
74
+ type: "text",
75
+ text: [
76
+ `## ForgeCraft Tags (${ALL_TAGS.length} available)`,
77
+ "",
78
+ rows,
79
+ "",
80
+ "Use `npx forgecraft-mcp setup . --tags <TAG1> <TAG2>` to set tags explicitly,",
81
+ "or let `setup` auto-detect them from your codebase.",
82
+ ].join("\n"),
83
+ },
84
+ ],
85
+ };
86
+ }
87
+ // ── MCP Server factory ────────────────────────────────────────────────
88
+ /**
89
+ * Create a fresh MCP server instance with all hosted tools, prompts, and
90
+ * resources registered. Called per-request in stateless mode.
91
+ */
92
+ function createServer() {
93
+ const server = new McpServer({
94
+ name: "forgecraft",
95
+ version: "1.0.0",
96
+ });
97
+ // ── Tools ──────────────────────────────────────────────────────────
98
+ server.tool("forgecraft", "Diagnose ForgeCraft project state and return CLI commands to run locally. Pass forgecraft.yaml contents and artifact presence flags.", hostedSentinelSchema.shape, { readOnlyHint: true, openWorldHint: false }, (args) => hostedSentinelHandler(args));
99
+ server.tool("list_tags", "Return all ForgeCraft classification tags. Use these to pick the right tags for npx forgecraft-mcp setup.", {}, { readOnlyHint: true, openWorldHint: false }, () => listTagsHandler());
100
+ // ── Prompts ────────────────────────────────────────────────────────
101
+ server.prompt("setup-project", "Scaffold ForgeCraft engineering standards for a project. Checks current state then runs setup.", {
102
+ project_dir: z
103
+ .string()
104
+ .describe("Absolute path to the project root directory."),
105
+ }, ({ project_dir }) => ({
106
+ messages: [
107
+ {
108
+ role: "user",
109
+ content: {
110
+ type: "text",
111
+ text: [
112
+ `Set up ForgeCraft engineering standards for the project at: ${project_dir}`,
113
+ "",
114
+ "Steps:",
115
+ "1. Call the `forgecraft` tool with the artifact presence flags for this project.",
116
+ "2. Follow its recommendations: run the suggested npx forgecraft-mcp commands locally.",
117
+ "3. Once setup is complete, remove ForgeCraft from your MCP servers to save tokens.",
118
+ "",
119
+ "Tip: After running `npx forgecraft-mcp setup .`, your project will have a CLAUDE.md",
120
+ "constitution, commit hooks, and a forgecraft.yaml config — all auto-tailored to your stack.",
121
+ ].join("\n"),
122
+ },
123
+ },
124
+ ],
125
+ }));
126
+ // ── Resources ──────────────────────────────────────────────────────
127
+ server.resource("tag-taxonomy", "forgecraft://tags", {
128
+ description: "Complete ForgeCraft tag taxonomy. Use these tags to configure stack-specific engineering standards.",
129
+ mimeType: "text/plain",
130
+ }, () => ({
131
+ contents: [
132
+ {
133
+ uri: "forgecraft://tags",
134
+ mimeType: "text/plain",
135
+ text: [
136
+ "# ForgeCraft Tag Taxonomy",
137
+ "",
138
+ "Use these tags with: npx forgecraft-mcp setup . --tags <TAG1> <TAG2>",
139
+ "",
140
+ ...ALL_TAGS.map((tag) => `- ${tag}`),
141
+ "",
142
+ "Stack tags (UNIVERSAL is always included):",
143
+ " UNIVERSAL — core standards for all projects",
144
+ " API — REST/GraphQL API standards",
145
+ " WEB-REACT — React/Next.js frontend standards",
146
+ " GAME — game development standards",
147
+ " FINTECH — financial/compliance standards",
148
+ " ML — machine learning pipeline standards",
149
+ " MOBILE — React Native / mobile standards",
150
+ " CLI — command-line tool standards",
151
+ " LIBRARY — npm/pip package standards",
152
+ " WEB3 — smart contract / blockchain standards",
153
+ ].join("\n"),
154
+ },
155
+ ],
156
+ }));
157
+ return server;
158
+ }
159
+ // ── Express app ───────────────────────────────────────────────────────
160
+ const app = express();
161
+ app.use(express.json());
162
+ app.get("/health", (_req, res) => {
163
+ res.json({ status: "ok", version: "1.0.0", transport: "streamable-http" });
164
+ });
165
+ // ── Gate contribution endpoint (extracted to http-server-contribute.ts) ──
166
+ app.use(createContributeGateRouter());
167
+ /** Stateless Streamable HTTP — new transport per request, no session state. */
168
+ app.post("/mcp", async (req, res) => {
169
+ const transport = new StreamableHTTPServerTransport({
170
+ sessionIdGenerator: undefined,
171
+ });
172
+ const server = createServer();
173
+ await server.connect(transport);
174
+ res.on("close", () => {
175
+ transport.close();
176
+ server.close();
177
+ });
178
+ await transport.handleRequest(req, res, req.body);
179
+ });
180
+ app.get("/mcp", async (req, res) => {
181
+ const transport = new StreamableHTTPServerTransport({
182
+ sessionIdGenerator: undefined,
183
+ });
184
+ const server = createServer();
185
+ await server.connect(transport);
186
+ res.on("close", () => {
187
+ transport.close();
188
+ server.close();
189
+ });
190
+ await transport.handleRequest(req, res);
191
+ });
192
+ app.delete("/mcp", async (_req, res) => {
193
+ res.status(405).json({ error: "Method not allowed in stateless mode" });
194
+ });
195
+ app.listen(PORT, HOST, () => {
196
+ console.log(`ForgeCraft MCP HTTP server running on port ${PORT}`);
197
+ console.log(`MCP endpoint: http://${HOST}:${PORT}/mcp`);
198
+ console.log(`Health: http://${HOST}:${PORT}/health`);
199
+ });
200
+ //# sourceMappingURL=http-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-server.js","sourceRoot":"","sources":["../src/http-server.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACtE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC;AAE3C,yEAAyE;AAEzE,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,uBAAuB,EAAE,CAAC;SACvB,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,+DAA+D,CAAC;IAC5E,gBAAgB,EAAE,CAAC;SAChB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,+CAA+C,CAAC;IAC5D,gBAAgB,EAAE,CAAC;SAChB,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,QAAQ,CAAC,0CAA0C,CAAC;IACvD,YAAY,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K,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;IACjC,MAAM,SAAS,GAAG,IAAI,6BAA6B,CAAC;QAClD,kBAAkB,EAAE,SAAS;KAC9B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACnB,SAAS,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;IACrC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,sCAAsC,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC,CAAC;AAEH,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE;IAC1B,OAAO,CAAC,GAAG,CAAC,8CAA8C,IAAI,EAAE,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,IAAI,IAAI,MAAM,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,IAAI,IAAI,SAAS,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
2
2
  import { join } from "path";
3
- const DEFAULT_REGISTRY_URL = "https://raw.githubusercontent.com/jghiringhelli/quality-gates/master/index.json";
3
+ const DEFAULT_REGISTRY_URL = "https://raw.githubusercontent.com/jghiringhelli/generative-specification/main/quality-gates/index.json";
4
4
  const CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours
5
5
  /**
6
6
  * Fetches the remote quality-gates registry index.
@@ -20,11 +20,11 @@ export async function fetchRemoteGates(projectRoot, registryUrl) {
20
20
  try {
21
21
  const response = await fetch(url, {
22
22
  signal: AbortSignal.timeout(5000), // 5 second timeout
23
- headers: { "Accept": "application/json" },
23
+ headers: { Accept: "application/json" },
24
24
  });
25
25
  if (!response.ok)
26
26
  return emptyIndex();
27
- const data = await response.json();
27
+ const data = (await response.json());
28
28
  writeCache(cachePath, data, projectRoot);
29
29
  return data;
30
30
  }
@@ -75,6 +75,12 @@ function writeCache(cachePath, data, projectRoot) {
75
75
  }
76
76
  }
77
77
  function emptyIndex() {
78
- return { generatedAt: new Date().toISOString(), version: "1", gateCount: 0, tags: [], gates: [] };
78
+ return {
79
+ generatedAt: new Date().toISOString(),
80
+ version: "1",
81
+ gateCount: 0,
82
+ tags: [],
83
+ gates: [],
84
+ };
79
85
  }
80
86
  //# sourceMappingURL=remote-gates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remote-gates.js","sourceRoot":"","sources":["../../src/registry/remote-gates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA2B5B,MAAM,oBAAoB,GACxB,iFAAiF,CAAC;AAEpF,MAAM,YAAY,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AAOrD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,WAAmB,EACnB,WAAoB;IAEpB,MAAM,GAAG,GAAG,WAAW,IAAI,oBAAoB,CAAC;IAChD,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;IAEvE,MAAM,MAAM,GAAG,SAAS,CAAC,SA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