internaltool-mcp 1.5.5 → 1.5.7

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 (2) hide show
  1. package/index.js +41 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -962,18 +962,43 @@ Use this when returning to a task after a break, or when Claude needs the full p
962
962
 
963
963
  let coachingPrompt = null
964
964
  if (task.column === 'in_progress' && !task.github?.headBranch) {
965
- const stateHint = localGitState?.state === 'modified'
966
- ? ` Your working tree has ${localGitState.modifiedFiles.length} modified file(s) — stash or commit them first, then call create_branch.`
967
- : ` Your working tree is ${localGitState?.state || 'unknown'} — ready to call create_branch.`
968
- coachingPrompt = `No branch yet.${stateHint}`
965
+ let stateHint
966
+ if (localGitState?.state === 'modified') {
967
+ const files = localGitState.modifiedFiles.join(', ')
968
+ stateHint = [
969
+ `You have ${localGitState.modifiedFiles.length} modified file(s): ${files}`,
970
+ `Before creating the task branch, handle these changes — pick one:`,
971
+ ` Option A — Stash (recommended, keeps changes safe):`,
972
+ ` git stash push -m "wip: before starting ${task.key}"`,
973
+ ` Option B — Commit as WIP:`,
974
+ ` git add . && git commit -m "chore: wip before ${task.key}"`,
975
+ `Then call create_branch — it will detect the clean state automatically.`,
976
+ ].join('\n')
977
+ } else {
978
+ stateHint = `Your working tree is ${localGitState?.state || 'unknown'} — ready to call create_branch.`
979
+ }
980
+ coachingPrompt = `No branch yet.\n${stateHint}`
969
981
  } else if (task.column === 'in_progress' && task.github?.headBranch) {
970
982
  const onBranch = localGitState?.onTaskBranch
971
- const branchHint = onBranch === true
972
- ? ` (you are already on it)`
973
- : onBranch === false
974
- ? ` (you are on "${localGitState?.currentBranch}" — run: git checkout ${task.github.headBranch})`
975
- : ''
976
- coachingPrompt = `Branch: ${task.github.headBranch}${branchHint}. When commits are pushed, use raise_pr to open a PR.`
983
+ if (onBranch === false) {
984
+ const lines = [
985
+ `Branch exists: ${task.github.headBranch}`,
986
+ `You are currently on "${localGitState?.currentBranch}".`,
987
+ ]
988
+ if (localGitState?.state === 'modified') {
989
+ lines.push(`You have ${localGitState.modifiedFiles.length} modified file(s): ${localGitState.modifiedFiles.join(', ')}`)
990
+ lines.push(`Handle them before switching:`)
991
+ lines.push(` git stash push -m "wip: switching to ${task.github.headBranch}"`)
992
+ lines.push(` — or — git add . && git commit -m "chore: wip"`)
993
+ lines.push(`Then switch: git fetch origin && git checkout ${task.github.headBranch}`)
994
+ } else {
995
+ lines.push(`Switch to the task branch: git fetch origin && git checkout ${task.github.headBranch}`)
996
+ }
997
+ lines.push(`When commits are pushed, use raise_pr.`)
998
+ coachingPrompt = lines.join('\n')
999
+ } else {
1000
+ coachingPrompt = `Branch: ${task.github.headBranch}${onBranch === true ? ' (you are already on it)' : ''}. When commits are pushed, use raise_pr to open a PR.`
1001
+ }
977
1002
  } else if (task.column === 'in_review') {
978
1003
  coachingPrompt = `PR #${task.github?.prNumber} is open. Waiting for reviewer feedback.`
979
1004
  } else if (task.parkNote?.parkedAt) {
@@ -1117,12 +1142,17 @@ If you have uncommitted tracked changes, it will tell you exactly what to do bef
1117
1142
  })
1118
1143
  }
1119
1144
 
1120
- // Step 3 — create branch on GitHub
1145
+ // Step 3 — create branch on GitHub, then link it to the task
1121
1146
  const localState = gitState?.localState || 'unknown'
1122
1147
  try {
1123
1148
  const res = await api.post(`/api/projects/${projectId}/github/branches`, { branchName, fromRef })
1124
1149
  if (!res?.success) return errorText(res?.message || 'Could not create branch')
1125
1150
 
1151
+ // Link the branch name back to the task so get_task_context / list_my_tasks reflect it immediately
1152
+ try {
1153
+ await api.patch(`/api/tasks/${taskId}/github/branch`, { headBranch: branchName })
1154
+ } catch { /* non-fatal — branch was still created on GitHub */ }
1155
+
1126
1156
  const checkoutSteps = [
1127
1157
  'git fetch origin',
1128
1158
  `git checkout ${branchName}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "internaltool-mcp",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "MCP server for InternalTool — connect AI assistants (Claude Code, Cursor) to your project and task management platform",
5
5
  "type": "module",
6
6
  "main": "index.js",