harmony-mcp 1.0.4 → 1.1.1
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/README.md +81 -31
- package/dist/cli.js +643 -10
- package/dist/index.js +113 -0
- package/dist/init.js +413 -0
- package/package.json +11 -7
package/dist/index.js
CHANGED
|
@@ -23167,6 +23167,22 @@ class HarmonyApiClient {
|
|
|
23167
23167
|
async deleteSubtask(subtaskId) {
|
|
23168
23168
|
return this.request("DELETE", `/subtasks/${subtaskId}`);
|
|
23169
23169
|
}
|
|
23170
|
+
async startAgentSession(cardId, data) {
|
|
23171
|
+
return this.request("POST", `/cards/${cardId}/agent-context`, data);
|
|
23172
|
+
}
|
|
23173
|
+
async updateAgentProgress(cardId, data) {
|
|
23174
|
+
return this.request("POST", `/cards/${cardId}/agent-context`, data);
|
|
23175
|
+
}
|
|
23176
|
+
async endAgentSession(cardId, data) {
|
|
23177
|
+
return this.request("DELETE", `/cards/${cardId}/agent-context`, data);
|
|
23178
|
+
}
|
|
23179
|
+
async getAgentSession(cardId, options) {
|
|
23180
|
+
const params = new URLSearchParams;
|
|
23181
|
+
if (options?.includeEnded)
|
|
23182
|
+
params.set("include_ended", "true");
|
|
23183
|
+
const query = params.toString() ? `?${params.toString()}` : "";
|
|
23184
|
+
return this.request("GET", `/cards/${cardId}/agent-context${query}`);
|
|
23185
|
+
}
|
|
23170
23186
|
async processNLU(data) {
|
|
23171
23187
|
return this.request("POST", "/nlu", data);
|
|
23172
23188
|
}
|
|
@@ -23451,6 +23467,60 @@ var TOOLS = {
|
|
|
23451
23467
|
},
|
|
23452
23468
|
required: ["command"]
|
|
23453
23469
|
}
|
|
23470
|
+
},
|
|
23471
|
+
harmony_start_agent_session: {
|
|
23472
|
+
description: "Start an agent work session on a card. Tracks progress, status, and blockers. Call this when beginning work on a card.",
|
|
23473
|
+
inputSchema: {
|
|
23474
|
+
type: "object",
|
|
23475
|
+
properties: {
|
|
23476
|
+
cardId: { type: "string", description: "Card ID to start working on" },
|
|
23477
|
+
agentIdentifier: { type: "string", description: "Unique agent identifier (e.g., claude-code)" },
|
|
23478
|
+
agentName: { type: "string", description: "Human-readable agent name (e.g., Claude Code)" },
|
|
23479
|
+
currentTask: { type: "string", description: "Initial task description" },
|
|
23480
|
+
estimatedMinutesRemaining: { type: "number", description: "Estimated time to completion in minutes" }
|
|
23481
|
+
},
|
|
23482
|
+
required: ["cardId", "agentIdentifier", "agentName"]
|
|
23483
|
+
}
|
|
23484
|
+
},
|
|
23485
|
+
harmony_update_agent_progress: {
|
|
23486
|
+
description: "Update progress on an active agent session. Use to report progress percentage, current task, blockers, or status changes.",
|
|
23487
|
+
inputSchema: {
|
|
23488
|
+
type: "object",
|
|
23489
|
+
properties: {
|
|
23490
|
+
cardId: { type: "string", description: "Card ID with active session" },
|
|
23491
|
+
agentIdentifier: { type: "string", description: "Agent identifier" },
|
|
23492
|
+
agentName: { type: "string", description: "Agent name" },
|
|
23493
|
+
status: { type: "string", enum: ["working", "blocked", "paused"], description: "Current status" },
|
|
23494
|
+
progressPercent: { type: "number", description: "Progress percentage (0-100)" },
|
|
23495
|
+
currentTask: { type: "string", description: "What the agent is currently doing" },
|
|
23496
|
+
blockers: { type: "array", items: { type: "string" }, description: "List of blocking issues" },
|
|
23497
|
+
estimatedMinutesRemaining: { type: "number", description: "Updated time estimate" }
|
|
23498
|
+
},
|
|
23499
|
+
required: ["cardId", "agentIdentifier", "agentName"]
|
|
23500
|
+
}
|
|
23501
|
+
},
|
|
23502
|
+
harmony_end_agent_session: {
|
|
23503
|
+
description: "End an agent work session on a card. Call this when work is complete or paused.",
|
|
23504
|
+
inputSchema: {
|
|
23505
|
+
type: "object",
|
|
23506
|
+
properties: {
|
|
23507
|
+
cardId: { type: "string", description: "Card ID to end session on" },
|
|
23508
|
+
status: { type: "string", enum: ["completed", "paused"], description: "Final status (default: completed)" },
|
|
23509
|
+
progressPercent: { type: "number", description: "Final progress percentage" }
|
|
23510
|
+
},
|
|
23511
|
+
required: ["cardId"]
|
|
23512
|
+
}
|
|
23513
|
+
},
|
|
23514
|
+
harmony_get_agent_session: {
|
|
23515
|
+
description: "Get the current agent session for a card, including progress, status, and blockers.",
|
|
23516
|
+
inputSchema: {
|
|
23517
|
+
type: "object",
|
|
23518
|
+
properties: {
|
|
23519
|
+
cardId: { type: "string", description: "Card ID to check" },
|
|
23520
|
+
includeEnded: { type: "boolean", description: "Include ended sessions in history" }
|
|
23521
|
+
},
|
|
23522
|
+
required: ["cardId"]
|
|
23523
|
+
}
|
|
23454
23524
|
}
|
|
23455
23525
|
};
|
|
23456
23526
|
var RESOURCES = [
|
|
@@ -23767,6 +23837,49 @@ Include: cards moved recently, current in-progress items, blocked or high-priori
|
|
|
23767
23837
|
});
|
|
23768
23838
|
return { success: true, ...result };
|
|
23769
23839
|
}
|
|
23840
|
+
case "harmony_start_agent_session": {
|
|
23841
|
+
const cardId = exports_external.string().uuid().parse(args.cardId);
|
|
23842
|
+
const agentIdentifier = exports_external.string().min(1).parse(args.agentIdentifier);
|
|
23843
|
+
const agentName = exports_external.string().min(1).parse(args.agentName);
|
|
23844
|
+
const result = await client2.startAgentSession(cardId, {
|
|
23845
|
+
agentIdentifier,
|
|
23846
|
+
agentName,
|
|
23847
|
+
status: "working",
|
|
23848
|
+
currentTask: args.currentTask,
|
|
23849
|
+
estimatedMinutesRemaining: args.estimatedMinutesRemaining
|
|
23850
|
+
});
|
|
23851
|
+
return { success: true, ...result };
|
|
23852
|
+
}
|
|
23853
|
+
case "harmony_update_agent_progress": {
|
|
23854
|
+
const cardId = exports_external.string().uuid().parse(args.cardId);
|
|
23855
|
+
const agentIdentifier = exports_external.string().min(1).parse(args.agentIdentifier);
|
|
23856
|
+
const agentName = exports_external.string().min(1).parse(args.agentName);
|
|
23857
|
+
const result = await client2.updateAgentProgress(cardId, {
|
|
23858
|
+
agentIdentifier,
|
|
23859
|
+
agentName,
|
|
23860
|
+
status: args.status,
|
|
23861
|
+
progressPercent: args.progressPercent,
|
|
23862
|
+
currentTask: args.currentTask,
|
|
23863
|
+
blockers: args.blockers,
|
|
23864
|
+
estimatedMinutesRemaining: args.estimatedMinutesRemaining
|
|
23865
|
+
});
|
|
23866
|
+
return { success: true, ...result };
|
|
23867
|
+
}
|
|
23868
|
+
case "harmony_end_agent_session": {
|
|
23869
|
+
const cardId = exports_external.string().uuid().parse(args.cardId);
|
|
23870
|
+
const result = await client2.endAgentSession(cardId, {
|
|
23871
|
+
status: args.status || "completed",
|
|
23872
|
+
progressPercent: args.progressPercent
|
|
23873
|
+
});
|
|
23874
|
+
return { success: true, ...result };
|
|
23875
|
+
}
|
|
23876
|
+
case "harmony_get_agent_session": {
|
|
23877
|
+
const cardId = exports_external.string().uuid().parse(args.cardId);
|
|
23878
|
+
const result = await client2.getAgentSession(cardId, {
|
|
23879
|
+
includeEnded: args.includeEnded === true || args.includeEnded === "true"
|
|
23880
|
+
});
|
|
23881
|
+
return { success: true, ...result };
|
|
23882
|
+
}
|
|
23770
23883
|
default:
|
|
23771
23884
|
throw new Error(`Unknown tool: ${name}`);
|
|
23772
23885
|
}
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, {
|
|
22
|
+
get: all[name],
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
set: (newValue) => all[name] = () => newValue
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
29
|
+
|
|
30
|
+
// src/init.ts
|
|
31
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync } from "node:fs";
|
|
32
|
+
import { join, dirname } from "node:path";
|
|
33
|
+
import { homedir } from "node:os";
|
|
34
|
+
var HARMONY_WORKFLOW_PROMPT = `# Harmony Card Workflow
|
|
35
|
+
|
|
36
|
+
You are starting work on a Harmony card. Follow this workflow:
|
|
37
|
+
|
|
38
|
+
## Step 1: Find the Card
|
|
39
|
+
|
|
40
|
+
The user provided: $ARGUMENTS
|
|
41
|
+
|
|
42
|
+
Parse the card reference:
|
|
43
|
+
- If it starts with \`#\` followed by numbers (e.g., \`#42\`), use \`harmony_get_card_by_short_id\` with the number
|
|
44
|
+
- If it looks like a UUID, use \`harmony_get_card\` directly
|
|
45
|
+
- Otherwise, use \`harmony_search_cards\` to find by name
|
|
46
|
+
|
|
47
|
+
## Step 2: Move to In Progress
|
|
48
|
+
|
|
49
|
+
Once you have the card:
|
|
50
|
+
1. Get the board using \`harmony_get_board\` to find the "In Progress" column ID
|
|
51
|
+
2. Use \`harmony_move_card\` to move the card to "In Progress"
|
|
52
|
+
|
|
53
|
+
## Step 3: Add Agent Label
|
|
54
|
+
|
|
55
|
+
1. From the board response, find the label named "agent"
|
|
56
|
+
2. Use \`harmony_add_label_to_card\` to add it to the card
|
|
57
|
+
|
|
58
|
+
## Step 4: Start Agent Session
|
|
59
|
+
|
|
60
|
+
After adding the agent label, start tracking your work session:
|
|
61
|
+
1. Use \`harmony_start_agent_session\` with:
|
|
62
|
+
- \`cardId\`: The card ID
|
|
63
|
+
- \`agentIdentifier\`: Your agent identifier
|
|
64
|
+
- \`agentName\`: Your agent name
|
|
65
|
+
- \`currentTask\`: A brief description of what you're about to do
|
|
66
|
+
|
|
67
|
+
This enables the timer badge on the card to show your progress in real-time.
|
|
68
|
+
|
|
69
|
+
## Step 5: Display Card Details
|
|
70
|
+
|
|
71
|
+
Show the user:
|
|
72
|
+
- Card title and short ID
|
|
73
|
+
- Description (if any)
|
|
74
|
+
- Priority
|
|
75
|
+
- Current labels
|
|
76
|
+
- Due date (if set)
|
|
77
|
+
|
|
78
|
+
## Step 6: Implement the Solution
|
|
79
|
+
|
|
80
|
+
Based on the card's title and description:
|
|
81
|
+
1. Understand what needs to be done
|
|
82
|
+
2. Explore the codebase as needed
|
|
83
|
+
3. Implement the required changes
|
|
84
|
+
4. Test the changes
|
|
85
|
+
|
|
86
|
+
**During implementation, update your progress periodically:**
|
|
87
|
+
- Use \`harmony_update_agent_progress\` to report:
|
|
88
|
+
- \`progressPercent\`: Estimated completion (0-100)
|
|
89
|
+
- \`currentTask\`: What you're currently doing
|
|
90
|
+
- \`blockers\`: Any issues blocking progress (set \`status: "blocked"\` if blocked)
|
|
91
|
+
|
|
92
|
+
## Step 7: Complete Work
|
|
93
|
+
|
|
94
|
+
When implementation is complete:
|
|
95
|
+
1. Use \`harmony_end_agent_session\` with:
|
|
96
|
+
- \`cardId\`: The card ID
|
|
97
|
+
- \`status\`: "completed"
|
|
98
|
+
- \`progressPercent\`: 100
|
|
99
|
+
2. Use \`harmony_move_card\` to move the card to the "Review" column
|
|
100
|
+
3. Summarize what was accomplished
|
|
101
|
+
|
|
102
|
+
## Important Notes
|
|
103
|
+
- Always read the card description carefully before starting
|
|
104
|
+
- If the task is unclear, ask for clarification
|
|
105
|
+
- Make commits as appropriate during implementation
|
|
106
|
+
- The "agent" label indicates AI is working on the card
|
|
107
|
+
- Update progress at meaningful milestones, not constantly
|
|
108
|
+
- If you need to pause work, call \`harmony_end_agent_session\` with \`status: "paused"\`
|
|
109
|
+
`;
|
|
110
|
+
function ensureDir(dirPath) {
|
|
111
|
+
if (!existsSync(dirPath)) {
|
|
112
|
+
mkdirSync(dirPath, { recursive: true });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function writeFileIfNotExists(filePath, content, force) {
|
|
116
|
+
if (existsSync(filePath) && !force) {
|
|
117
|
+
return { created: false, skipped: true };
|
|
118
|
+
}
|
|
119
|
+
ensureDir(dirname(filePath));
|
|
120
|
+
writeFileSync(filePath, content, "utf-8");
|
|
121
|
+
return { created: true, skipped: false };
|
|
122
|
+
}
|
|
123
|
+
function mergeJsonFile(filePath, updates, force) {
|
|
124
|
+
if (!existsSync(filePath)) {
|
|
125
|
+
ensureDir(dirname(filePath));
|
|
126
|
+
writeFileSync(filePath, JSON.stringify(updates, null, 2), "utf-8");
|
|
127
|
+
return { created: true, skipped: false, merged: false };
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const existing = JSON.parse(readFileSync(filePath, "utf-8"));
|
|
131
|
+
if (updates.mcpServers && existing.mcpServers) {
|
|
132
|
+
if (existing.mcpServers.harmony && !force) {
|
|
133
|
+
return { created: false, skipped: true, merged: false };
|
|
134
|
+
}
|
|
135
|
+
existing.mcpServers = { ...existing.mcpServers, ...updates.mcpServers };
|
|
136
|
+
} else {
|
|
137
|
+
Object.assign(existing, updates);
|
|
138
|
+
}
|
|
139
|
+
writeFileSync(filePath, JSON.stringify(existing, null, 2), "utf-8");
|
|
140
|
+
return { created: false, skipped: false, merged: true };
|
|
141
|
+
} catch {
|
|
142
|
+
if (force) {
|
|
143
|
+
writeFileSync(filePath, JSON.stringify(updates, null, 2), "utf-8");
|
|
144
|
+
return { created: true, skipped: false, merged: false };
|
|
145
|
+
}
|
|
146
|
+
return { created: false, skipped: true, merged: false };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function initClaude(cwd, force) {
|
|
150
|
+
const result = {
|
|
151
|
+
agent: "claude",
|
|
152
|
+
filesCreated: [],
|
|
153
|
+
filesSkipped: []
|
|
154
|
+
};
|
|
155
|
+
const commandContent = `---
|
|
156
|
+
description: Start working on a Harmony card (moves to In Progress, adds agent label)
|
|
157
|
+
argument-hint: <card-reference>
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
${HARMONY_WORKFLOW_PROMPT.replace("Your agent identifier", "claude-code").replace("Your agent name", "Claude Code")}
|
|
161
|
+
`;
|
|
162
|
+
const commandPath = join(cwd, ".claude", "commands", "hmy.md");
|
|
163
|
+
const { created, skipped } = writeFileIfNotExists(commandPath, commandContent, force);
|
|
164
|
+
if (created)
|
|
165
|
+
result.filesCreated.push(commandPath);
|
|
166
|
+
if (skipped)
|
|
167
|
+
result.filesSkipped.push(commandPath);
|
|
168
|
+
const globalConfigPath = join(homedir(), ".claude", "settings.json");
|
|
169
|
+
const mcpConfig = {
|
|
170
|
+
mcpServers: {
|
|
171
|
+
harmony: {
|
|
172
|
+
command: "harmony-mcp",
|
|
173
|
+
args: ["serve"]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const configResult = mergeJsonFile(globalConfigPath, mcpConfig, force);
|
|
178
|
+
if (configResult.created || configResult.merged) {
|
|
179
|
+
result.filesCreated.push(globalConfigPath);
|
|
180
|
+
} else if (configResult.skipped) {
|
|
181
|
+
result.filesSkipped.push(globalConfigPath);
|
|
182
|
+
}
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
function initCodex(cwd, force) {
|
|
186
|
+
const result = {
|
|
187
|
+
agent: "codex",
|
|
188
|
+
filesCreated: [],
|
|
189
|
+
filesSkipped: []
|
|
190
|
+
};
|
|
191
|
+
const agentsContent = `# Harmony Integration
|
|
192
|
+
|
|
193
|
+
This project uses Harmony for task management. When working on tasks:
|
|
194
|
+
|
|
195
|
+
## Starting Work on a Card
|
|
196
|
+
|
|
197
|
+
When given a card reference (e.g., #42 or a card name), follow this workflow:
|
|
198
|
+
|
|
199
|
+
1. Use \`harmony_get_card_by_short_id\` or \`harmony_search_cards\` to find the card
|
|
200
|
+
2. Move the card to "In Progress" using \`harmony_move_card\`
|
|
201
|
+
3. Add the "agent" label using \`harmony_add_label_to_card\`
|
|
202
|
+
4. Start a session with \`harmony_start_agent_session\` (agentIdentifier: "codex", agentName: "OpenAI Codex")
|
|
203
|
+
5. Show the card details to the user
|
|
204
|
+
6. Implement the solution based on the card description
|
|
205
|
+
7. Update progress periodically with \`harmony_update_agent_progress\`
|
|
206
|
+
8. When done, call \`harmony_end_agent_session\` and move to "Review"
|
|
207
|
+
|
|
208
|
+
## Available Harmony Tools
|
|
209
|
+
|
|
210
|
+
- \`harmony_get_card\`, \`harmony_get_card_by_short_id\`, \`harmony_search_cards\` - Find cards
|
|
211
|
+
- \`harmony_move_card\` - Move cards between columns
|
|
212
|
+
- \`harmony_add_label_to_card\`, \`harmony_remove_label_from_card\` - Manage labels
|
|
213
|
+
- \`harmony_start_agent_session\`, \`harmony_update_agent_progress\`, \`harmony_end_agent_session\` - Track work
|
|
214
|
+
- \`harmony_get_board\` - Get board state
|
|
215
|
+
`;
|
|
216
|
+
const agentsPath = join(cwd, "AGENTS.md");
|
|
217
|
+
const { created: agentsCreated, skipped: agentsSkipped } = writeFileIfNotExists(agentsPath, agentsContent, force);
|
|
218
|
+
if (agentsCreated)
|
|
219
|
+
result.filesCreated.push(agentsPath);
|
|
220
|
+
if (agentsSkipped)
|
|
221
|
+
result.filesSkipped.push(agentsPath);
|
|
222
|
+
const promptContent = `---
|
|
223
|
+
name: hmy
|
|
224
|
+
description: Start working on a Harmony card
|
|
225
|
+
arguments:
|
|
226
|
+
- name: card
|
|
227
|
+
description: Card reference (#42, UUID, or name)
|
|
228
|
+
required: true
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
${HARMONY_WORKFLOW_PROMPT.replace("$ARGUMENTS", "{{card}}").replace("Your agent identifier", "codex").replace("Your agent name", "OpenAI Codex")}
|
|
232
|
+
`;
|
|
233
|
+
const promptsDir = join(homedir(), ".codex", "prompts");
|
|
234
|
+
const promptPath = join(promptsDir, "hmy.md");
|
|
235
|
+
const { created: promptCreated, skipped: promptSkipped } = writeFileIfNotExists(promptPath, promptContent, force);
|
|
236
|
+
if (promptCreated)
|
|
237
|
+
result.filesCreated.push(promptPath);
|
|
238
|
+
if (promptSkipped)
|
|
239
|
+
result.filesSkipped.push(promptPath);
|
|
240
|
+
const configPath = join(homedir(), ".codex", "config.toml");
|
|
241
|
+
const mcpConfigSection = `
|
|
242
|
+
# Harmony MCP Server
|
|
243
|
+
[mcp_servers.harmony]
|
|
244
|
+
command = "harmony-mcp"
|
|
245
|
+
args = ["serve"]
|
|
246
|
+
`;
|
|
247
|
+
if (!existsSync(configPath)) {
|
|
248
|
+
ensureDir(dirname(configPath));
|
|
249
|
+
writeFileSync(configPath, mcpConfigSection, "utf-8");
|
|
250
|
+
result.filesCreated.push(configPath);
|
|
251
|
+
} else {
|
|
252
|
+
const existingConfig = readFileSync(configPath, "utf-8");
|
|
253
|
+
if (!existingConfig.includes("[mcp_servers.harmony]")) {
|
|
254
|
+
writeFileSync(configPath, existingConfig + `
|
|
255
|
+
` + mcpConfigSection, "utf-8");
|
|
256
|
+
result.filesCreated.push(configPath);
|
|
257
|
+
} else if (force) {
|
|
258
|
+
const updated = existingConfig.replace(/\[mcp_servers\.harmony\][\s\S]*?(?=\[|$)/, mcpConfigSection.trim() + `
|
|
259
|
+
|
|
260
|
+
`);
|
|
261
|
+
writeFileSync(configPath, updated, "utf-8");
|
|
262
|
+
result.filesCreated.push(configPath);
|
|
263
|
+
} else {
|
|
264
|
+
result.filesSkipped.push(configPath);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return result;
|
|
268
|
+
}
|
|
269
|
+
function initCursor(cwd, force) {
|
|
270
|
+
const result = {
|
|
271
|
+
agent: "cursor",
|
|
272
|
+
filesCreated: [],
|
|
273
|
+
filesSkipped: []
|
|
274
|
+
};
|
|
275
|
+
const mcpConfigPath = join(cwd, ".cursor", "mcp.json");
|
|
276
|
+
const mcpConfig = {
|
|
277
|
+
mcpServers: {
|
|
278
|
+
harmony: {
|
|
279
|
+
command: "harmony-mcp",
|
|
280
|
+
args: ["serve"]
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
const mcpResult = mergeJsonFile(mcpConfigPath, mcpConfig, force);
|
|
285
|
+
if (mcpResult.created || mcpResult.merged) {
|
|
286
|
+
result.filesCreated.push(mcpConfigPath);
|
|
287
|
+
} else if (mcpResult.skipped) {
|
|
288
|
+
result.filesSkipped.push(mcpConfigPath);
|
|
289
|
+
}
|
|
290
|
+
const ruleContent = `---
|
|
291
|
+
description: Harmony card workflow rule
|
|
292
|
+
globs:
|
|
293
|
+
- "**/*"
|
|
294
|
+
alwaysApply: false
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
# Harmony Integration
|
|
298
|
+
|
|
299
|
+
When the user asks you to work on a Harmony card (references like #42, card names, or UUIDs):
|
|
300
|
+
|
|
301
|
+
${HARMONY_WORKFLOW_PROMPT.replace("$ARGUMENTS", "the card reference").replace("Your agent identifier", "cursor").replace("Your agent name", "Cursor AI")}
|
|
302
|
+
`;
|
|
303
|
+
const rulePath = join(cwd, ".cursor", "rules", "harmony.mdc");
|
|
304
|
+
const { created: ruleCreated, skipped: ruleSkipped } = writeFileIfNotExists(rulePath, ruleContent, force);
|
|
305
|
+
if (ruleCreated)
|
|
306
|
+
result.filesCreated.push(rulePath);
|
|
307
|
+
if (ruleSkipped)
|
|
308
|
+
result.filesSkipped.push(rulePath);
|
|
309
|
+
return result;
|
|
310
|
+
}
|
|
311
|
+
function initWindsurf(cwd, force) {
|
|
312
|
+
const result = {
|
|
313
|
+
agent: "windsurf",
|
|
314
|
+
filesCreated: [],
|
|
315
|
+
filesSkipped: []
|
|
316
|
+
};
|
|
317
|
+
const globalMcpPath = join(homedir(), ".codeium", "windsurf", "mcp_config.json");
|
|
318
|
+
const mcpConfig = {
|
|
319
|
+
mcpServers: {
|
|
320
|
+
harmony: {
|
|
321
|
+
command: "harmony-mcp",
|
|
322
|
+
args: ["serve"],
|
|
323
|
+
disabled: false,
|
|
324
|
+
alwaysAllow: []
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
const mcpResult = mergeJsonFile(globalMcpPath, mcpConfig, force);
|
|
329
|
+
if (mcpResult.created || mcpResult.merged) {
|
|
330
|
+
result.filesCreated.push(globalMcpPath);
|
|
331
|
+
} else if (mcpResult.skipped) {
|
|
332
|
+
result.filesSkipped.push(globalMcpPath);
|
|
333
|
+
}
|
|
334
|
+
const ruleContent = `---
|
|
335
|
+
trigger: model_decision
|
|
336
|
+
description: Activate when user asks to work on a Harmony card (references like #42, card names, or task management)
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
# Harmony Card Workflow
|
|
340
|
+
|
|
341
|
+
When working on a Harmony card:
|
|
342
|
+
|
|
343
|
+
${HARMONY_WORKFLOW_PROMPT.replace("$ARGUMENTS", "the card reference").replace("Your agent identifier", "windsurf").replace("Your agent name", "Windsurf AI")}
|
|
344
|
+
`;
|
|
345
|
+
const rulePath = join(cwd, ".windsurf", "rules", "harmony.md");
|
|
346
|
+
const { created: ruleCreated, skipped: ruleSkipped } = writeFileIfNotExists(rulePath, ruleContent, force);
|
|
347
|
+
if (ruleCreated)
|
|
348
|
+
result.filesCreated.push(rulePath);
|
|
349
|
+
if (ruleSkipped)
|
|
350
|
+
result.filesSkipped.push(rulePath);
|
|
351
|
+
return result;
|
|
352
|
+
}
|
|
353
|
+
function initHarmony(options = {}) {
|
|
354
|
+
const cwd = options.cwd || process.cwd();
|
|
355
|
+
const force = options.force || false;
|
|
356
|
+
const agents = options.agents || ["claude", "codex", "cursor", "windsurf"];
|
|
357
|
+
const results = [];
|
|
358
|
+
for (const agent of agents) {
|
|
359
|
+
try {
|
|
360
|
+
switch (agent) {
|
|
361
|
+
case "claude":
|
|
362
|
+
results.push(initClaude(cwd, force));
|
|
363
|
+
break;
|
|
364
|
+
case "codex":
|
|
365
|
+
results.push(initCodex(cwd, force));
|
|
366
|
+
break;
|
|
367
|
+
case "cursor":
|
|
368
|
+
results.push(initCursor(cwd, force));
|
|
369
|
+
break;
|
|
370
|
+
case "windsurf":
|
|
371
|
+
results.push(initWindsurf(cwd, force));
|
|
372
|
+
break;
|
|
373
|
+
default:
|
|
374
|
+
results.push({
|
|
375
|
+
agent,
|
|
376
|
+
filesCreated: [],
|
|
377
|
+
filesSkipped: [],
|
|
378
|
+
error: `Unknown agent: ${agent}`
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
} catch (error) {
|
|
382
|
+
results.push({
|
|
383
|
+
agent,
|
|
384
|
+
filesCreated: [],
|
|
385
|
+
filesSkipped: [],
|
|
386
|
+
error: error instanceof Error ? error.message : String(error)
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return results;
|
|
391
|
+
}
|
|
392
|
+
function detectAgents(cwd = process.cwd()) {
|
|
393
|
+
const detected = [];
|
|
394
|
+
if (existsSync(join(cwd, ".claude")) || existsSync(join(homedir(), ".claude"))) {
|
|
395
|
+
detected.push("claude");
|
|
396
|
+
}
|
|
397
|
+
if (existsSync(join(cwd, "AGENTS.md")) || existsSync(join(homedir(), ".codex"))) {
|
|
398
|
+
detected.push("codex");
|
|
399
|
+
}
|
|
400
|
+
if (existsSync(join(cwd, ".cursor"))) {
|
|
401
|
+
detected.push("cursor");
|
|
402
|
+
}
|
|
403
|
+
if (existsSync(join(cwd, ".windsurf")) || existsSync(join(cwd, ".windsurfrules")) || existsSync(join(homedir(), ".codeium", "windsurf"))) {
|
|
404
|
+
detected.push("windsurf");
|
|
405
|
+
}
|
|
406
|
+
return detected;
|
|
407
|
+
}
|
|
408
|
+
var SUPPORTED_AGENTS = ["claude", "codex", "cursor", "windsurf"];
|
|
409
|
+
export {
|
|
410
|
+
initHarmony,
|
|
411
|
+
detectAgents,
|
|
412
|
+
SUPPORTED_AGENTS
|
|
413
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "harmony-mcp",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "MCP server for Harmony Kanban board - enables
|
|
3
|
+
"version": "1.1.1",
|
|
4
|
+
"description": "MCP server for Harmony Kanban board - enables AI coding agents to manage your boards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -13,28 +13,32 @@
|
|
|
13
13
|
],
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "
|
|
16
|
+
"url": "https://github.com/Way/getharmony/tree/main/packages/mcp-server"
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://gethmy.com",
|
|
19
19
|
"bugs": {
|
|
20
|
-
"url": "https://github.com/
|
|
20
|
+
"url": "https://github.com/Way/getharmony/issues"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"mcp",
|
|
24
24
|
"model-context-protocol",
|
|
25
25
|
"claude",
|
|
26
|
+
"codex",
|
|
27
|
+
"cursor",
|
|
28
|
+
"windsurf",
|
|
26
29
|
"kanban",
|
|
27
30
|
"harmony",
|
|
28
31
|
"ai",
|
|
29
32
|
"llm",
|
|
30
|
-
"project-management"
|
|
33
|
+
"project-management",
|
|
34
|
+
"coding-assistant"
|
|
31
35
|
],
|
|
32
36
|
"engines": {
|
|
33
37
|
"node": ">=18.0.0"
|
|
34
38
|
},
|
|
35
39
|
"scripts": {
|
|
36
|
-
"build": "bun build src/index.ts src/cli.ts --outdir dist --target node",
|
|
37
|
-
"build:bun": "bun build src/index.ts src/http.ts src/cli.ts --outdir dist --target bun",
|
|
40
|
+
"build": "bun build src/index.ts src/cli.ts src/init.ts --outdir dist --target node",
|
|
41
|
+
"build:bun": "bun build src/index.ts src/http.ts src/cli.ts src/init.ts --outdir dist --target bun",
|
|
38
42
|
"dev": "bun --watch src/index.ts",
|
|
39
43
|
"typecheck": "tsc --noEmit",
|
|
40
44
|
"prepublishOnly": "bun run build"
|