@bridge_gpt/mcp-server 0.2.78 → 0.2.79
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 -7
- package/build/decision-page-template.js +155 -20
- package/build/epic-implementer-bin.js +150 -100
- package/build/index.js +623 -438
- package/native/windows/bin/win32-x64/bridge-windows-native.exe +0 -0
- package/native/windows/bin/win32-x64/manifest.json +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -412,7 +412,7 @@ later boot.
|
|
|
412
412
|
"mcpServers": {
|
|
413
413
|
"bridge": {
|
|
414
414
|
"command": "npx",
|
|
415
|
-
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.
|
|
415
|
+
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.79", "serve"],
|
|
416
416
|
"env": {
|
|
417
417
|
"BAPI_BASE_URL": "https://bridgegpt-api.com",
|
|
418
418
|
"BAPI_REPO_NAME": "your-repo",
|
|
@@ -434,7 +434,7 @@ later boot.
|
|
|
434
434
|
"bridge": {
|
|
435
435
|
"type": "stdio",
|
|
436
436
|
"command": "npx",
|
|
437
|
-
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.
|
|
437
|
+
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.79", "serve"],
|
|
438
438
|
"env": {
|
|
439
439
|
"BAPI_BASE_URL": "https://bridgegpt-api.com",
|
|
440
440
|
"BAPI_REPO_NAME": "your-repo",
|
|
@@ -456,7 +456,7 @@ later boot.
|
|
|
456
456
|
"bridge": {
|
|
457
457
|
"type": "stdio",
|
|
458
458
|
"command": "npx",
|
|
459
|
-
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.
|
|
459
|
+
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.79", "serve"],
|
|
460
460
|
"env": {
|
|
461
461
|
"BAPI_BASE_URL": "https://bridgegpt-api.com",
|
|
462
462
|
"BAPI_REPO_NAME": "your-repo",
|
|
@@ -479,7 +479,7 @@ Windsurf only supports global MCP configuration.
|
|
|
479
479
|
"mcpServers": {
|
|
480
480
|
"bridge": {
|
|
481
481
|
"command": "npx",
|
|
482
|
-
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.
|
|
482
|
+
"args": ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.79", "serve"],
|
|
483
483
|
"env": {
|
|
484
484
|
"BAPI_BASE_URL": "https://bridgegpt-api.com",
|
|
485
485
|
"BAPI_REPO_NAME": "your-repo",
|
|
@@ -498,7 +498,7 @@ Windsurf only supports global MCP configuration.
|
|
|
498
498
|
```toml
|
|
499
499
|
[mcp_servers.bridge]
|
|
500
500
|
command = "npx"
|
|
501
|
-
args = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.
|
|
501
|
+
args = ["-y", "--prefer-offline", "@bridge_gpt/mcp-server@0.2.79", "serve"]
|
|
502
502
|
|
|
503
503
|
[mcp_servers.bridge.env]
|
|
504
504
|
BAPI_BASE_URL = "https://bridgegpt-api.com"
|
|
@@ -770,9 +770,9 @@ Useful once in a while.
|
|
|
770
770
|
- **Flags:** None.
|
|
771
771
|
|
|
772
772
|
**8. Ticket Attachments**
|
|
773
|
-
- **What it does:** Uploads, lists, downloads, replaces, and deletes files on a ticket, in Jira or
|
|
773
|
+
- **What it does:** Uploads, lists, downloads, replaces, and deletes files on a ticket, in Jira, local, or Linear mode. Linear files are stored by Bridge and linked from the issue.
|
|
774
774
|
- **When it's useful:** (Refinement | Implementation) When a ticket has design files or logs you need locally, or you want to attach output back to it.
|
|
775
|
-
- **How to use it:** Ask your agent — "Upload, list, download, replace, and delete files on a ticket in Jira or
|
|
775
|
+
- **How to use it:** Ask your agent — "Upload, list, download, replace, and delete files on a ticket in Jira, local, or Linear mode," for example "Download the design mockups attached to BAPI-123 into my docs folder," or "Attach build-log.txt to BAPI-123."
|
|
776
776
|
- **Flags:** Choose the direction (download from the ticket, or upload to it) and, for a download, where the files should land.
|
|
777
777
|
|
|
778
778
|
**9. Estimate Epic**
|
|
@@ -124,7 +124,7 @@ export function generateDecisionPageHtml(data, assets = DEFAULT_ASSETS) {
|
|
|
124
124
|
<head>
|
|
125
125
|
<meta charset="UTF-8">
|
|
126
126
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
127
|
-
<title>${isFinish ? `${escapeHtml(ticket_key)} finish
|
|
127
|
+
<title>${isFinish ? `${escapeHtml(ticket_key)} finish decisions` : `${escapeHtml(effectiveLabels.title)}: ${escapeHtml(ticket_key)}`}</title>
|
|
128
128
|
${faviconLink}
|
|
129
129
|
<style>
|
|
130
130
|
:root {
|
|
@@ -584,17 +584,23 @@ ${needsForm ? renderScript(data, isPlanning, isFinish) : ""}
|
|
|
584
584
|
// ---------------------------------------------------------------------------
|
|
585
585
|
// Section renderers
|
|
586
586
|
// ---------------------------------------------------------------------------
|
|
587
|
-
// BAPI-1879 — the finish checkpoint's lead: epic
|
|
588
|
-
//
|
|
587
|
+
// BAPI-1879 — the finish checkpoint's lead: the epic first, then the notes (the
|
|
588
|
+
// defaults are suggestions; only a submission decides; the owner merges).
|
|
589
|
+
// BAPI-1888 — the revision and the gap-list fingerprint sit in one collapsed
|
|
590
|
+
// "Technical details" block; the script still carries the revision for submission.
|
|
589
591
|
function renderFinishLead(data) {
|
|
590
592
|
const notes = (data.header_notes ?? [])
|
|
591
593
|
.map((note) => `
|
|
592
594
|
<li data-testid="finish-header-note">${escapeHtml(note)}</li>`)
|
|
593
595
|
.join("");
|
|
594
|
-
|
|
595
|
-
<
|
|
596
|
+
const technical = hasDisplayText(data.technical_details) ? escapeHtml(data.technical_details) : `Page revision: ${escapeHtml(data.page_revision)}.`;
|
|
597
|
+
return ` <h1 data-testid="finish-title">${escapeHtml(data.ticket_key)}: final decisions</h1>${notes ? `
|
|
596
598
|
<ul class="finish-header-notes" data-testid="finish-header-notes">${notes}
|
|
597
|
-
</ul>` : ""}
|
|
599
|
+
</ul>` : ""}
|
|
600
|
+
<details class="finish-technical finish-page-technical" data-testid="finish-page-technical">
|
|
601
|
+
<summary>Technical details</summary>
|
|
602
|
+
<p class="finish-revision" data-testid="finish-revision">${technical}</p>
|
|
603
|
+
</details>`;
|
|
598
604
|
}
|
|
599
605
|
// BAPI-1879 — read-only fixed rules (re-listed entries, the rerun rule, test-only
|
|
600
606
|
// and environment recovery, the serious-gap rule). Not a decision; never submitted.
|
|
@@ -629,8 +635,8 @@ const FINISH_CHECKPOINT_CSS = `
|
|
|
629
635
|
line-height: 24px;
|
|
630
636
|
}
|
|
631
637
|
body.finish-checkpoint .main-content { max-width: 760px; margin: 32px auto; padding: 0 16px; }
|
|
632
|
-
body.finish-checkpoint h1 { font-size:
|
|
633
|
-
body.finish-checkpoint h2 { font-size:
|
|
638
|
+
body.finish-checkpoint h1 { font-size: 28px; line-height: 34px; margin-bottom: 8px; }
|
|
639
|
+
body.finish-checkpoint h2 { font-size: 22px; line-height: 28px; margin: 32px 0 8px; }
|
|
634
640
|
body.finish-checkpoint .card-title { font-size: 18px; line-height: 24px; }
|
|
635
641
|
body.finish-checkpoint .card-section-body, body.finish-checkpoint .radio-option-consequence,
|
|
636
642
|
body.finish-checkpoint .fixed-rule-text, body.finish-checkpoint .finish-header-notes, body.finish-checkpoint .finish-revision {
|
|
@@ -671,6 +677,28 @@ const FINISH_CHECKPOINT_CSS = `
|
|
|
671
677
|
body.finish-checkpoint .radio-option .ai-recommendation { grid-column: 2; }
|
|
672
678
|
body.finish-checkpoint .fixed-rule-title { font-size: 16px; line-height: 24px; font-weight: 600; }
|
|
673
679
|
body.finish-checkpoint .finish-fixed-rules > p { margin-bottom: 12px; }
|
|
680
|
+
body.finish-checkpoint .card-section-body, body.finish-checkpoint .codebase-evidence-body, body.finish-checkpoint .finish-technical-body {
|
|
681
|
+
white-space: pre-line;
|
|
682
|
+
}
|
|
683
|
+
/* BAPI-1888: evidence on a finish page is plain-language prose; identifiers stay monospace in technical details. */
|
|
684
|
+
body.finish-checkpoint .codebase-evidence-body { font-family: inherit; font-size: 14px; line-height: 20px; }
|
|
685
|
+
body.finish-checkpoint .finish-group { margin-top: 8px; }
|
|
686
|
+
body.finish-checkpoint .finish-group-intro { margin: 0 0 16px; font-size: 16px; line-height: 24px; }
|
|
687
|
+
body.finish-checkpoint .finish-technical { margin-top: 16px; font-size: 14px; line-height: 20px; }
|
|
688
|
+
body.finish-checkpoint .finish-technical summary, body.finish-checkpoint .finish-test-inventory summary,
|
|
689
|
+
body.finish-checkpoint .finish-test-file summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
|
|
690
|
+
body.finish-checkpoint .finish-technical-body, body.finish-checkpoint .finish-page-technical .finish-revision {
|
|
691
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
692
|
+
overflow-wrap: anywhere;
|
|
693
|
+
word-break: break-word;
|
|
694
|
+
}
|
|
695
|
+
body.finish-checkpoint .finish-page-technical { margin: 0 0 24px; }
|
|
696
|
+
body.finish-checkpoint .finish-test-inventory { margin-top: 16px; }
|
|
697
|
+
body.finish-checkpoint .finish-test-file { margin: 4px 0 4px 16px; }
|
|
698
|
+
body.finish-checkpoint .finish-test-ids { margin: 4px 0 8px 20px; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
|
|
699
|
+
body.finish-checkpoint .comment-hint { margin: 4px 0 0; font-size: 14px; line-height: 20px; font-weight: 600; color: #a63d28; }
|
|
700
|
+
body.finish-checkpoint input[type="radio"] { accent-color: #c0472f; width: 18px; height: 18px; }
|
|
701
|
+
body.finish-checkpoint input[type="radio"]:checked + label { font-weight: 600; }
|
|
674
702
|
@media (max-width: 768px) {
|
|
675
703
|
body.finish-checkpoint .main-content { margin: 16px auto; padding: 0 12px; }
|
|
676
704
|
body.finish-checkpoint .card { padding: 16px; }
|
|
@@ -885,10 +913,15 @@ function renderForm(data, labels, hasDecisions = true) {
|
|
|
885
913
|
<div id="form-status" class="form-status" role="status" aria-live="polite" data-testid="finish-form-status"></div>`;
|
|
886
914
|
}
|
|
887
915
|
if (hasDecisions && actionable_items.length > 0) {
|
|
888
|
-
|
|
916
|
+
if (isFinishCheckpointPage(data) && data.categories !== undefined && data.categories.length > 0) {
|
|
917
|
+
html += renderFinishGroups(data);
|
|
918
|
+
}
|
|
919
|
+
else {
|
|
920
|
+
html += `
|
|
889
921
|
<h2>${escapeHtml(labels.section_heading)}</h2>`;
|
|
890
|
-
|
|
891
|
-
|
|
922
|
+
for (const item of actionable_items) {
|
|
923
|
+
html += renderDecisionItem(item, isFinishCheckpointPage(data), data.test_inventory);
|
|
924
|
+
}
|
|
892
925
|
}
|
|
893
926
|
}
|
|
894
927
|
html += `
|
|
@@ -908,7 +941,7 @@ function renderForm(data, labels, hasDecisions = true) {
|
|
|
908
941
|
<h2>Output JSON</h2>
|
|
909
942
|
<button type="button" class="btn btn-secondary" data-copy-json-btn data-default-label="Copy JSON">Copy JSON</button>
|
|
910
943
|
</div>
|
|
911
|
-
<p
|
|
944
|
+
<p${isFinishCheckpointPage(data) ? ' data-testid="finish-copy-instruction"' : ""}>${isFinishCheckpointPage(data) ? "Your answers are not recorded yet. Copy the JSON below and paste it back to the agent; the agent records them." : "Copy the JSON below and paste it back to the agent."}</p>
|
|
912
945
|
<pre id="json-output" data-testid="decision-output-json"></pre>
|
|
913
946
|
<div class="copy-area">
|
|
914
947
|
<button type="button" id="copy-btn" class="btn btn-secondary" data-copy-json-btn data-default-label="Copy to Clipboard">Copy to Clipboard</button>
|
|
@@ -916,7 +949,63 @@ function renderForm(data, labels, hasDecisions = true) {
|
|
|
916
949
|
</div>`;
|
|
917
950
|
return html;
|
|
918
951
|
}
|
|
919
|
-
|
|
952
|
+
// BAPI-1888 — finish groups: each non-empty category is an <h2> with its intro,
|
|
953
|
+
// its cards beneath as <h3>. A card whose category matches no group is never
|
|
954
|
+
// dropped: it renders in a trailing "Other decisions" group.
|
|
955
|
+
function renderFinishGroups(data) {
|
|
956
|
+
const categories = data.categories ?? [];
|
|
957
|
+
const known = new Set(categories.map((c) => c.id));
|
|
958
|
+
let html = "";
|
|
959
|
+
const group = (id, heading, intro, items) => {
|
|
960
|
+
if (items.length === 0)
|
|
961
|
+
return;
|
|
962
|
+
const headingId = `finish-group-${escapeHtml(id)}`;
|
|
963
|
+
html += `
|
|
964
|
+
<section class="finish-group" data-testid="finish-group" data-category="${escapeHtml(id)}" aria-labelledby="${headingId}">
|
|
965
|
+
<h2 id="${headingId}" data-testid="finish-group-heading">${escapeHtml(heading)}</h2>
|
|
966
|
+
<p class="finish-group-intro" data-testid="finish-group-intro">${escapeHtml(intro)}</p>`;
|
|
967
|
+
for (const item of items)
|
|
968
|
+
html += renderDecisionItem(item, true, data.test_inventory);
|
|
969
|
+
html += `
|
|
970
|
+
</section>`;
|
|
971
|
+
};
|
|
972
|
+
for (const cat of categories)
|
|
973
|
+
group(cat.id, cat.heading, cat.intro, data.actionable_items.filter((item) => item.category === cat.id));
|
|
974
|
+
group("other", "Other decisions", "Decisions that did not match a group above.", data.actionable_items.filter((item) => item.category === undefined || !known.has(item.category)));
|
|
975
|
+
return html;
|
|
976
|
+
}
|
|
977
|
+
// BAPI-1888 — the focused plan's per-file test lists, collapsed, inside the TESTS card.
|
|
978
|
+
function renderTestInventory(inventory, itemId) {
|
|
979
|
+
if (!inventory || inventory.card_id !== itemId || inventory.files.length === 0)
|
|
980
|
+
return "";
|
|
981
|
+
const files = inventory.files
|
|
982
|
+
.map((f) => {
|
|
983
|
+
if (inventory.mode === "inline") {
|
|
984
|
+
const ids = (f.ids ?? []).map((id) => `
|
|
985
|
+
<li><code>${escapeHtml(id)}</code></li>`).join("");
|
|
986
|
+
return `
|
|
987
|
+
<details class="finish-test-file" data-testid="test-inventory-file">
|
|
988
|
+
<summary><code>${escapeHtml(f.path)}</code> (${(f.ids ?? []).length} test${(f.ids ?? []).length === 1 ? "" : "s"})</summary>
|
|
989
|
+
<ul class="finish-test-ids">${ids}
|
|
990
|
+
</ul>
|
|
991
|
+
</details>`;
|
|
992
|
+
}
|
|
993
|
+
return `
|
|
994
|
+
<li data-testid="test-inventory-file"><code>${escapeHtml(f.path)}</code> (${f.count === null || f.count === undefined ? "count not available" : `${f.count} test${f.count === 1 ? "" : "s"}`})</li>`;
|
|
995
|
+
})
|
|
996
|
+
.join("");
|
|
997
|
+
const body = inventory.mode === "inline"
|
|
998
|
+
? files
|
|
999
|
+
: `
|
|
1000
|
+
<p>The list is too long to show here. Every test is in the private plan file${inventory.plan_file ? `: <code>${escapeHtml(inventory.plan_file)}</code>` : ""}.</p>
|
|
1001
|
+
<ul>${files}
|
|
1002
|
+
</ul>`;
|
|
1003
|
+
return `
|
|
1004
|
+
<details class="finish-test-inventory" data-testid="test-inventory">
|
|
1005
|
+
<summary>Every test in the focused plan</summary>${body}
|
|
1006
|
+
</details>`;
|
|
1007
|
+
}
|
|
1008
|
+
function renderDecisionItem(item, isFinish = false, inventory) {
|
|
920
1009
|
const id = escapeHtml(item.id);
|
|
921
1010
|
const radioName = `radio-${id}`;
|
|
922
1011
|
const textareaId = `comment-${id}`;
|
|
@@ -932,8 +1021,11 @@ function renderDecisionItem(item, isFinish = false) {
|
|
|
932
1021
|
const label = item.options[i];
|
|
933
1022
|
const consequence = item.option_consequences[i] ?? "";
|
|
934
1023
|
const isRecommended = i === item.recommendation_index;
|
|
935
|
-
// BAPI-
|
|
936
|
-
|
|
1024
|
+
// BAPI-1888 — the recommended option is selected on every page, finish pages
|
|
1025
|
+
// included (superseding BAPI-1879's "labelled, never pre-selected"). It is a
|
|
1026
|
+
// suggestion: only a submitted answer records a decision.
|
|
1027
|
+
const checked = isRecommended ? " checked" : "";
|
|
1028
|
+
const commentAttr = isFinish && item.comment_required !== undefined ? ` data-comment-required="${item.comment_required[i] ? "true" : "false"}"` : "";
|
|
937
1029
|
const labelText = escapeHtml(label);
|
|
938
1030
|
const recommendationMarker = isRecommended
|
|
939
1031
|
? isFinish
|
|
@@ -943,7 +1035,7 @@ function renderDecisionItem(item, isFinish = false) {
|
|
|
943
1035
|
optionsHtml += `
|
|
944
1036
|
<div class="radio-option-wrapper" data-testid="option-wrapper" data-option-index="${i}">
|
|
945
1037
|
<div class="radio-option">
|
|
946
|
-
<input type="radio" id="${radioName}-${val}" name="${radioName}" value="${val}"${checked} data-testid="decision-option">
|
|
1038
|
+
<input type="radio" id="${radioName}-${val}" name="${radioName}" value="${val}"${checked}${commentAttr} data-testid="decision-option">
|
|
947
1039
|
<label for="${radioName}-${val}">${labelText}</label>${recommendationMarker}
|
|
948
1040
|
</div>
|
|
949
1041
|
<div class="radio-option-consequence" data-testid="option-consequence">${escapeHtml(consequence)}</div>
|
|
@@ -984,6 +1076,19 @@ function renderDecisionItem(item, isFinish = false) {
|
|
|
984
1076
|
<div class="codebase-evidence-body" data-testid="codebase-evidence-body">${escapeHtml(item.codebase_evidence)}</div>
|
|
985
1077
|
</details>`
|
|
986
1078
|
: "";
|
|
1079
|
+
const hintId = `comment-hint-${id}`;
|
|
1080
|
+
const finishCommentHint = isFinish && item.comment_required !== undefined
|
|
1081
|
+
? `
|
|
1082
|
+
<p class="comment-hint" id="${hintId}" data-testid="comment-required-hint" hidden>This choice needs a comment.</p>`
|
|
1083
|
+
: "";
|
|
1084
|
+
const technicalSection = isFinish && hasDisplayText(item.technical_details)
|
|
1085
|
+
? `
|
|
1086
|
+
<details class="finish-technical" data-testid="technical-details">
|
|
1087
|
+
<summary>Technical details</summary>
|
|
1088
|
+
<div class="finish-technical-body" data-testid="technical-details-body">${escapeHtml(item.technical_details)}</div>
|
|
1089
|
+
</details>`
|
|
1090
|
+
: "";
|
|
1091
|
+
const inventorySection = isFinish ? renderTestInventory(inventory, item.id) : "";
|
|
987
1092
|
return `
|
|
988
1093
|
<section class="card" data-item-id="${id}" data-item-type="decision" data-source="${escapeHtml(item.source ?? "")}" data-labels="${labelsJson}"${optionIdsAttr} data-testid="decision-card" aria-labelledby="${titleId}">
|
|
989
1094
|
<h3 class="card-title" id="${titleId}" data-testid="decision-card-title">${escapeHtml(item.question)}</h3>${originalQuestionSection}${renderRequirementClassification(item, requirementClassLabelId)}
|
|
@@ -1000,8 +1105,8 @@ function renderDecisionItem(item, isFinish = false) {
|
|
|
1000
1105
|
</section>
|
|
1001
1106
|
<div class="comment-area">
|
|
1002
1107
|
<label for="${textareaId}">Comment</label>
|
|
1003
|
-
<textarea id="${textareaId}" name="${textareaId}" placeholder="${isFinish ? "Your reason or evidence reference (required where the card says so)" : "Required for None of these selections..."}" data-testid="decision-comment"></textarea
|
|
1004
|
-
</div>${codebaseEvidenceSection}
|
|
1108
|
+
<textarea id="${textareaId}" name="${textareaId}" placeholder="${isFinish ? "Your reason or evidence reference (required where the card says so)" : "Required for None of these selections..."}"${finishCommentHint ? ` aria-describedby="${hintId}"` : ""} data-testid="decision-comment"></textarea>${finishCommentHint}
|
|
1109
|
+
</div>${codebaseEvidenceSection}${inventorySection}${technicalSection}
|
|
1005
1110
|
</section>`;
|
|
1006
1111
|
}
|
|
1007
1112
|
function renderImprovements(improvements, labels) {
|
|
@@ -1071,7 +1176,27 @@ function renderScript(data, isPlanning = false, isFinish = false) {
|
|
|
1071
1176
|
});
|
|
1072
1177
|
});
|
|
1073
1178
|
});` : `var stanceContainers = [];`}
|
|
1074
|
-
|
|
1179
|
+
${isFinish ? `
|
|
1180
|
+
// BAPI-1888 — required-comment hints come from each option's structured
|
|
1181
|
+
// data-comment-required flag, set from the initially checked radio and on change.
|
|
1182
|
+
function updateCommentHint(card) {
|
|
1183
|
+
var selected = card.querySelector('input[type="radio"]:checked');
|
|
1184
|
+
var hint = card.querySelector('[data-testid="comment-required-hint"]');
|
|
1185
|
+
var textarea = card.querySelector("textarea");
|
|
1186
|
+
var needs = !!selected && selected.getAttribute("data-comment-required") === "true";
|
|
1187
|
+
if (hint) hint.hidden = !needs;
|
|
1188
|
+
if (textarea) {
|
|
1189
|
+
if (needs) textarea.setAttribute("aria-required", "true");
|
|
1190
|
+
else textarea.removeAttribute("aria-required");
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
document.querySelectorAll(".card[data-item-id]").forEach(function(card) {
|
|
1194
|
+
updateCommentHint(card);
|
|
1195
|
+
card.querySelectorAll('input[type="radio"]').forEach(function(radio) {
|
|
1196
|
+
radio.addEventListener("change", function() { updateCommentHint(card); });
|
|
1197
|
+
});
|
|
1198
|
+
});
|
|
1199
|
+
` : ""}
|
|
1075
1200
|
submitBtn.addEventListener("click", function() {
|
|
1076
1201
|
var cards = document.querySelectorAll(".card[data-item-id]");
|
|
1077
1202
|
var valid = true;
|
|
@@ -1102,7 +1227,17 @@ function renderScript(data, isPlanning = false, isFinish = false) {
|
|
|
1102
1227
|
msg.textContent = "A comment is required when selecting None of these.";
|
|
1103
1228
|
textarea.parentNode.appendChild(msg);
|
|
1104
1229
|
valid = false;
|
|
1105
|
-
}
|
|
1230
|
+
}${isFinish ? `
|
|
1231
|
+
else if (selected.getAttribute("data-comment-required") === "true" && !textarea.value.trim()) {
|
|
1232
|
+
textarea.classList.add("validation-error");
|
|
1233
|
+
var needMsg = document.createElement("div");
|
|
1234
|
+
needMsg.className = "validation-msg";
|
|
1235
|
+
needMsg.id = "comment-error-" + itemId;
|
|
1236
|
+
needMsg.textContent = "This choice needs a comment.";
|
|
1237
|
+
textarea.setAttribute("aria-describedby", "comment-hint-" + itemId + " comment-error-" + itemId);
|
|
1238
|
+
textarea.parentNode.appendChild(needMsg);
|
|
1239
|
+
valid = false;
|
|
1240
|
+
}` : ""}
|
|
1106
1241
|
});
|
|
1107
1242
|
|
|
1108
1243
|
// Validate stance feedback: ask/disagree requires a comment.
|