@gethmy/mcp 1.0.0 → 2.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.
Files changed (65) hide show
  1. package/README.md +201 -36
  2. package/dist/cli.js +20938 -20249
  3. package/dist/http.js +1957 -0
  4. package/dist/index.js +17833 -17888
  5. package/dist/lib/__tests__/active-learning.test.js +386 -0
  6. package/dist/lib/__tests__/agent-performance-profiles.test.js +325 -0
  7. package/dist/lib/__tests__/auto-session.test.js +661 -0
  8. package/dist/lib/__tests__/context-assembly.test.js +362 -0
  9. package/dist/lib/__tests__/graph-expansion.test.js +150 -0
  10. package/dist/lib/__tests__/integration-memory-crud.test.js +797 -0
  11. package/dist/lib/__tests__/integration-memory-system.test.js +281 -0
  12. package/dist/lib/__tests__/lifecycle-maintenance.test.js +207 -0
  13. package/dist/lib/__tests__/pattern-detection.test.js +295 -0
  14. package/dist/lib/__tests__/prompt-builder.test.js +418 -0
  15. package/dist/lib/active-learning.js +878 -0
  16. package/dist/lib/api-client.js +548 -0
  17. package/dist/lib/auto-session.js +173 -0
  18. package/dist/lib/cli.js +127 -0
  19. package/dist/lib/config.js +205 -0
  20. package/dist/lib/consolidation.js +243 -0
  21. package/dist/lib/context-assembly.js +606 -0
  22. package/dist/lib/graph-expansion.js +163 -0
  23. package/dist/lib/http.js +174 -0
  24. package/dist/lib/index.js +7 -0
  25. package/dist/lib/lifecycle-maintenance.js +88 -0
  26. package/dist/lib/prompt-builder.js +483 -0
  27. package/dist/lib/remote.js +166 -0
  28. package/dist/lib/server.js +3132 -0
  29. package/dist/lib/tui/agents.js +116 -0
  30. package/dist/lib/tui/docs.js +558 -0
  31. package/dist/lib/tui/setup.js +1068 -0
  32. package/dist/lib/tui/theme.js +95 -0
  33. package/dist/lib/tui/writer.js +200 -0
  34. package/dist/remote.js +34534 -0
  35. package/dist/server.js +31967 -0
  36. package/package.json +20 -7
  37. package/src/__tests__/active-learning.test.ts +483 -0
  38. package/src/__tests__/agent-performance-profiles.test.ts +468 -0
  39. package/src/__tests__/auto-session.test.ts +912 -0
  40. package/src/__tests__/context-assembly.test.ts +506 -0
  41. package/src/__tests__/graph-expansion.test.ts +285 -0
  42. package/src/__tests__/integration-memory-crud.test.ts +948 -0
  43. package/src/__tests__/integration-memory-system.test.ts +321 -0
  44. package/src/__tests__/lifecycle-maintenance.test.ts +238 -0
  45. package/src/__tests__/pattern-detection.test.ts +438 -0
  46. package/src/__tests__/prompt-builder.test.ts +505 -0
  47. package/src/active-learning.ts +1227 -0
  48. package/src/api-client.ts +963 -0
  49. package/src/auto-session.ts +218 -0
  50. package/src/cli.ts +166 -0
  51. package/src/config.ts +285 -0
  52. package/src/consolidation.ts +314 -0
  53. package/src/context-assembly.ts +842 -0
  54. package/src/graph-expansion.ts +234 -0
  55. package/src/http.ts +265 -0
  56. package/src/index.ts +8 -0
  57. package/src/lifecycle-maintenance.ts +120 -0
  58. package/src/prompt-builder.ts +681 -0
  59. package/src/remote.ts +227 -0
  60. package/src/server.ts +3858 -0
  61. package/src/tui/agents.ts +154 -0
  62. package/src/tui/docs.ts +650 -0
  63. package/src/tui/setup.ts +1281 -0
  64. package/src/tui/theme.ts +114 -0
  65. package/src/tui/writer.ts +260 -0
