@massu/core 0.1.0

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.
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);
3
+
4
+ // src/hooks/intent-suggester.ts
5
+ var COMMAND_MAPPINGS = [
6
+ {
7
+ keywords: ["test", "failing"],
8
+ command: "/massu-test",
9
+ description: "Run and analyze tests"
10
+ },
11
+ {
12
+ keywords: ["debug", "bug"],
13
+ command: "/massu-debug",
14
+ description: "Debug an issue"
15
+ },
16
+ {
17
+ keywords: ["refactor"],
18
+ command: "/massu-refactor",
19
+ description: "Guided refactoring workflow"
20
+ },
21
+ {
22
+ keywords: ["cleanup", "dead code", "unused"],
23
+ command: "/massu-cleanup",
24
+ description: "Clean up dead code and unused exports"
25
+ },
26
+ {
27
+ keywords: ["document", "jsdoc", "readme"],
28
+ command: "/massu-doc-gen",
29
+ description: "Generate documentation"
30
+ },
31
+ {
32
+ keywords: ["estimate", "effort", "how long"],
33
+ command: "/massu-estimate",
34
+ description: "Estimate implementation effort"
35
+ },
36
+ {
37
+ keywords: ["release", "deploy"],
38
+ command: "/massu-release",
39
+ description: "Prepare a release"
40
+ },
41
+ {
42
+ keywords: ["commit"],
43
+ command: "/massu-commit",
44
+ description: "Pre-commit verification gate"
45
+ },
46
+ {
47
+ keywords: ["push"],
48
+ command: "/massu-push",
49
+ description: "Pre-push full verification gate"
50
+ },
51
+ {
52
+ keywords: ["plan"],
53
+ command: "/massu-create-plan",
54
+ description: "Create an implementation plan"
55
+ }
56
+ ];
57
+ function findMatchingCommand(prompt) {
58
+ const lowerPrompt = prompt.toLowerCase();
59
+ for (const mapping of COMMAND_MAPPINGS) {
60
+ for (const keyword of mapping.keywords) {
61
+ if (lowerPrompt.includes(keyword.toLowerCase())) {
62
+ return mapping;
63
+ }
64
+ }
65
+ }
66
+ return null;
67
+ }
68
+ async function main() {
69
+ try {
70
+ const input = await readStdin();
71
+ const hookInput = JSON.parse(input);
72
+ const { prompt } = hookInput;
73
+ if (!prompt || !prompt.trim()) {
74
+ process.exit(0);
75
+ return;
76
+ }
77
+ const match = findMatchingCommand(prompt);
78
+ if (!match) {
79
+ process.exit(0);
80
+ return;
81
+ }
82
+ process.stdout.write(
83
+ `Tip: Use ${match.command} to ${match.description}.`
84
+ );
85
+ } catch (_e) {
86
+ }
87
+ process.exit(0);
88
+ }
89
+ function readStdin() {
90
+ return new Promise((resolve) => {
91
+ let data = "";
92
+ process.stdin.setEncoding("utf-8");
93
+ process.stdin.on("data", (chunk) => {
94
+ data += chunk;
95
+ });
96
+ process.stdin.on("end", () => resolve(data));
97
+ setTimeout(() => resolve(data), 3e3);
98
+ });
99
+ }
100
+ main();