internaltool-mcp 1.6.3 → 1.6.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.
- package/index.js +72 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -861,6 +861,39 @@ Use this when a developer says "start task", "brief me on", or "what do I need t
|
|
|
861
861
|
const subtasksTotal = subtasks.length
|
|
862
862
|
|
|
863
863
|
// ── Preview: show the full plan before touching anything ──
|
|
864
|
+
const approvalState = task.approval?.state || 'none'
|
|
865
|
+
const approvalBlocks = ['backlog', 'todo'].includes(task.column) && approvalState !== 'approved'
|
|
866
|
+
|
|
867
|
+
// Build the next-step roadmap so developer knows exactly what comes after reading the plan
|
|
868
|
+
let workflowRoadmap
|
|
869
|
+
if (!hasReadme) {
|
|
870
|
+
workflowRoadmap = [
|
|
871
|
+
`1. Write the implementation plan — click "Start writing" on the Plan tab`,
|
|
872
|
+
`2. Call submit_task_for_approval to send it for review`,
|
|
873
|
+
`3. After approval, call create_branch — the task moves to In progress automatically`,
|
|
874
|
+
]
|
|
875
|
+
} else if (approvalState === 'none') {
|
|
876
|
+
workflowRoadmap = [
|
|
877
|
+
`1. ✅ Implementation plan is written — read it above`,
|
|
878
|
+
`2. Call submit_task_for_approval with taskId="${taskId}" to send it for review`,
|
|
879
|
+
`3. After approval, call create_branch — the task moves to In progress automatically`,
|
|
880
|
+
]
|
|
881
|
+
} else if (approvalState === 'pending') {
|
|
882
|
+
workflowRoadmap = [
|
|
883
|
+
`1. ✅ Implementation plan written`,
|
|
884
|
+
`2. ⏳ Waiting for reviewer approval`,
|
|
885
|
+
`3. After approval, call create_branch — the task moves to In progress automatically`,
|
|
886
|
+
]
|
|
887
|
+
} else {
|
|
888
|
+
// approved
|
|
889
|
+
workflowRoadmap = [
|
|
890
|
+
`1. ✅ Implementation plan written and approved`,
|
|
891
|
+
`2. Call create_branch with taskId="${taskId}" — moves task to In progress automatically`,
|
|
892
|
+
`3. Code → commit (use commit_helper) → push`,
|
|
893
|
+
`4. Call raise_pr — task moves to In review automatically`,
|
|
894
|
+
]
|
|
895
|
+
}
|
|
896
|
+
|
|
864
897
|
if (!confirmed) {
|
|
865
898
|
return text({
|
|
866
899
|
brief: {
|
|
@@ -868,24 +901,28 @@ Use this when a developer says "start task", "brief me on", or "what do I need t
|
|
|
868
901
|
title: task.title,
|
|
869
902
|
priority: task.priority,
|
|
870
903
|
description: task.description || '(no description)',
|
|
871
|
-
// The implementation plan — Claude must read and present this to the developer
|
|
872
904
|
implementationPlan: hasReadme
|
|
873
905
|
? task.readmeMarkdown
|
|
874
|
-
: '⚠️ No implementation plan
|
|
906
|
+
: '⚠️ No implementation plan found. Write one in the Plan tab before starting work.',
|
|
875
907
|
subtasks: subtasksTotal > 0
|
|
876
908
|
? { items: subtasks, progress: `${subtasksDone}/${subtasksTotal} done` }
|
|
877
909
|
: null,
|
|
878
|
-
approvalState
|
|
910
|
+
approvalState,
|
|
879
911
|
},
|
|
880
912
|
meta: {
|
|
881
913
|
currentColumn: task.column,
|
|
882
|
-
willMoveTo: 'in_progress',
|
|
883
914
|
suggestedBranch,
|
|
884
915
|
},
|
|
916
|
+
workflowRoadmap,
|
|
917
|
+
approvalWarning: approvalBlocks
|
|
918
|
+
? approvalState === 'pending'
|
|
919
|
+
? `⏳ Plan is submitted and awaiting approval — you cannot create a branch until it is approved.`
|
|
920
|
+
: `⚠️ Plan is not yet submitted for approval. Submit it first, then create the branch.`
|
|
921
|
+
: null,
|
|
885
922
|
requiresConfirmation: true,
|
|
886
|
-
message:
|
|
887
|
-
? `Read the
|
|
888
|
-
:
|
|
923
|
+
message: approvalBlocks
|
|
924
|
+
? `Read the plan above, then follow workflowRoadmap — approval is required before you can branch and start coding.`
|
|
925
|
+
: `Read the implementation plan above carefully, then call kickoff_task again with confirmed=true.`,
|
|
889
926
|
})
|
|
890
927
|
}
|
|
891
928
|
|
|
@@ -1443,6 +1480,34 @@ If you have uncommitted tracked changes, it will tell you exactly what to do bef
|
|
|
1443
1480
|
if (!taskRes?.success) return errorText('Task not found')
|
|
1444
1481
|
const task = taskRes.data.task
|
|
1445
1482
|
|
|
1483
|
+
// ── Approval gate check ───────────────────────────────────────────────────
|
|
1484
|
+
// The server blocks non-admins from moving todo → in_progress without approval.
|
|
1485
|
+
// Detect this early and guide the developer instead of failing silently after branch creation.
|
|
1486
|
+
const approvalState = task.approval?.state || 'none'
|
|
1487
|
+
const PLANNING_COLS = ['backlog', 'todo']
|
|
1488
|
+
const needsApproval = PLANNING_COLS.includes(task.column) && approvalState !== 'approved'
|
|
1489
|
+
if (needsApproval && !confirmed) {
|
|
1490
|
+
const isFix2 = /\b(fix|bug|hotfix|patch)\b/i.test(task.title + ' ' + (task.description || ''))
|
|
1491
|
+
const slug2 = task.title.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '').slice(0, 35)
|
|
1492
|
+
const previewBranch = `${isFix2 ? 'fix' : 'feature'}/${task.key.toLowerCase()}-${slug2}`
|
|
1493
|
+
return text({
|
|
1494
|
+
blocked: true,
|
|
1495
|
+
reason: 'approval_required',
|
|
1496
|
+
task: { key: task.key, title: task.title, column: task.column, approvalState },
|
|
1497
|
+
message: `The task's implementation plan (README) must be approved before creating a branch and moving to In progress.`,
|
|
1498
|
+
approvalStatus: approvalState === 'pending'
|
|
1499
|
+
? `Plan is already submitted and waiting for reviewer approval. Once approved, call create_branch again.`
|
|
1500
|
+
: `Plan has not been submitted for review yet.`,
|
|
1501
|
+
nextSteps: approvalState === 'pending'
|
|
1502
|
+
? [`Wait for the reviewer to approve, then call create_branch with taskId="${taskId}"`]
|
|
1503
|
+
: [
|
|
1504
|
+
`1. Make sure the README / implementation plan is written on the task (use update_task with readmeMarkdown if needed)`,
|
|
1505
|
+
`2. Call submit_task_for_approval with taskId="${taskId}" and the reviewerId of your project lead`,
|
|
1506
|
+
`3. Once approved, call create_branch again — it will create "${previewBranch}" and move the task to In progress automatically`,
|
|
1507
|
+
],
|
|
1508
|
+
})
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1446
1511
|
const isFix = /\b(fix|bug|hotfix|patch)\b/i.test(task.title + ' ' + (task.description || ''))
|
|
1447
1512
|
const prefix = isFix ? 'fix' : 'feature'
|
|
1448
1513
|
const slug = task.title
|
package/package.json
CHANGED