@@ -0,0 +1,154 @@
1
+ import { existsSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+
5
+ export type AgentId = "claude" | "codex" | "cursor" | "windsurf";
6
+
7
+ export interface DetectedAgent {
8
+ id: AgentId;
9
+ name: string;
10
+ detected: boolean;
11
+ globalPath: string | null;
12
+ localPath: string | null;
13
+ description: string;
14
+ hint: string;
15
+ }
16
+
17
+ interface AgentDefinition {
18
+ id: AgentId;
19
+ name: string;
20
+ description: string;
21
+ hint: string;
22
+ globalPaths: string[];
23
+ localPaths: string[];
24
+ }
25
+
26
+ const AGENT_DEFINITIONS: AgentDefinition[] = [
27
+ {
28
+ id: "claude",
29
+ name: "Claude Code",
30
+ description: "Anthropic CLI agent",
31
+ hint: "/hmy <card>",
32
+ globalPaths: [join(homedir(), ".claude")],
33
+ localPaths: [".claude"],
34
+ },
35
+ {
36
+ id: "codex",
37
+ name: "Codex",
38
+ description: "OpenAI coding agent",
39
+ hint: "/prompts:hmy <card>",
40
+ globalPaths: [join(homedir(), ".codex")],
41
+ localPaths: ["AGENTS.md"],
42
+ },
43
+ {
44
+ id: "cursor",
45
+ name: "Cursor",
46
+ description: "AI-powered IDE",
47
+ hint: "MCP tools available automatically",
48
+ globalPaths: [],
49
+ localPaths: [".cursor", ".cursorrules"],
50
+ },
51
+ {
52
+ id: "windsurf",
53
+ name: "Windsurf",
54
+ description: "Codeium AI IDE",
55
+ hint: "MCP tools available automatically",
56
+ globalPaths: [join(homedir(), ".codeium", "windsurf")],
57
+ localPaths: [".windsurf", ".windsurfrules"],
58
+ },
59
+ ];
60
+
61
+ /**
62
+ * Detect installed agents by checking for config directories
63
+ */
64
+ export function detectAgents(cwd: string = process.cwd()): DetectedAgent[] {
65
+ return AGENT_DEFINITIONS.map((def) => {
66
+ // Check global paths
67
+ const globalPath = def.globalPaths.find((p) => existsSync(p)) || null;
68
+
69
+ // Check local paths
70
+ const localPath =
71
+ def.localPaths.find((p) => existsSync(join(cwd, p))) || null;
72
+
73
+ return {
74
+ id: def.id,
75
+ name: def.name,
76
+ detected: !!(globalPath || localPath),
77
+ globalPath,
78
+ localPath: localPath ? join(cwd, localPath) : null,
79
+ description: def.description,
80
+ hint: def.hint,
81
+ };
82
+ });
83
+ }
84
+
85
+ /**
86
+ * Get agent by ID
87
+ */
88
+ export function getAgentById(id: AgentId): AgentDefinition | undefined {
89
+ return AGENT_DEFINITIONS.find((def) => def.id === id);
90
+ }
91
+
92
+ /**
93
+ * Get all supported agent IDs
94
+ */
95
+ export function getSupportedAgentIds(): AgentId[] {
96
+ return AGENT_DEFINITIONS.map((def) => def.id);
97
+ }
98
+
99
+ /**
100
+ * Get config paths that will be created for an agent
101
+ */
102
+ export function getAgentConfigPaths(
103
+ agentId: AgentId,
104
+ cwd: string = process.cwd(),
105
+ ): { global: string[]; local: string[] } {
106
+ const home = homedir();
107
+
108
+ switch (agentId) {
109
+ case "claude":
110
+ return {
111
+ global: [join(home, ".claude", "settings.json")],
112
+ local: [join(cwd, ".claude", "skills", "hmy", "SKILL.md")],
113
+ };
114
+ case "codex":
115
+ return {
116
+ global: [
117
+ join(home, ".codex", "config.toml"),
118
+ join(home, ".codex", "prompts", "hmy.md"),
119
+ ],
120
+ local: [join(cwd, "AGENTS.md")],
121
+ };
122
+ case "cursor":
123
+ return {
124
+ global: [],
125
+ local: [
126
+ join(cwd, ".cursor", "mcp.json"),
127
+ join(cwd, ".cursor", "rules", "harmony.mdc"),
128
+ ],
129
+ };
130
+ case "windsurf":
131
+ return {
132
+ global: [join(home, ".codeium", "windsurf", "mcp_config.json")],
133
+ local: [join(cwd, ".windsurf", "rules", "harmony.md")],
134
+ };
135
+ default:
136
+ return { global: [], local: [] };
137
+ }
138
+ }
139
+
140
+ /**
141
+ * Format agent for display in selection
142
+ */
143
+ export function formatAgentOption(agent: DetectedAgent): {
144
+ value: AgentId;
145
+ label: string;
146
+ hint: string;
147
+ } {
148
+ const status = agent.detected ? "(detected)" : "(not detected)";
149
+ return {
150
+ value: agent.id,
151
+ label: `${agent.name}`,
152
+ hint: `${agent.description} ${status}`,
153
+ };
154
+ }