@gethmy/agent 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.
- package/README.md +7 -6
- package/dist/board-helpers.d.ts +31 -0
- package/dist/board-helpers.js +150 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +2 -11761
- package/dist/completion.d.ts +14 -0
- package/dist/completion.js +142 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.js +91 -0
- package/dist/git-pr.d.ts +25 -0
- package/dist/git-pr.js +305 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +169 -11730
- package/dist/log.d.ts +10 -0
- package/dist/log.js +35 -0
- package/dist/merge-monitor.d.ts +23 -0
- package/dist/merge-monitor.js +167 -0
- package/dist/pm.d.ts +14 -0
- package/dist/pm.js +63 -0
- package/dist/pool.d.ts +40 -0
- package/dist/pool.js +157 -0
- package/dist/progress-tracker.d.ts +64 -0
- package/dist/progress-tracker.js +361 -0
- package/dist/prompt.d.ts +5 -0
- package/dist/prompt.js +40 -0
- package/dist/queue.d.ts +37 -0
- package/dist/queue.js +96 -0
- package/dist/reconcile.d.ts +21 -0
- package/dist/reconcile.js +114 -0
- package/dist/review-completion.d.ts +31 -0
- package/dist/review-completion.js +253 -0
- package/dist/review-knowledge.d.ts +14 -0
- package/dist/review-knowledge.js +89 -0
- package/dist/review-prompt.d.ts +12 -0
- package/dist/review-prompt.js +103 -0
- package/dist/review-worker.d.ts +46 -0
- package/dist/review-worker.js +437 -0
- package/dist/review-worktree.d.ts +12 -0
- package/dist/review-worktree.js +83 -0
- package/dist/stream-parser.d.ts +31 -0
- package/dist/stream-parser.js +95 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.js +56 -0
- package/dist/verification.d.ts +16 -0
- package/dist/verification.js +251 -0
- package/dist/watcher.d.ts +27 -0
- package/dist/watcher.js +74 -0
- package/dist/worker.d.ts +43 -0
- package/dist/worker.js +327 -0
- package/dist/worktree.d.ts +13 -0
- package/dist/worktree.js +115 -0
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -4,19 +4,20 @@ Push-based agent daemon for [Harmony](https://gethmy.com). Watches board assignm
|
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
|
-
- [Bun](https://bun.sh) >= 1.0
|
|
8
|
-
- [Claude
|
|
7
|
+
- [Node.js](https://nodejs.org) >= 20 or [Bun](https://bun.sh) >= 1.0
|
|
8
|
+
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) CLI installed
|
|
9
9
|
- Git
|
|
10
10
|
- A [Harmony](https://gethmy.com) account with an API key
|
|
11
|
+
- [@gethmy/mcp](https://www.npmjs.com/package/@gethmy/mcp) configured (`npx @gethmy/mcp setup`)
|
|
11
12
|
|
|
12
13
|
## Installation
|
|
13
14
|
|
|
14
15
|
```bash
|
|
15
|
-
# Run directly
|
|
16
|
-
|
|
16
|
+
# Run directly (works with any package manager)
|
|
17
|
+
npx @gethmy/agent
|
|
17
18
|
|
|
18
19
|
# Or install globally
|
|
19
|
-
|
|
20
|
+
npm install -g @gethmy/agent
|
|
20
21
|
harmony-agent
|
|
21
22
|
```
|
|
22
23
|
|
|
@@ -53,7 +54,7 @@ npx @gethmy/mcp setup
|
|
|
53
54
|
Run from your git repository root:
|
|
54
55
|
|
|
55
56
|
```bash
|
|
56
|
-
|
|
57
|
+
npx @gethmy/agent
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
The daemon will:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { HarmonyApiClient } from "@gethmy/mcp/src/api-client.js";
|
|
2
|
+
import type { Card, Label } from "@harmony/shared";
|
|
3
|
+
/**
|
|
4
|
+
* Build a label lookup map from board-level label definitions.
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildLabelMap(boardLabels: Label[]): Map<string, Label>;
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a card's `labelIds` to full Label objects using a label map.
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveCardLabels(card: Card, labelMap: Map<string, Label>): Label[];
|
|
11
|
+
/**
|
|
12
|
+
* Check if a card has a label by name (case-insensitive).
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasLabel(cardLabels: Label[], labelName: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Move a card to a column by name. Fetches the board to resolve column ID.
|
|
17
|
+
*/
|
|
18
|
+
export declare function moveCardToColumn(client: HarmonyApiClient, card: Card, targetColumnName: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Find a label by name (case-insensitive) or create it if missing.
|
|
21
|
+
*/
|
|
22
|
+
export declare function findOrCreateLabel(client: HarmonyApiClient, projectId: string, labelName: string, color?: string): Promise<string | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Add a label to a card by name, creating the label if it doesn't exist.
|
|
25
|
+
*/
|
|
26
|
+
export declare function addLabelByName(client: HarmonyApiClient, card: Card, labelName: string, color?: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Move a card to a column and add a label in one pass, fetching the board only once.
|
|
29
|
+
* Returns true if the move succeeded, false otherwise.
|
|
30
|
+
*/
|
|
31
|
+
export declare function moveCardAndAddLabel(client: HarmonyApiClient, card: Card, targetColumnName: string, labelName: string, labelColor?: string): Promise<boolean>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { log } from "./log.js";
|
|
2
|
+
const TAG = "board";
|
|
3
|
+
/**
|
|
4
|
+
* Build a label lookup map from board-level label definitions.
|
|
5
|
+
*/
|
|
6
|
+
export function buildLabelMap(boardLabels) {
|
|
7
|
+
const map = new Map();
|
|
8
|
+
for (const label of boardLabels) {
|
|
9
|
+
map.set(label.id, label);
|
|
10
|
+
}
|
|
11
|
+
return map;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a card's `labelIds` to full Label objects using a label map.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveCardLabels(card, labelMap) {
|
|
17
|
+
const ids = card.labelIds ?? [];
|
|
18
|
+
return ids
|
|
19
|
+
.map((id) => labelMap.get(id))
|
|
20
|
+
.filter((l) => l !== undefined);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Check if a card has a label by name (case-insensitive).
|
|
24
|
+
*/
|
|
25
|
+
export function hasLabel(cardLabels, labelName) {
|
|
26
|
+
return cardLabels.some((l) => l.name.toLowerCase() === labelName.toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Move a card to a column by name. Fetches the board to resolve column ID.
|
|
30
|
+
*/
|
|
31
|
+
export async function moveCardToColumn(client, card, targetColumnName) {
|
|
32
|
+
try {
|
|
33
|
+
const board = await client.getBoard(card.project_id);
|
|
34
|
+
const targetColumn = board.columns.find((c) => c.name.toLowerCase() === targetColumnName.toLowerCase());
|
|
35
|
+
if (!targetColumn) {
|
|
36
|
+
log.warn(TAG, `Column "${targetColumnName}" not found, skipping move`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (card.column_id === targetColumn.id) {
|
|
40
|
+
log.debug(TAG, `Card already in "${targetColumnName}"`);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
await client.moveCard(card.id, targetColumn.id);
|
|
44
|
+
log.info(TAG, `Moved #${card.short_id} to "${targetColumnName}"`);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
log.error(TAG, `Failed to move card: ${err instanceof Error ? err.message : err}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Find a label by name (case-insensitive) or create it if missing.
|
|
52
|
+
*/
|
|
53
|
+
export async function findOrCreateLabel(client, projectId, labelName, color = "#22c55e") {
|
|
54
|
+
try {
|
|
55
|
+
const board = await client.getBoard(projectId);
|
|
56
|
+
const labels = board.labels ?? [];
|
|
57
|
+
const existing = labels.find((l) => l.name.toLowerCase() === labelName.toLowerCase());
|
|
58
|
+
if (existing)
|
|
59
|
+
return existing.id;
|
|
60
|
+
const result = await client.createLabel(projectId, {
|
|
61
|
+
name: labelName,
|
|
62
|
+
color,
|
|
63
|
+
});
|
|
64
|
+
const labelId = result?.label?.id;
|
|
65
|
+
if (labelId) {
|
|
66
|
+
log.info(TAG, `Created label "${labelName}"`);
|
|
67
|
+
return labelId;
|
|
68
|
+
}
|
|
69
|
+
log.warn(TAG, `createLabel succeeded but returned no id`);
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
log.error(TAG, `Failed to find/create label "${labelName}": ${err instanceof Error ? err.message : err}`);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Add a label to a card by name, creating the label if it doesn't exist.
|
|
79
|
+
*/
|
|
80
|
+
export async function addLabelByName(client, card, labelName, color) {
|
|
81
|
+
const labelId = await findOrCreateLabel(client, card.project_id, labelName, color);
|
|
82
|
+
if (!labelId)
|
|
83
|
+
return;
|
|
84
|
+
try {
|
|
85
|
+
await client.addLabelToCard(card.id, labelId);
|
|
86
|
+
log.info(TAG, `Added label "${labelName}" to #${card.short_id}`);
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
log.error(TAG, `Failed to add label to card: ${err instanceof Error ? err.message : err}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Move a card to a column and add a label in one pass, fetching the board only once.
|
|
94
|
+
* Returns true if the move succeeded, false otherwise.
|
|
95
|
+
*/
|
|
96
|
+
export async function moveCardAndAddLabel(client, card, targetColumnName, labelName, labelColor = "#8b5cf6") {
|
|
97
|
+
let moved = false;
|
|
98
|
+
try {
|
|
99
|
+
const board = await client.getBoard(card.project_id);
|
|
100
|
+
const columns = board.columns;
|
|
101
|
+
const labels = board.labels ?? [];
|
|
102
|
+
// Move card
|
|
103
|
+
const targetColumn = columns.find((c) => c.name.toLowerCase() === targetColumnName.toLowerCase());
|
|
104
|
+
if (!targetColumn) {
|
|
105
|
+
log.warn(TAG, `Column "${targetColumnName}" not found on board (available: ${columns.map((c) => c.name).join(", ")})`);
|
|
106
|
+
}
|
|
107
|
+
else if (card.column_id === targetColumn.id) {
|
|
108
|
+
log.debug(TAG, `Card #${card.short_id} already in "${targetColumnName}"`);
|
|
109
|
+
moved = true;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
try {
|
|
113
|
+
await client.moveCard(card.id, targetColumn.id);
|
|
114
|
+
log.info(TAG, `Moved #${card.short_id} to "${targetColumnName}"`);
|
|
115
|
+
moved = true;
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
log.error(TAG, `Failed to move #${card.short_id} to "${targetColumnName}": ${err instanceof Error ? err.message : err}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Resolve label ID (find or create)
|
|
122
|
+
let labelId;
|
|
123
|
+
const existing = labels.find((l) => l.name.toLowerCase() === labelName.toLowerCase());
|
|
124
|
+
if (existing) {
|
|
125
|
+
labelId = existing.id;
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const result = await client.createLabel(card.project_id, {
|
|
129
|
+
name: labelName,
|
|
130
|
+
color: labelColor,
|
|
131
|
+
});
|
|
132
|
+
labelId = result?.label?.id;
|
|
133
|
+
if (labelId)
|
|
134
|
+
log.info(TAG, `Created label "${labelName}"`);
|
|
135
|
+
}
|
|
136
|
+
if (labelId) {
|
|
137
|
+
try {
|
|
138
|
+
await client.addLabelToCard(card.id, labelId);
|
|
139
|
+
log.info(TAG, `Added label "${labelName}" to #${card.short_id}`);
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
log.error(TAG, `Failed to add label "${labelName}" to #${card.short_id}: ${err instanceof Error ? err.message : err}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (err) {
|
|
147
|
+
log.error(TAG, `Failed to prepare move/label for #${card.short_id}: ${err instanceof Error ? err.message : err}`);
|
|
148
|
+
}
|
|
149
|
+
return moved;
|
|
150
|
+
}
|
package/dist/cli.d.ts
ADDED