@skillre/dsh-plugin-work-dashboard 0.12.0 → 0.13.0
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.en.md +3 -3
- package/README.md +8 -15
- package/docs/POC-3.2-/350/277/233/345/261/225/345/245/221/347/272/246.md +21 -0
- package/docs/Super-Agent-3.2-/350/201/224/350/260/203/346/211/213/345/206/214.md +38 -0
- package/lib/client/css/detail.d.ts +1 -1
- package/lib/client/css/detail.js +4 -0
- package/lib/client/text.js +6 -10
- package/lib/client.js +72 -36
- package/lib/form.js +118 -35
- package/lib/gap.d.ts +2 -2
- package/lib/gap.js +21 -14
- package/lib/index.js +12 -13
- package/lib/progress.d.ts +8 -0
- package/lib/progress.js +20 -0
- package/lib/report-contract.d.ts +315 -0
- package/lib/report-contract.js +119 -0
- package/lib/report-form.d.ts +3 -0
- package/lib/report-form.js +41 -0
- package/lib/report-import.d.ts +9 -0
- package/lib/report-import.js +118 -0
- package/lib/report-page.d.ts +60 -0
- package/lib/report-page.js +3424 -0
- package/lib/report-style.d.ts +17 -0
- package/lib/report-style.js +459 -0
- package/lib/store.js +8 -4
- package/lib/timeline.js +7 -6
- package/lib/types.d.ts +38 -2
- package/package.json +1 -1
- package/skills/poc-export/SKILL.md +10 -125
- package/skills/poc-export/scripts/export-form.mjs +15 -69
- package/skills/poc-ledger/SKILL.md +14 -25
- package/skills/poc-submit/SKILL.md +13 -278
- package/skills/poc-submit/prepare-return.mjs +48 -0
package/lib/form.js
CHANGED
|
@@ -269,7 +269,11 @@ export function blankProgress(existingCount) {
|
|
|
269
269
|
criteriaIds: [],
|
|
270
270
|
actual: '',
|
|
271
271
|
completion: '',
|
|
272
|
-
evidence
|
|
272
|
+
// One empty row, so the required evidence field has an obvious place to type
|
|
273
|
+
// instead of presenting only a "+ 加一条证据" button. `progressIsEmpty` still
|
|
274
|
+
// treats an all-blank list as "the colleague recorded nothing", so this does
|
|
275
|
+
// not by itself make a round look filled in.
|
|
276
|
+
evidence: [{ title: '', link: '', type: '' }],
|
|
273
277
|
customer: { synced_with: '', feedback: '', recognition: '' },
|
|
274
278
|
gate3_1: '',
|
|
275
279
|
gate3_2: '',
|
|
@@ -471,7 +475,10 @@ function orNull(value) {
|
|
|
471
475
|
* them from.
|
|
472
476
|
*/
|
|
473
477
|
const CHANGE_SCOPE = {
|
|
474
|
-
new
|
|
478
|
+
// `progress` is listed for `new` because the new-project form offers an
|
|
479
|
+
// OPTIONAL first round. Optional means "sent only if the colleague filled it",
|
|
480
|
+
// which `progressIsEmpty` already enforces; it is not a required field.
|
|
481
|
+
new: ['identity', 'gate0', 'progress'],
|
|
475
482
|
// `supplement` resolves per project against its stage, so the union is allowed
|
|
476
483
|
// here and narrowed by `resolveSections` at emit time.
|
|
477
484
|
supplement: ['identity', 'gate0', 'plan', 'gate12', 'progress', 'outcome'],
|
|
@@ -1147,6 +1154,15 @@ body{
|
|
|
1147
1154
|
border-radius:8px;background:var(--surface);border:1px solid var(--border);
|
|
1148
1155
|
}
|
|
1149
1156
|
.row-card-head{display:flex;align-items:center;gap:8px}
|
|
1157
|
+
/* An evidence row is [title][link][delete] on one line. On a phone that leaves
|
|
1158
|
+
* the title input about 60px wide, which truncates the placeholder mid-word, so
|
|
1159
|
+
* the row stacks and the delete button moves to its own shorter line. */
|
|
1160
|
+
@media(max-width:560px){
|
|
1161
|
+
.row-card-head{flex-wrap:wrap}
|
|
1162
|
+
.row-card-head>.input:first-child{flex:1 1 100%}
|
|
1163
|
+
.row-card-head>.input{flex:1 1 calc(100% - 64px)}
|
|
1164
|
+
.row-card-head>.btn-remove{margin-left:auto}
|
|
1165
|
+
}
|
|
1150
1166
|
.row-card-id{
|
|
1151
1167
|
flex:none;font-family:var(--mono);font-size:9px;line-height:13px;
|
|
1152
1168
|
color:var(--text-3);background:var(--inset);border:1px solid var(--border);
|
|
@@ -1174,6 +1190,18 @@ body{
|
|
|
1174
1190
|
.textarea{min-height:60px;resize:vertical}
|
|
1175
1191
|
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px}
|
|
1176
1192
|
@media(max-width:720px){.grid-2{grid-template-columns:minmax(0,1fr)}}
|
|
1193
|
+
/* Three-up row for the round's three compulsory facts: date, type, what moved.
|
|
1194
|
+
* They belong on one line so the progress receipt reads as one screen. */
|
|
1195
|
+
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px 14px}
|
|
1196
|
+
@media(max-width:900px){.grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}}
|
|
1197
|
+
@media(max-width:560px){.grid-3{grid-template-columns:minmax(0,1fr)}}
|
|
1198
|
+
/* An optional block: collapsed by default, visually lighter than a subject
|
|
1199
|
+
* section, so it cannot be mistaken for something that must be filled. */
|
|
1200
|
+
.optional-block{margin-top:14px}
|
|
1201
|
+
.optional-block>summary{font-weight:650;color:var(--text-2)}
|
|
1202
|
+
.extras{margin-top:12px}
|
|
1203
|
+
.extras>summary{font-size:10.5px}
|
|
1204
|
+
.extras[open]>summary{margin-bottom:8px}
|
|
1177
1205
|
.field.has-error .input,.field.has-error .textarea,.field.has-error .select{border-color:var(--red)}
|
|
1178
1206
|
.field-error{color:var(--red);font-size:10px;display:none}
|
|
1179
1207
|
.field.has-error .field-error{display:block}
|
|
@@ -1567,7 +1595,17 @@ const FORM_SCRIPT = `
|
|
|
1567
1595
|
input = '<textarea class="textarea' + (locked ? ' is-locked' : '') + '"' + pathAttr + lockAttr + '>' + escapeHtml(value) + '</textarea>';
|
|
1568
1596
|
} else if (opts.enum) {
|
|
1569
1597
|
input = '<select class="select' + (locked ? ' is-locked' : '') + '"' + pathAttr + lockAttr + '>';
|
|
1570
|
-
|
|
1598
|
+
// ALWAYS offer an explicit "not answered" choice on an EDITABLE select.
|
|
1599
|
+
//
|
|
1600
|
+
// This line once read 'if (locked && value === '')', which meant no
|
|
1601
|
+
// editable enum had an empty option. The browser then selects option[0]
|
|
1602
|
+
// by default, so a colleague who touched nothing still submitted
|
|
1603
|
+
// type=内部Review, change=阶段推进, completion=0%, recognition=认可,
|
|
1604
|
+
// gate3_1=可证明, gate3_2=已确认 — and, on the new-project form,
|
|
1605
|
+
// gate0 评审结论=通过. Those are audit verdicts; the form was signing
|
|
1606
|
+
// them for the colleague. A locked field is different: its value comes
|
|
1607
|
+
// from the ledger, so it must show that value rather than an empty one.
|
|
1608
|
+
if (!locked || value === '') input += '<option value="">— 未填 —</option>';
|
|
1571
1609
|
for (var i = 0; i < opts.enum.length; i += 1) {
|
|
1572
1610
|
var option = opts.enum[i];
|
|
1573
1611
|
input += '<option value="' + escapeHtml(option) + '"' + (option === value ? ' selected' : '') + '>' + escapeHtml(option) + '</option>';
|
|
@@ -1625,16 +1663,18 @@ const FORM_SCRIPT = `
|
|
|
1625
1663
|
'</div>';
|
|
1626
1664
|
|
|
1627
1665
|
var tone = present === 5 ? 'badge-ok' : present === 0 ? 'badge-warn' : 'badge-info';
|
|
1666
|
+
// 评审结论 / 评审人 / 评审日期 are NOT here on purpose. They are the G0
|
|
1667
|
+
// review's output, and the form once offered them to the colleague being
|
|
1668
|
+
// asked to supply facts — so a form could arrive claiming "评审通过, 评审人 X"
|
|
1669
|
+
// written by the person under review. The review is recorded through DSH,
|
|
1670
|
+
// not through this file.
|
|
1628
1671
|
return '<section class="sec">' +
|
|
1629
1672
|
'<header class="sec-head"><h2 class="sec-title">Gate 0 · 值不值得做</h2>' +
|
|
1630
1673
|
'<span class="sec-kicker">五必填 <span class="badge ' + tone + '">' + present + ' / 5</span></span></header>' +
|
|
1631
|
-
'<p class="sec-hint">这五项齐了,G0
|
|
1674
|
+
'<p class="sec-hint">这五项齐了,G0 评审才有意义。评审结论不在这里填。</p>' +
|
|
1632
1675
|
'<div class="g0-grid">' + cards + '</div>' +
|
|
1633
1676
|
'<div class="grid-2">' +
|
|
1634
1677
|
field('主要竞争对手', 'gate0.competitor', project.gate0.competitor, {}) +
|
|
1635
|
-
field('G0 评审结论', 'gate0.conclusion', project.gate0.conclusion, { enum: DATA.enums.g0Conclusion }) +
|
|
1636
|
-
field('G0 评审人', 'gate0.reviewer', project.gate0.reviewer, {}) +
|
|
1637
|
-
field('评审日期', 'gate0.reviewed_at', project.gate0.reviewed_at, { date: true }) +
|
|
1638
1678
|
'</div></section>';
|
|
1639
1679
|
}
|
|
1640
1680
|
|
|
@@ -1784,7 +1824,7 @@ const FORM_SCRIPT = `
|
|
|
1784
1824
|
// A G0 project has no plan yet by design, so this is normal, not a gap.
|
|
1785
1825
|
return '<div class="field"><label class="field-label">' + escapeHtml(label) + '</label>' +
|
|
1786
1826
|
'<p class="field-help">' + escapeHtml(hint) + '</p>' +
|
|
1787
|
-
'<p class="pick-empty"
|
|
1827
|
+
'<p class="pick-empty">这个项目还没有可选的内容(方案里还没填),先跳过这一项。</p></div>';
|
|
1788
1828
|
}
|
|
1789
1829
|
var chosen = {};
|
|
1790
1830
|
for (var i = 0; i < selected.length; i += 1) chosen[text(selected[i])] = true;
|
|
@@ -1803,6 +1843,27 @@ const FORM_SCRIPT = `
|
|
|
1803
1843
|
'<div class="pick-list">' + boxes + '</div></div>';
|
|
1804
1844
|
}
|
|
1805
1845
|
|
|
1846
|
+
/**
|
|
1847
|
+
* One round of progress — the form's primary job.
|
|
1848
|
+
*
|
|
1849
|
+
* ## Fact-only, deliberately
|
|
1850
|
+
*
|
|
1851
|
+
* A round used to also ask for 客户认可度, G3-1 and G3-2. Those are not facts a
|
|
1852
|
+
* colleague observes; they are the ledger's verdicts, and 'tools/derive.mjs'
|
|
1853
|
+
* consumes them to work out scenario and criterion status. Letting the person
|
|
1854
|
+
* filling the form set them meant self-certification: every round could arrive
|
|
1855
|
+
* already marked 可证明 + 已确认 without anyone having confirmed anything.
|
|
1856
|
+
*
|
|
1857
|
+
* They are removed from the form. DSH derives them on merge (see the
|
|
1858
|
+
* poc-submit skill) from what IS collected here: evidence, the customer's own
|
|
1859
|
+
* words, and what was actually done. Super Agent audits afterwards.
|
|
1860
|
+
*
|
|
1861
|
+
* ## Why this is short
|
|
1862
|
+
*
|
|
1863
|
+
* The intended use is "one round, one screen". So the required facts come
|
|
1864
|
+
* first, and the optional ones live in a collapsed block — a colleague filing
|
|
1865
|
+
* a weekly update should not have to scroll past fields they rarely touch.
|
|
1866
|
+
*/
|
|
1806
1867
|
function progressCard(project) {
|
|
1807
1868
|
var entry = project.progress;
|
|
1808
1869
|
var evidenceRows = '';
|
|
@@ -1814,34 +1875,41 @@ const FORM_SCRIPT = `
|
|
|
1814
1875
|
'</div></div>';
|
|
1815
1876
|
}
|
|
1816
1877
|
var countBadge = project.existingProgressCount > 0
|
|
1817
|
-
? '<span class="badge badge-info"
|
|
1818
|
-
: '<span class="badge badge-warn"
|
|
1878
|
+
? '<span class="badge badge-info">第 ' + (project.existingProgressCount + 1) + ' 条</span>'
|
|
1879
|
+
: '<span class="badge badge-warn">第一条</span>';
|
|
1880
|
+
|
|
1881
|
+
// Optional extras are collapsed by default: they exist, but they must not
|
|
1882
|
+
// stand between the colleague and the three fields that actually matter.
|
|
1883
|
+
var extras =
|
|
1884
|
+
'<details class="read-context extras"><summary>可选:完成度 / 目标 / 关联场景与指标</summary>' +
|
|
1885
|
+
'<div class="grid-2">' +
|
|
1886
|
+
field('完成度', 'progress.completion', entry.completion, { enum: DATA.enums.completion }) +
|
|
1887
|
+
field('这一轮的目标', 'progress.goal', entry.goal, {}) +
|
|
1888
|
+
'</div>' +
|
|
1889
|
+
idPicker('推进了哪些场景', 'progress.scenarioIds', null, project.plan.scenarios, entry.scenarioIds,
|
|
1890
|
+
'勾选这一轮实际验证过的场景。') +
|
|
1891
|
+
idPicker('验证了哪些指标', 'progress.criteriaIds', null, project.plan.criteria, entry.criteriaIds,
|
|
1892
|
+
'与场景相互独立:一条指标可以被验证而没有推进任何场景。') +
|
|
1893
|
+
'</details>';
|
|
1894
|
+
|
|
1819
1895
|
return '<section class="sec">' +
|
|
1820
1896
|
'<header class="sec-head"><h2 class="sec-title">这一轮进展</h2>' +
|
|
1821
1897
|
'<span class="sec-kicker">' + countBadge + '</span></header>' +
|
|
1822
|
-
'<p class="sec-hint"
|
|
1823
|
-
'<div class="grid-
|
|
1898
|
+
'<p class="sec-hint">只填这次真正发生的事。追加式,不会覆盖历史。</p>' +
|
|
1899
|
+
'<div class="grid-3">' +
|
|
1824
1900
|
field('日期', 'progress.date', entry.date, { date: true, required: true }) +
|
|
1825
1901
|
field('类型', 'progress.type', entry.type, { enum: DATA.enums.progressType, required: true }) +
|
|
1826
|
-
field('这一次什么变了', 'progress.change', entry.change, { enum: DATA.enums.progressChange, required: true, help: '
|
|
1827
|
-
field('完成度', 'progress.completion', entry.completion, { enum: DATA.enums.completion }) +
|
|
1902
|
+
field('这一次什么变了', 'progress.change', entry.change, { enum: DATA.enums.progressChange, required: true, help: '「无实质进展」也是正当答案。' }) +
|
|
1828
1903
|
'</div>' +
|
|
1829
|
-
field('
|
|
1830
|
-
field('实际结果', 'progress.actual', entry.actual, { multiline: true, required: true, help: '做了什么、结果如何。没有证据的结果会被缺口规则点名。' }) +
|
|
1831
|
-
idPicker('这一轮推进了哪些场景', 'progress.scenarioIds', null, project.plan.scenarios, entry.scenarioIds,
|
|
1832
|
-
'勾选这一轮实际验证过的场景。场景状态(已证明 / 待客户确认 / 无证据)由这里的勾选加上证据推导出来。') +
|
|
1833
|
-
idPicker('这一轮验证了哪些指标', 'progress.criteriaIds', null, project.plan.criteria, entry.criteriaIds,
|
|
1834
|
-
'与场景相互独立:一条指标可以被验证而没有推进任何场景。') +
|
|
1904
|
+
field('实际结果', 'progress.actual', entry.actual, { multiline: true, required: true, help: '做了什么、结果如何。' }) +
|
|
1835
1905
|
'<div class="field"><label class="field-label">证据<span class="req">*</span></label>' +
|
|
1836
|
-
'<p class="field-help"
|
|
1906
|
+
'<p class="field-help">没有证据的结果会被缺口规则点名。</p>' + evidenceRows +
|
|
1837
1907
|
'<button type="button" class="btn btn-sm" data-add="evidence">+ 加一条证据</button></div>' +
|
|
1838
1908
|
'<div class="grid-2">' +
|
|
1839
1909
|
field('同步对象', 'progress.customer.synced_with', entry.customer.synced_with, {}) +
|
|
1840
|
-
field('
|
|
1841
|
-
field('G3-1', 'progress.gate3_1', entry.gate3_1, { enum: DATA.enums.gate3_1 }) +
|
|
1842
|
-
field('G3-2', 'progress.gate3_2', entry.gate3_2, { enum: DATA.enums.gate3_2 }) +
|
|
1910
|
+
field('客户原话 / 反馈', 'progress.customer.feedback', entry.customer.feedback, { multiline: true, help: '照原样记,不要替他判断认可不认可。' }) +
|
|
1843
1911
|
'</div>' +
|
|
1844
|
-
|
|
1912
|
+
extras +
|
|
1845
1913
|
'</section>';
|
|
1846
1914
|
}
|
|
1847
1915
|
|
|
@@ -1850,7 +1918,7 @@ const FORM_SCRIPT = `
|
|
|
1850
1918
|
var next = project.progress.next;
|
|
1851
1919
|
return '<section class="sec">' +
|
|
1852
1920
|
'<header class="sec-head"><h2 class="sec-title">下一步工作目标及计划</h2>' +
|
|
1853
|
-
'
|
|
1921
|
+
'</header>' +
|
|
1854
1922
|
'<div class="grid-2">' +
|
|
1855
1923
|
field('下一步目标', 'progress.next.goal', next.goal, { multiline: true, required: true }) +
|
|
1856
1924
|
field('负责人', 'progress.next.owner', next.owner, {}) +
|
|
@@ -1862,7 +1930,7 @@ const FORM_SCRIPT = `
|
|
|
1862
1930
|
function identityCard(project) {
|
|
1863
1931
|
return '<section class="sec">' +
|
|
1864
1932
|
'<header class="sec-head"><h2 class="sec-title">基本信息</h2></header>' +
|
|
1865
|
-
'<p class="sec-hint"
|
|
1933
|
+
'<p class="sec-hint">编号、阶段、状态由台账维护,这里只读。</p>' +
|
|
1866
1934
|
'<div class="grid-2">' +
|
|
1867
1935
|
field('项目编号', 'pocId', project.pocId, { required: DATA.mode === 'blank', readonly: DATA.mode !== 'blank', help: DATA.mode === 'blank' ? '新建时必填,格式 POC-XXX。' : '台账主键,不可改。' }) +
|
|
1868
1936
|
field('项目名称', 'name', project.name, { required: true }) +
|
|
@@ -2040,19 +2108,20 @@ const FORM_SCRIPT = `
|
|
|
2040
2108
|
var canEdit = {};
|
|
2041
2109
|
for (var e = 0; e < plan_.editable.length; e += 1) canEdit[plan_.editable[e]] = true;
|
|
2042
2110
|
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
//
|
|
2046
|
-
//
|
|
2047
|
-
//
|
|
2111
|
+
// 'progress' intent is the one-screen case: what has already been reported,
|
|
2112
|
+
// then this round. Deliberately NO snapshot strip and no "what is missing"
|
|
2113
|
+
// banner here — on a single-round receipt, five fact cells and a "Gate 0 还缺
|
|
2114
|
+
// 2 项" nag are noise that push the actual fields down the page. The banner
|
|
2115
|
+
// above already carries stage, status and owner.
|
|
2048
2116
|
if (DATA.intent === 'progress') {
|
|
2049
|
-
|
|
2050
|
-
byId('formBody').innerHTML = body;
|
|
2117
|
+
byId('formBody').innerHTML = banner + historyCard(project) + progressCard(project) + nextCard(project);
|
|
2051
2118
|
bindSwitch();
|
|
2052
2119
|
markFooter();
|
|
2053
2120
|
return;
|
|
2054
2121
|
}
|
|
2055
2122
|
|
|
2123
|
+
var body = banner + snapshotCard(project) + missingCard(project, canEdit);
|
|
2124
|
+
|
|
2056
2125
|
var left = '';
|
|
2057
2126
|
if (canEdit.gate0) left += g0Card(project); else left += contextGate0(project);
|
|
2058
2127
|
|
|
@@ -2083,7 +2152,17 @@ const FORM_SCRIPT = `
|
|
|
2083
2152
|
// History sits immediately above the new round: read what happened, then say
|
|
2084
2153
|
// what changed. A new project has no history, so the block is simply absent.
|
|
2085
2154
|
body += historyCard(project);
|
|
2086
|
-
|
|
2155
|
+
// On a NEW project the round is optional. A project that has just been
|
|
2156
|
+
// registered may have nothing to report yet, and making this block required
|
|
2157
|
+
// was what pushed the new-project form to roughly 2000px. Collapsed, so it
|
|
2158
|
+
// cannot read as another mandatory section.
|
|
2159
|
+
if (canEdit.progress) {
|
|
2160
|
+
body += progressCard(project) + nextCard(project);
|
|
2161
|
+
} else if (DATA.intent === 'new') {
|
|
2162
|
+
body += '<details class="read-context optional-block">' +
|
|
2163
|
+
'<summary>可选:如果已经有客户动作,顺便登记第一条进展(不填也能提交)</summary>' +
|
|
2164
|
+
progressCard(project) + nextCard(project) + '</details>';
|
|
2165
|
+
}
|
|
2087
2166
|
|
|
2088
2167
|
byId('formBody').innerHTML = body;
|
|
2089
2168
|
bindSwitch();
|
|
@@ -2532,6 +2611,10 @@ const FORM_SCRIPT = `
|
|
|
2532
2611
|
var scope = {};
|
|
2533
2612
|
for (var s = 0; s < plan_.editable.length; s += 1) scope[plan_.editable[s]] = true;
|
|
2534
2613
|
if (scope.plan) scope.gate12 = true;
|
|
2614
|
+
// The new-project form offers an OPTIONAL first round. It is not in the
|
|
2615
|
+
// Host's editable list — so it is never required — but it must still be
|
|
2616
|
+
// emitted when the colleague filled it in.
|
|
2617
|
+
if (DATA.intent === 'new') scope.progress = true;
|
|
2535
2618
|
function inScope(section) { return scope[section] === true; }
|
|
2536
2619
|
|
|
2537
2620
|
// The seed snapshot: what these fields held when the form was generated.
|
package/lib/gap.d.ts
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* the only writer of those fields, and a second implementation here would
|
|
22
22
|
* eventually disagree with CI.
|
|
23
23
|
*/
|
|
24
|
-
import type { GapItem, GapLevel, PocRecord, StageId } from './types.js';
|
|
24
|
+
import type { GapItem, GapLevel, PocRecord, ProgressRecord, StageId } from './types.js';
|
|
25
25
|
import { type RulesBundle } from './rules.js';
|
|
26
26
|
/** Normalize the free-form `stage` string onto a stage id. */
|
|
27
27
|
export declare function normalizeStage(raw: unknown): {
|
|
@@ -63,7 +63,7 @@ export declare function readDimensions(poc: PocRecord): {
|
|
|
63
63
|
nextMilestone: boolean;
|
|
64
64
|
};
|
|
65
65
|
/** The newest progress entry, or `null`. */
|
|
66
|
-
export declare function latestProgress(poc: PocRecord):
|
|
66
|
+
export declare function latestProgress(poc: PocRecord): ProgressRecord | null;
|
|
67
67
|
/** The newest progress date, or `null`. */
|
|
68
68
|
export declare function lastProgressDate(poc: PocRecord): string | null;
|
|
69
69
|
/** Whole days between a `YYYY-MM-DD` date and the scan clock. */
|
package/lib/gap.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* the only writer of those fields, and a second implementation here would
|
|
22
22
|
* eventually disagree with CI.
|
|
23
23
|
*/
|
|
24
|
+
import { roundEvidence, structuredLines } from './progress.js';
|
|
24
25
|
import { FALLBACK_RULE_META, fallbackRules } from './rules.js';
|
|
25
26
|
/** Stage prefixes a raw `stage` value can normalize to, in order. */
|
|
26
27
|
const STAGE_PREFIXES = [
|
|
@@ -125,7 +126,7 @@ export function readDimensions(poc) {
|
|
|
125
126
|
// `outcome` is mostly auto-derived from the last progress entry, so a project
|
|
126
127
|
// that has progressed but not yet had its outcome summarised still counts:
|
|
127
128
|
// evidence exists when either the outcome or the newest entry carries it.
|
|
128
|
-
const lastEvidence =
|
|
129
|
+
const lastEvidence = roundEvidence(last);
|
|
129
130
|
return {
|
|
130
131
|
achievement: !blank(outcome.achievement),
|
|
131
132
|
evidence: !blank(outcome.our_proof) || lastEvidence.length > 0,
|
|
@@ -137,7 +138,7 @@ export function readDimensions(poc) {
|
|
|
137
138
|
export function latestProgress(poc) {
|
|
138
139
|
const progress = Array.isArray(poc.progress) ? poc.progress : [];
|
|
139
140
|
const last = progress.length === 0 ? null : progress[progress.length - 1];
|
|
140
|
-
return
|
|
141
|
+
return last ?? null;
|
|
141
142
|
}
|
|
142
143
|
/** The newest progress date, or `null`. */
|
|
143
144
|
export function lastProgressDate(poc) {
|
|
@@ -210,25 +211,31 @@ export function scanGaps(poc, options) {
|
|
|
210
211
|
}
|
|
211
212
|
// R7 — testing started before G2 was ready.
|
|
212
213
|
const ready = text(plan.gate2?.ready);
|
|
213
|
-
|
|
214
|
+
const hasTesting = progress.some((entry) => {
|
|
215
|
+
const lines = structuredLines(entry);
|
|
216
|
+
return lines === undefined || lines.some((line) => (line.scenario_ids?.length ?? 0) > 0 || (line.criteria_ids?.length ?? 0) > 0);
|
|
217
|
+
});
|
|
218
|
+
if (hasTesting && ready !== 'Ready') {
|
|
214
219
|
gaps.push(gap(poc, 'R7-g2-not-ready', { field: 'plan.gate2.ready', params: { ready: ready === '' ? '未设置' : ready } }));
|
|
215
220
|
}
|
|
216
221
|
// R8–R10 — the proof chain, judged by the NEWEST progress entry only.
|
|
217
222
|
if (last !== null) {
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
+
const lines = structuredLines(last);
|
|
224
|
+
const units = lines === undefined ? [{ actual: last.actual, evidence: last.evidence, review: {
|
|
225
|
+
recognition: last.customer?.recognition, gate3_1: last.gate3_1, gate3_2: last.gate3_2,
|
|
226
|
+
}, status: null }] : lines;
|
|
227
|
+
// Report one finding per rule per project. Each rule still checks each work
|
|
228
|
+
// item independently: a sibling's evidence cannot excuse a missing proof.
|
|
229
|
+
if (units.some((unit) => text(unit.actual) !== '' && !unit.evidence?.length && unit.status !== '未开始' && unit.status !== '取消')) {
|
|
223
230
|
gaps.push(gap(poc, 'R8-progress-no-evidence', { field: 'progress.evidence', params: { seq: numberOrNull(last.seq) ?? 0 } }));
|
|
224
231
|
}
|
|
225
|
-
|
|
226
|
-
if (
|
|
227
|
-
gaps.push(gap(poc, 'R9-evidence-no-recognition', { field: 'progress.customer.recognition', params: { recognition } }));
|
|
232
|
+
const pending = units.find((unit) => unit.evidence?.length && ['未认可', '待确认'].includes(text(unit.review?.recognition) || (lines ? '待确认' : '')));
|
|
233
|
+
if (pending) {
|
|
234
|
+
gaps.push(gap(poc, 'R9-evidence-no-recognition', { field: 'progress.customer.recognition', params: { recognition: text(pending.review?.recognition) || '待确认' } }));
|
|
228
235
|
}
|
|
229
|
-
|
|
230
|
-
if (
|
|
231
|
-
gaps.push(gap(poc, 'R10-g3-1-without-g3-2', { field: 'progress.gate3_2', params: { gate3_2: text(
|
|
236
|
+
const provable = units.find((unit) => unit.review?.gate3_1 === '可证明' && unit.review?.gate3_2 !== '已确认');
|
|
237
|
+
if (provable) {
|
|
238
|
+
gaps.push(gap(poc, 'R10-g3-1-without-g3-2', { field: 'progress.gate3_2', params: { gate3_2: text(provable.review?.gate3_2) || '未填' } }));
|
|
232
239
|
}
|
|
233
240
|
}
|
|
234
241
|
// R11 — achieved, and no next milestone: value created, none banked.
|
package/lib/index.js
CHANGED
|
@@ -19,7 +19,8 @@ import { RepoCache, RepoError, assertSafeCacheRoot } from './repo.js';
|
|
|
19
19
|
import { buildRiskBoard } from './risks.js';
|
|
20
20
|
import { buildGlobalTimeline } from './timeline.js';
|
|
21
21
|
import { text } from './gap.js';
|
|
22
|
-
import {
|
|
22
|
+
import { canReportProgress } from './progress.js';
|
|
23
|
+
import { buildReportHtml, reportFileName } from './report-form.js';
|
|
23
24
|
import { registerBundledSkills } from './skill.js';
|
|
24
25
|
import { createExecuteRoute } from './transport.js';
|
|
25
26
|
export { resolveConfig };
|
|
@@ -102,25 +103,23 @@ export function createRuntime(config, options = {}) {
|
|
|
102
103
|
* rather than an error, because a stale browser tab holding an id that was
|
|
103
104
|
* renamed in the ledger should still produce the projects it can.
|
|
104
105
|
*/
|
|
105
|
-
async exportForm(mode, pocIds
|
|
106
|
+
async exportForm(mode, pocIds) {
|
|
106
107
|
await this.prepare();
|
|
107
108
|
const stamp = now();
|
|
108
|
-
// Default from `mode` so an older Client bundle keeps working.
|
|
109
|
-
const resolved = intent ?? (mode === 'blank' ? 'new' : 'supplement');
|
|
110
109
|
if (mode === 'blank') {
|
|
111
|
-
return {
|
|
112
|
-
html: buildFormHtml({ mode: 'blank', intent: resolved, projects: [], now: stamp }),
|
|
113
|
-
fileName: formFileName({ mode: 'blank', pocIds: [], now: stamp }),
|
|
114
|
-
projectCount: 0,
|
|
115
|
-
};
|
|
110
|
+
return { html: buildReportHtml('new', [], stamp), fileName: reportFileName('new', [], stamp), projectCount: 0 };
|
|
116
111
|
}
|
|
117
112
|
const wanted = new Set(pocIds);
|
|
118
113
|
const records = (await loadOrEmpty()).filter((record) => wanted.has(text(record.poc_id)));
|
|
119
|
-
|
|
114
|
+
if (records.length === 0)
|
|
115
|
+
throw new RepoError('unknown-project', '没有匹配的项目,请刷新列表后重试。', {});
|
|
116
|
+
const ended = records.find((record) => !canReportProgress(record.stage, record.status));
|
|
117
|
+
if (ended)
|
|
118
|
+
throw new RepoError('unknown-project', `${text(ended.poc_id)} 已结束,不能导出记录进展表单。`, { pocId: text(ended.poc_id) });
|
|
120
119
|
return {
|
|
121
|
-
html:
|
|
122
|
-
fileName:
|
|
123
|
-
projectCount:
|
|
120
|
+
html: buildReportHtml('progress', records, stamp),
|
|
121
|
+
fileName: reportFileName('progress', records.map((record) => text(record.poc_id)), stamp),
|
|
122
|
+
projectCount: records.length,
|
|
124
123
|
};
|
|
125
124
|
},
|
|
126
125
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProgressLineRecord, ProgressRecord, ProgressView } from './types.js';
|
|
2
|
+
/** Both export and import must agree which projects accept new progress. */
|
|
3
|
+
export declare function canReportProgress(stage: unknown, status: unknown): boolean;
|
|
4
|
+
export declare const structuredLines: (round: ProgressRecord | null | undefined) => ProgressLineRecord[] | undefined;
|
|
5
|
+
export declare const roundActual: (round: ProgressRecord) => string;
|
|
6
|
+
export declare const roundEvidence: (round: ProgressRecord | null | undefined) => import("./types.js").EvidenceRecord[];
|
|
7
|
+
/** Project one linked item at a time to retain evidence/review attribution in the scenario pane. */
|
|
8
|
+
export declare function scenarioRoundViews(view: ProgressView, scenarioId: string): ProgressView[];
|
package/lib/progress.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const clean = (value) => typeof value === 'string' ? value.trim() : '';
|
|
2
|
+
/** Both export and import must agree which projects accept new progress. */
|
|
3
|
+
export function canReportProgress(stage, status) {
|
|
4
|
+
return clean(stage).toLowerCase() !== 'closed' && !['已关闭', '已取消'].includes(clean(status));
|
|
5
|
+
}
|
|
6
|
+
export const structuredLines = (round) => Array.isArray(round?.lines) ? round.lines.filter((item) => item && typeof item === 'object') : undefined;
|
|
7
|
+
export const roundActual = (round) => structuredLines(round)?.map((item) => `${clean(item.title)}(${clean(item.status)}):${clean(item.actual)}`).join('\n') ?? clean(round.actual);
|
|
8
|
+
export const roundEvidence = (round) => structuredLines(round)?.flatMap((line) => Array.isArray(line.evidence) ? line.evidence : []) ?? (Array.isArray(round?.evidence) ? round.evidence : []);
|
|
9
|
+
/** Project one linked item at a time to retain evidence/review attribution in the scenario pane. */
|
|
10
|
+
export function scenarioRoundViews(view, scenarioId) {
|
|
11
|
+
if (!view.lines)
|
|
12
|
+
return view.scenarioIds.includes(scenarioId) ? [view] : [];
|
|
13
|
+
return view.lines.filter((line) => line.scenario_ids?.includes(scenarioId)).map((line) => ({
|
|
14
|
+
...view, goal: clean(line.title), actual: clean(line.actual), completion: clean(line.completion),
|
|
15
|
+
scenarioIds: line.scenario_ids ?? [], criteriaIds: line.criteria_ids ?? [],
|
|
16
|
+
evidence: (line.evidence ?? []).map((item) => ({ title: clean(item.title), link: clean(item.link), type: clean(item.type) })),
|
|
17
|
+
customer: { syncedWith: clean(line.customer?.synced_with), feedback: clean(line.customer?.feedback), recognition: clean(line.review?.recognition) },
|
|
18
|
+
gate3_1: clean(line.review?.gate3_1), gate3_2: clean(line.review?.gate3_2),
|
|
19
|
+
}));
|
|
20
|
+
}
|