@bretwardjames/ghp-mcp 0.1.3 → 0.1.4

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @bretwardjames/ghp-mcp@0.1.2 build /home/bretwardjames/IdeaProjects/ghp/packages/mcp
2
+ > @bretwardjames/ghp-mcp@0.1.3 build /home/bretwardjames/IdeaProjects/ghp/packages/mcp
3
3
  > tsup src/index.ts --format esm --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,7 +8,7 @@ CLI tsup v8.5.1
8
8
  CLI Target: es2022
9
9
  ESM Build start
10
10
  ESM dist/index.js 52.39 KB
11
- ESM ⚡️ Build success in 38ms
11
+ ESM ⚡️ Build success in 54ms
12
12
  DTS Build start
13
- DTS ⚡️ Build success in 1676ms
13
+ DTS ⚡️ Build success in 1637ms
14
14
  DTS dist/index.d.ts 20.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # @bretwardjames/ghp-mcp
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - f0e69f8: Centralize hook firing in core workflows
8
+
9
+ ## @bretwardjames/ghp-core (minor)
10
+
11
+ - Add workflow layer with functions that combine operations + hook firing:
12
+
13
+ - `createIssueWorkflow` - Create issue and fire `issue-created` hook
14
+ - `startIssueWorkflow` - Start working on issue and fire `issue-started` hook
15
+ - `createPRWorkflow` - Create PR and fire `pr-created` hook
16
+ - `createWorktreeWorkflow` - Create worktree and fire `worktree-created` hook
17
+ - `removeWorktreeWorkflow` - Remove worktree and fire `worktree-removed` hook
18
+
19
+ - Add `cwd` option to hook executor for firing hooks from inside worktrees
20
+ - Add tests for all workflow functions (24 tests)
21
+ - Add vitest test runner
22
+
23
+ ## @bretwardjames/ghp-cli (patch)
24
+
25
+ - Hook firing order improved: `worktree-created` fires before `issue-started` in parallel mode
26
+ - Hooks now fire from inside the worktree directory when using `--parallel`
27
+
28
+ ## @bretwardjames/ghp-mcp (patch)
29
+
30
+ - MCP `start` tool now fires `issue-started` hook
31
+ - MCP `add-issue` tool now fires `issue-created` hook
32
+
33
+ ## gh-projects (patch)
34
+
35
+ - VS Code extension now fires `issue-started` hook when starting work
36
+ - VS Code extension now fires `worktree-created` and `issue-started` hooks when creating worktrees
37
+ - Hooks fire from inside the worktree directory for correct file placement
38
+
39
+ - Updated dependencies [62b7941]
40
+ - Updated dependencies [16c3603]
41
+ - Updated dependencies [f0e69f8]
42
+ - Updated dependencies [3fce458]
43
+ - Updated dependencies [c5b3627]
44
+ - Updated dependencies [25143fe]
45
+ - @bretwardjames/ghp-core@0.5.0
46
+
3
47
  ## 0.1.3
4
48
 
5
49
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bretwardjames/ghp-mcp",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "MCP server for ghp (GitHub Projects)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@modelcontextprotocol/sdk": "^1.0.0",
31
31
  "zod": "^3.22.0",
32
- "@bretwardjames/ghp-core": "0.4.0"
32
+ "@bretwardjames/ghp-core": "0.5.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^20.10.0",
@@ -2,6 +2,11 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import * as z from 'zod';
3
3
  import type { ServerContext } from '../server.js';
4
4
  import type { ToolMeta } from '../types.js';
5
+ import {
6
+ executeHooksForEvent,
7
+ hasHooksForEvent,
8
+ type IssueCreatedPayload,
9
+ } from '@bretwardjames/ghp-core';
5
10
 
6
11
  /** Tool metadata for registry */
7
12
  export const meta: ToolMeta = {
@@ -115,6 +120,30 @@ export function register(server: McpServer, context: ServerContext): void {
115
120
  }
116
121
  }
117
122
 
123
+ // Fire issue-created hook
124
+ if (hasHooksForEvent('issue-created')) {
125
+ const payload: IssueCreatedPayload = {
126
+ repo: `${repo.owner}/${repo.name}`,
127
+ issue: {
128
+ number: result.number,
129
+ title,
130
+ body: body || '',
131
+ url: issueUrl,
132
+ },
133
+ };
134
+
135
+ const hookResults = await executeHooksForEvent('issue-created', payload);
136
+ const successCount = hookResults.filter(r => r.success).length;
137
+ const failCount = hookResults.length - successCount;
138
+
139
+ if (hookResults.length > 0) {
140
+ message += `\n\nHooks: ${successCount} succeeded`;
141
+ if (failCount > 0) {
142
+ message += `, ${failCount} failed`;
143
+ }
144
+ }
145
+ }
146
+
118
147
  return {
119
148
  content: [
120
149
  {
@@ -2,6 +2,12 @@ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import * as z from 'zod';
3
3
  import type { ServerContext } from '../server.js';
4
4
  import type { ToolMeta } from '../types.js';
5
+ import {
6
+ getCurrentBranch,
7
+ executeHooksForEvent,
8
+ hasHooksForEvent,
9
+ type IssueStartedPayload,
10
+ } from '@bretwardjames/ghp-core';
5
11
 
6
12
  /** Tool metadata for registry */
7
13
  export const meta: ToolMeta = {
@@ -129,16 +135,7 @@ export function register(server: McpServer, context: ServerContext): void {
129
135
  inProgressOption.id
130
136
  );
131
137
 
132
- if (success) {
133
- return {
134
- content: [
135
- {
136
- type: 'text',
137
- text: `Started work on issue #${issue} "${item.title}" - status set to "${inProgressOption.name}".${blockingWarning}`,
138
- },
139
- ],
140
- };
141
- } else {
138
+ if (!success) {
142
139
  return {
143
140
  content: [
144
141
  {
@@ -149,6 +146,42 @@ export function register(server: McpServer, context: ServerContext): void {
149
146
  isError: true,
150
147
  };
151
148
  }
149
+
150
+ // Fire issue-started hook
151
+ let hookInfo = '';
152
+ if (hasHooksForEvent('issue-started')) {
153
+ const branch = await getCurrentBranch() || '';
154
+ const payload: IssueStartedPayload = {
155
+ repo: `${repo.owner}/${repo.name}`,
156
+ issue: {
157
+ number: issue,
158
+ title: item.title,
159
+ body: '', // Body not available from ProjectItem
160
+ url: `https://github.com/${repo.owner}/${repo.name}/issues/${issue}`,
161
+ },
162
+ branch,
163
+ };
164
+
165
+ const hookResults = await executeHooksForEvent('issue-started', payload);
166
+ const successCount = hookResults.filter(r => r.success).length;
167
+ const failCount = hookResults.length - successCount;
168
+
169
+ if (hookResults.length > 0) {
170
+ hookInfo = `\n\nHooks: ${successCount} succeeded`;
171
+ if (failCount > 0) {
172
+ hookInfo += `, ${failCount} failed`;
173
+ }
174
+ }
175
+ }
176
+
177
+ return {
178
+ content: [
179
+ {
180
+ type: 'text',
181
+ text: `Started work on issue #${issue} "${item.title}" - status set to "${inProgressOption.name}".${blockingWarning}${hookInfo}`,
182
+ },
183
+ ],
184
+ };
152
185
  } catch (error) {
153
186
  return {
154
187
  content: [