@v11g/agents-rock 1.0.4 → 1.0.6

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 (48) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  4. package/plugins/solution-architect/skills/estimate/README.md +8 -5
  5. package/plugins/solution-architect/skills/estimate/SKILL.md +13 -7
  6. package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +142 -376
  7. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +619 -601
  8. package/plugins/solution-architect/skills/estimate/assets/scores-review-template.html +363 -0
  9. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +5 -9
  10. package/plugins/solution-architect/skills/estimate/references/interview.md +132 -12
  11. package/plugins/solution-architect/skills/estimate/references/scoring-guide.md +23 -0
  12. package/plugins/solution-architect/skills/estimate/references/techniques.md +9 -2
  13. package/plugins/solution-architect/skills/estimate/references/writing.md +28 -5
  14. package/plugins/solution-architect/skills/estimate/scripts/lib/agentic-checks.mjs +1 -1
  15. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +4 -30
  16. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +14 -10
  17. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +6 -8
  18. package/plugins/solution-architect/skills/estimate/scripts/lib/md-tables.mjs +31 -0
  19. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +14 -3
  20. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +5 -4
  21. package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +39 -0
  22. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +4 -14
  23. package/plugins/solution-architect/skills/estimate/scripts/lib/score-csv.mjs +58 -0
  24. package/plugins/solution-architect/skills/estimate/scripts/lib/score-diff.mjs +30 -0
  25. package/plugins/solution-architect/skills/estimate/scripts/lib/score-html.mjs +17 -0
  26. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring-checks.mjs +24 -0
  27. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring-schema.mjs +48 -0
  28. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring.mjs +45 -0
  29. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +14 -13
  30. package/plugins/solution-architect/skills/estimate/scripts/score-review.mjs +59 -0
  31. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +403 -316
  32. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +25 -1
  33. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +29 -10
  34. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +2 -2
  35. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +21 -3
  36. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +1 -1
  37. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +4 -4
  38. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +64 -6
  39. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +96 -13
  40. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +105 -4
  41. package/plugins/solution-architect/skills/estimate/scripts/test/score-review.test.mjs +187 -0
  42. package/plugins/solution-architect/skills/estimate/scripts/test/scoring.test.mjs +49 -0
  43. package/plugins/solution-architect/skills/estimate/scripts/test/url-state.test.mjs +198 -0
  44. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +38 -0
  45. package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +114 -28
  46. package/plugins/solution-architect/skills/new-lead/scripts/lib/map-nodes.mjs +1 -1
  47. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +2 -2
  48. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +1 -1
@@ -13,8 +13,8 @@
13
13
  /* color-scheme is declared, not left at `normal`: a page that never states its
14
14
  scheme is the page a force-dark browser rewrites, and then the toggle flips
15
15
  data-theme with nothing visible changing — the button reads as broken. Stated
16
- per theme, forced dark is off and the native controls in the what-if rail
17
- (number, range, select) follow the page instead of fighting it.
16
+ per theme, forced dark is off and the native controls (the breakdown's
17
+ selects and buttons) follow the page instead of fighting it.
18
18
 
19
19
  The light palette is unconditional and the dark one is scoped to @media screen
20
20
  below, so this block doubles as the paper palette: the page opens dark on a
@@ -84,12 +84,6 @@ header h1 {
84
84
  #confidence-badge.med { color:var(--warn); border-color:var(--warn); background:var(--warn-soft); }
85
85
  #confidence-badge.low { color:var(--bad); border-color:var(--bad); background:rgba(185,28,28,.08); }
86
86
  #confidence-badge.uncalibrated { color:var(--warn); border-color:var(--warn); background:var(--warn-soft); }
87
- #modified-banner {
88
- margin:0; padding:.5rem max(1.25rem, calc((100% - 1160px) / 2));
89
- background:var(--warn-soft); color:var(--warn); font-size:.85rem;
90
- border-bottom:1px solid var(--border);
91
- }
92
- #modified-banner button { margin-left:.5rem; }
93
87
  main {
94
88
  display:grid; grid-template-columns:1fr; gap:1.1rem;
95
89
  max-width:1160px; margin:0 auto; padding:1.25rem 1.25rem 3rem;
@@ -100,17 +94,35 @@ main section h2, main aside h2 {
100
94
  font-size:.82rem; font-weight:600; color:var(--ink-dim);
101
95
  margin:0 0 .8rem; letter-spacing:.01em;
102
96
  }
103
- /* panels: every section except the scenario card grid reads as one surface */
97
+ /* panels: every section reads as one surface */
104
98
  .col > section {
105
99
  background:var(--card); border:1px solid var(--border); border-radius:.6rem;
106
100
  padding:1.1rem 1.2rem; box-shadow:var(--shadow);
107
101
  }
108
- #scenario-cards { background:none; border:none; box-shadow:none; padding:0; display:flex; flex-direction:column; }
109
- #scenario-cards .cards {
110
- flex:1; display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:.9rem;
111
- }
112
102
  .sec-head { display:flex; align-items:center; gap:.45rem; margin:0 0 .8rem; }
113
103
  .sec-head h2 { margin:0; }
104
+ /* summary: the estimate's headline — team, months and cost stated once, then
105
+ the committed alternatives as one small table (internal view only). */
106
+ #summary .lead { font-size:1.02rem; font-weight:600; margin:0 0 .25rem; }
107
+ #summary .figures {
108
+ font-size:1.7rem; font-weight:600; letter-spacing:-.02em; line-height:1.15;
109
+ font-variant-numeric:tabular-nums; margin:0 0 .4rem;
110
+ }
111
+ #summary .sep { color:var(--ink-dim); margin:0 .4rem; font-weight:400; }
112
+ #summary .range, #summary .meta {
113
+ margin:.15rem 0; font-family:'IBM Plex Mono',monospace; font-size:.78rem; color:var(--ink-dim);
114
+ }
115
+ #summary .alts { margin-top:.9rem; padding-top:.7rem; border-top:1px solid var(--border); }
116
+ #summary .alts caption {
117
+ text-align:left; font-size:.72rem; text-transform:uppercase; letter-spacing:.05em;
118
+ color:var(--ink-dim); margin-bottom:.3rem;
119
+ }
120
+ #summary .why { font-size:.84rem; margin:0 0 .5rem; }
121
+ #summary .delta {
122
+ font-family:'IBM Plex Mono',monospace; font-size:.72rem; color:var(--warn);
123
+ background:var(--warn-soft); padding:.12rem .4rem; border-radius:.25rem;
124
+ }
125
+ #summary .insight { font-size:.86rem; margin:.6rem 0 0; }
114
126
  details.help { position:relative; display:inline-block; line-height:1; }
115
127
  details.help summary {
116
128
  list-style:none; cursor:help; width:1.05rem; height:1.05rem; border-radius:50%;
@@ -127,7 +139,7 @@ details.help > p {
127
139
  color:var(--ink); text-transform:none; letter-spacing:normal; text-align:left;
128
140
  box-shadow:var(--shadow);
129
141
  }
130
- #controls details.help > p, td details.help > p, caption details.help > p { left:auto; right:0; }
142
+ td details.help > p, caption details.help > p { left:auto; right:0; }
131
143
  #method summary { list-style:none; display:flex; align-items:baseline; gap:.6rem; cursor:pointer; }
132
144
  #method summary::-webkit-details-marker { display:none; }
133
145
  #method summary h2 { margin:0; }
@@ -138,69 +150,6 @@ details.help > p {
138
150
  #method li { margin-bottom:.35rem; }
139
151
  #method .sources { font-size:.78rem; color:var(--ink-dim); margin:0; }
140
152
  #method .sources span { display:block; margin-bottom:.2rem; }
141
- .card {
142
- position:relative; background:var(--card); border:1px solid var(--border);
143
- border-radius:.6rem; padding:1rem 1.1rem; box-shadow:var(--shadow);
144
- }
145
- /* card anatomy: header, hero (top-aligned so the months figures sit on the
146
- same line across cards), facts pinned to the bottom. */
147
- .scenario { display:flex; flex-direction:column; gap:.7rem; padding:1.2rem; }
148
- .scenario h3 {
149
- font-family:'IBM Plex Mono',monospace; font-size:.78rem; font-weight:600;
150
- color:var(--ink-dim); margin:0; overflow-wrap:anywhere;
151
- }
152
- .hero { flex:1; display:flex; flex-direction:column; justify-content:flex-start; gap:.55rem; }
153
- .hero .num {
154
- font-size:2.2rem; font-weight:600; line-height:1.05; letter-spacing:-.02em;
155
- font-variant-numeric:tabular-nums;
156
- }
157
- .hero .unit { font-size:.8rem; color:var(--ink-dim); }
158
- .gauge { height:.45rem; background:var(--border); border-radius:.3rem; overflow:hidden; }
159
- .gauge span { display:block; height:100%; background:var(--accent); border-radius:.3rem; }
160
- .delta {
161
- align-self:flex-start; font-family:'IBM Plex Mono',monospace; font-size:.68rem;
162
- color:var(--warn); background:var(--warn-soft); padding:.14rem .45rem; border-radius:.25rem;
163
- }
164
- .facts {
165
- display:grid; grid-template-columns:1fr 1fr; gap:.7rem 1.1rem;
166
- border-top:1px solid var(--border); padding-top:.8rem; margin:0;
167
- }
168
- .facts dt { font-size:.66rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); }
169
- .facts dd { margin:.1rem 0 0; font-family:'IBM Plex Mono',monospace; font-size:.86rem; }
170
- .scenario.recommended { border-color:var(--accent); background:linear-gradient(var(--accent-soft), transparent 55%) var(--card); }
171
- .flag {
172
- position:absolute; top:.7rem; right:.8rem; font-size:.62rem; font-weight:600;
173
- letter-spacing:.04em; color:var(--accent-ink); background:var(--accent-soft);
174
- padding:.14rem .4rem; border-radius:.25rem;
175
- }
176
- .months { margin:.2rem 0 .9rem; font-size:.8rem; color:var(--ink-dim); }
177
- .months .num {
178
- display:block; font-size:2.4rem; font-weight:600; line-height:1.15;
179
- color:var(--ink); font-variant-numeric:tabular-nums; letter-spacing:-.02em;
180
- }
181
- #whatif-readout dl { display:flex; gap:1.2rem; margin:0; }
182
- #whatif-readout dt { font-size:.66rem; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-dim); }
183
- #whatif-readout dd { margin:0; font-family:'IBM Plex Mono',monospace; font-size:.88rem; }
184
- #whatif-readout { border-top:1px solid var(--border); padding-top:.7rem; }
185
- #whatif-readout .months { display:flex; align-items:baseline; gap:.4rem; margin:0 0 .4rem; }
186
- #whatif-readout .months .num { font-size:1.3rem; color:var(--accent-ink); }
187
- /* bars are styled divs — width set inline from data, no canvas, printable */
188
- /* when the section is stretched to match the rail beside it, the bars float
189
- to the vertical center instead of leaving a dead band at the bottom. */
190
- #cost-bars { display:flex; flex-direction:column; }
191
- #cost-bars .bar-group { flex:1; display:flex; flex-direction:column; justify-content:center; }
192
- .bar-row { display:flex; align-items:center; gap:.6rem; margin-bottom:.85rem; }
193
- .bar-label {
194
- flex:0 0 170px; font-size:.78rem; color:var(--ink-dim);
195
- white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
196
- }
197
- .bar-track { flex:1; height:1.05rem; background:var(--border); border-radius:.3rem; overflow:hidden; }
198
- .bar-fill { display:block; height:100%; background:var(--accent); opacity:.5; border-radius:.3rem; }
199
- .bar-fill.is-rec { opacity:1; }
200
- .bar-val {
201
- flex:0 0 auto; min-width:5.5rem; text-align:right;
202
- font-family:'IBM Plex Mono',monospace; font-size:.76rem; font-variant-numeric:tabular-nums;
203
- }
204
153
  /* roadmap: Gantt-style shared axis. Every row is a flex triple (label |
205
154
  track | months) with the same label/months widths as the axis strip below
206
155
  it, so a given month lines up under the same x-position in every row's
@@ -277,39 +226,12 @@ tr.conf-uncalibrated .conf { color:var(--warn); }
277
226
  #detail table { min-width:720px; }
278
227
  .task-assump { font-size:.76rem; color:var(--ink-dim); }
279
228
  #register > div + table, #register > table + table { margin-top:1.4rem; }
280
- /* compact rail: the team roster, the plan select, the sliders, and the
281
- readout stack full-width. Keeps the rail near the height of the two
282
- scenario sections beside it. */
283
- #controls {
284
- background:var(--card); border:1px solid var(--border); border-radius:.6rem;
285
- padding:1.1rem 1.2rem; box-shadow:var(--shadow);
286
- display:grid; grid-template-columns:1fr; gap:.7rem; align-content:start;
287
- }
288
- #controls label { display:flex; flex-direction:column; font-size:.76rem; gap:.3rem; color:var(--ink-dim); }
289
- /* the roster: one row per engineer (seniority + rate + remove), plus add.
290
- Styled by class — the container id is internal-only page text and must
291
- never appear in the head CSS a client render keeps. */
292
- #controls .team { display:flex; flex-direction:column; gap:.4rem; font-size:.76rem; color:var(--ink-dim); }
293
- #controls .team-row { display:flex; gap:.4rem; align-items:center; }
294
- #controls .team-row .cur { margin-right:-.15rem; }
295
- #controls .team-row select { flex:1; min-width:0; }
296
- #controls .team-row input { width:4.6rem; }
297
- #controls .team button { font-size:.76rem; padding:.3rem .5rem; background:var(--bg); color:var(--ink-dim); }
298
- #controls .team button:disabled { opacity:.4; cursor:default; }
299
- #controls .lab { display:flex; justify-content:space-between; align-items:baseline; }
300
- #controls output { font-family:'IBM Plex Mono',monospace; font-size:.74rem; color:var(--ink); }
301
- #controls input, #controls select {
302
- font:inherit; padding:.35rem .45rem; border:1px solid var(--border-strong);
303
- border-radius:.35rem; background:var(--bg); color:var(--ink);
304
- }
305
- #controls input:hover, #controls select:hover { border-color:var(--accent); }
306
- #controls input[type="range"] { padding:0; border:none; background:none; accent-color:var(--accent); }
307
229
  .view-client [data\2d internal] { display:none !important; }
308
230
  @media print {
309
231
  header { position:static; }
310
- header button, #viewer-link, #controls, #modified-banner, details.help { display:none; }
232
+ header button, #viewer-link, details.help { display:none; }
311
233
  main { grid-template-columns:1fr; }
312
- main > section, .card { box-shadow:none; }
234
+ main > section { box-shadow:none; }
313
235
  }
314
236
  </style>
315
237
  </head>
@@ -324,61 +246,21 @@ tr.conf-uncalibrated .conf { color:var(--warn); }
324
246
  <button id="theme-toggle" type="button">theme</button>
325
247
  <!-- internal:start --><!-- slot:VIEWER --><button id="view-toggle" type="button" data-internal>client view</button><!-- internal:end -->
326
248
  </header>
327
- <p id="modified-banner" role="status" hidden>modified from committed estimate — <button id="reset" type="button">reset</button></p>
328
249
  <main>
329
- <div class="col col-wide">
330
- <section id="method"></section>
331
- </div>
332
250
  <div class="col">
333
- <section id="scenario-cards"></section>
334
- <section id="cost-bars"></section>
335
- </div>
336
- <!-- internal:start -->
337
- <style>
338
- /* internal-only layout: the what-if rail sits beside the scenario sections
339
- only — its readout (months, cost, effort) is comparable to nothing below
340
- the cost bars, so the lower sections take the full width instead of
341
- reserving an empty rail column. Lives in the internal range so the
342
- client-only render collapses back to one column. @media screen so the
343
- print rules in the head keep winning on paper. */
344
- @media screen {
345
- main { grid-template-columns:minmax(0, 1fr) 300px; }
346
- .col-wide { grid-column:1 / -1; }
347
- /* no hole under the cost bars: the scenario-cards row stretches so the
348
- left column always ends level with the rail beside it, and the cards
349
- stay the dominant section. */
350
- .col:not(.col-wide) { grid-template-rows:1fr auto; }
351
- .view-client main { grid-template-columns:1fr; }
352
- }
353
- @media screen and (max-width:900px) {
354
- main { grid-template-columns:1fr; }
355
- }
356
- </style>
357
- <aside class="rail" data-internal>
358
- <div class="sec-head"><h2>What-if</h2><details class="help"><summary aria-label="explain this panel">?</summary>
359
- <p>The levers re-run the exact same formulas as the committed numbers, in your browser. Nothing here changes the committed estimate — it answers "what would it look like if&hellip;". The readout below updates live.</p></details></div>
360
- <div id="controls" data-internal>
361
- <div id="ctl-team" class="team" role="group" aria-label="team"></div>
362
- <label>claude plan <select id="ctl-plan"><option>none</option><option>max5x</option><option>max20x</option></select></label>
363
- <label><span class="lab">risk buffer <output></output></span><input id="ctl-buffer" type="range" min="0" max="2" step="0.1"></label>
364
- <label><span class="lab">overhead % <output></output></span><input id="ctl-overhead" type="range" min="0" max="0.6" step="0.05"></label>
365
- <div id="whatif-readout" aria-live="polite"></div>
366
- </div>
367
- </aside>
368
- <!-- internal:end -->
369
- <div class="col col-wide">
251
+ <section id="summary"></section>
370
252
  <section id="containers"></section>
371
253
  <section id="roadmap"></section>
372
254
  <section id="detail"></section>
373
255
  <section id="evidence"></section>
374
256
  <section id="register"></section>
257
+ <section id="method"></section>
375
258
  </div>
376
259
  </main>
377
260
  <script type="application/json" id="estimation-data"><!-- slot:DATA --></script>
378
261
  <script>
379
- <!-- slot:MATH -->
380
- /* boot: parse the data island, stamp the title + confidence badge, then wire
381
- the sections, what-if controls, and view/theme toggles. */
262
+ /* boot: parse the data island, stamp the title + confidence badge, then
263
+ render the sections and wire the view/theme toggles. */
382
264
  const DATA = JSON.parse(document.getElementById('estimation-data').textContent);
383
265
  document.querySelector('header h1').textContent = DATA.inputs.project;
384
266
  const confLevel = (c) => `conf-${c.toLowerCase()}`;
@@ -397,185 +279,123 @@ if (deliveryLine) {
397
279
  + `${DATA.inputs.agentContext.model}) · Baselines: ${evidenceIds.size} measurements`;
398
280
  }
399
281
 
400
- // Task hours are constants from the estimation data (measured or seeded,
401
- // never recomputed here) — only team/plan capacity and cost are live via
402
- // the what-if rail, same as the committed rollup.
403
- function recompute(p) {
404
- const dev = DATA.computed.devHours;
405
- const buffers = (DATA.computed.riskBufferHours + DATA.computed.spreadBufferHours) * p.bufferScale;
406
- const hours = dev + dev * p.overheadPct + buffers;
407
- return { hours, ...scenarioRollup({ hours, team: p.team, plan: p.plan }) };
408
- }
409
- window.__recompute = recompute;
410
-
411
- function defaultsFromRecommended() {
412
- const rec = DATA.inputs.scenarios.find((s) => s.id === DATA.inputs.recommendedScenario);
413
- return {
414
- team: rec.team.map((m) => ({ ...m })),
415
- plan: rec.plan,
416
- bufferScale: 1,
417
- overheadPct: DATA.inputs.overheadPct,
418
- };
282
+ // Summary: the recommended scenario stated once — team, AI assistance,
283
+ // months, cost — then the committed alternatives as one small table. Every
284
+ // number is read from estimation.json; nothing is recomputed on the page.
285
+ const recScenario = () => DATA.inputs.scenarios.find((s) => s.id === DATA.inputs.recommendedScenario);
286
+ const sameTeam = (a, b) => a.team.length === b.team.length
287
+ && a.team.every((m, i) => m.seniority === b.team[i].seniority && m.rate === b.team[i].rate);
288
+ const byMonths = (a, b) => DATA.computed.scenarios[a.id].months - DATA.computed.scenarios[b.id].months;
289
+
290
+ function scenarioLabel(s) {
291
+ const n = s.team.length;
292
+ const who = n === 1 ? `1 ${s.team[0].seniority} engineer`
293
+ : `${n} engineers (${s.team.map((m) => m.seniority).join(' · ')})`;
294
+ return `${who}, ${s.aiAssisted ? 'AI-assisted' : 'humans unaided'}`;
419
295
  }
420
296
 
421
- // Control ids are assembled at runtime (never one static "ctl-*" literal)
422
- // so the client-only render, which keeps this whole script but drops the
423
- // controls markup, never carries an internal control id as page text.
424
- const CTL_SUFFIX = { plan: 'plan', bufferScale: 'buffer', overheadPct: 'overhead' };
425
- const CTL_KEYS = Object.keys(CTL_SUFFIX);
426
- const ctlId = (key) => `ctl-${CTL_SUFFIX[key]}`;
427
- // The roster container is found by its class — its id is internal-only page
428
- // text, and the class already ships in the head CSS either way.
429
- const teamBox = () => document.querySelector('#controls .team');
430
- const TEAM_MAX = 8;
431
-
432
- function setControls(values) {
433
- CTL_KEYS.forEach((key) => {
434
- const el = document.getElementById(ctlId(key));
435
- if (el) el.value = values[key];
436
- });
437
- }
438
-
439
- function syncOutputs() {
440
- CTL_KEYS.forEach((key) => {
441
- const el = document.getElementById(ctlId(key));
442
- const out = el?.parentElement.querySelector('output');
443
- if (out) out.textContent = el.value;
444
- });
445
- }
446
-
447
- // The committed scenarios are the page's only rate table: the first rate
448
- // seen per seniority re-seeds a row's rate when its level changes.
449
- const RATE_BY_SENIORITY = {};
450
- for (const s of DATA.inputs.scenarios) {
451
- for (const m of s.team) if (m.rate != null) RATE_BY_SENIORITY[m.seniority] ??= m.rate;
452
- }
453
-
454
- function teamRow({ seniority, rate }) {
455
- const row = document.createElement('div');
456
- row.className = 'team-row';
457
- const sel = document.createElement('select');
458
- for (const s of Object.keys(SENIORITY_FACTOR)) sel.add(new Option(s, s));
459
- sel.value = seniority;
460
- const cur = Object.assign(document.createElement('span'), { className: 'cur', textContent: '$' });
461
- const rateEl = Object.assign(document.createElement('input'),
462
- { type: 'number', min: 10, max: 300, step: 5, value: rate });
463
- rateEl.setAttribute('aria-label', 'hourly rate');
464
- const del = Object.assign(document.createElement('button'),
465
- { type: 'button', className: 'team-del', textContent: '×' });
466
- del.setAttribute('aria-label', 'remove engineer');
467
- row.append(sel, cur, rateEl, del);
468
- return row;
469
- }
470
-
471
- function syncTeamButtons() {
472
- const box = teamBox();
473
- const rows = box.querySelectorAll('.team-row');
474
- box.querySelector('.team-add').disabled = rows.length >= TEAM_MAX;
475
- rows.forEach((r) => { r.querySelector('.team-del').disabled = rows.length <= 1; });
476
- }
477
-
478
- // Rebuild-from-array is the only write path (boot, reset), so reset can
479
- // never leave stale rows behind.
480
- function renderTeam(team) {
481
- const box = teamBox();
482
- if (!box) return;
483
- box.replaceChildren(
484
- Object.assign(document.createElement('span'), { textContent: 'team' }),
485
- ...team.map(teamRow),
486
- Object.assign(document.createElement('button'),
487
- { type: 'button', className: 'team-add', textContent: '+ engineer' }),
488
- );
489
- syncTeamButtons();
490
- }
491
-
492
- function currentTeam(defaults) {
493
- const box = teamBox();
494
- if (!box) return defaults.team;
495
- return [...box.querySelectorAll('.team-row')].map((r) => ({
496
- seniority: r.querySelector('select').value,
497
- rate: Number(r.querySelector('input').value),
498
- }));
499
- }
500
-
501
- function currentParams(defaults) {
502
- const p = { team: currentTeam(defaults) };
503
- CTL_KEYS.forEach((key) => {
504
- const raw = document.getElementById(ctlId(key))?.value ?? defaults[key];
505
- p[key] = key === 'plan' ? raw : Number(raw);
506
- });
507
- return p;
297
+ // Signed month and cost deltas against the recommended scenario.
298
+ function deltaText(c, rec) {
299
+ const dm = c.months - rec.months;
300
+ const dc = c.totalCost - rec.totalCost;
301
+ const sign = (v) => (v >= 0 ? '+' : '−');
302
+ return `${sign(dm)}${Math.abs(dm).toFixed(2)} mo · ${sign(dc)}${fmtMoney(Math.abs(dc))}`;
508
303
  }
509
304
 
510
- const fmtMoney = (v) => `$${Math.round(v).toLocaleString()}`;
305
+ function altRow(s, rec) {
306
+ const c = DATA.computed.scenarios[s.id];
307
+ return `<tr><td>${scenarioLabel(s)}</td><td class="num">${c.months.toFixed(2)}</td>
308
+ <td class="num">${fmtMoney(c.totalCost)}</td><td><span class="delta">${deltaText(c, rec)}</span></td></tr>`;
309
+ }
511
310
 
512
- const help = (text) => `<details class="help"><summary aria-label="explain this section">?</summary><p>${text}</p></details>`;
513
- const secHead = (title, text) => `<div class="sec-head"><h2>${title}</h2>${help(text)}</div>`;
311
+ // A same-roster scenario that differs only in AI assistance is one line, not
312
+ // a row: the roster is what a reader chooses between.
313
+ function aiVariantLine(s, rec) {
314
+ const c = DATA.computed.scenarios[s.id];
315
+ return `<p class="meta">${s.aiAssisted ? 'With' : 'Without'} AI assistance: ${c.months.toFixed(2)} months · `
316
+ + `${fmtMoney(c.totalCost)} (${deltaText(c, rec)})</p>`;
317
+ }
514
318
 
515
- function barRow({ label, value, max, text, cls }) {
516
- const pct = max > 0 ? Math.round((value / max) * 100) : 0;
517
- return `<div class="bar-row"><span class="bar-label" title="${label}">${label}</span>
518
- <span class="bar-track"><span class="bar-fill${cls ? ` ${cls}` : ''}" style="width:${pct}%"></span></span>
519
- <span class="bar-val">${text}</span></div>`;
520
- }
521
-
522
- function teamSummary(team) {
523
- const counts = new Map();
524
- for (const m of team) counts.set(m.seniority, (counts.get(m.seniority) ?? 0) + 1);
525
- return [...counts].map(([s, n]) => `${n}&times; ${s}`).join(' &middot; ');
526
- }
527
-
528
- // Derived in-browser from committed numbers, like every bar width on the
529
- // page — never written into the JSON.
530
- function deltaChip(id, s) {
531
- if (id === DATA.inputs.recommendedScenario) return '';
532
- const rec = DATA.computed.scenarios[DATA.inputs.recommendedScenario];
533
- if (!rec) return '';
534
- const dm = s.months - rec.months;
535
- const dc = s.totalCost - rec.totalCost;
536
- return `<span class="delta">${dm >= 0 ? '+' : '-'}${Math.abs(dm).toFixed(2)} mo &middot; `
537
- + `${dc >= 0 ? '+' : '-'}$${Math.round(Math.abs(dc)).toLocaleString()} vs recommended</span>`;
538
- }
539
-
540
- function scenarioCard(id, s) {
541
- const rec = id === DATA.inputs.recommendedScenario;
542
- const input = DATA.inputs.scenarios.find((x) => x.id === id);
543
- const max = Math.max(...Object.values(DATA.computed.scenarios).map((x) => x.months));
544
- return `<article class="card scenario${rec ? ' recommended' : ''}">
545
- ${rec ? '<span class="flag">recommended</span>' : ''}<h3>${id}</h3>
546
- <div class="hero"><div><span class="num">${s.months.toFixed(2)}</span> <span class="unit">months</span></div>
547
- <div class="gauge"><span style="width:${Math.round((s.months / max) * 100)}%"></span></div>
548
- ${deltaChip(id, s)}</div>
549
- <dl class="facts"><div><dt>team</dt><dd>${teamSummary(input.team)}</dd></div>
550
- <div><dt>claude plan</dt><dd>${input.plan}</dd></div>
551
- <div><dt>effort</dt><dd>${s.hours.toFixed(1)}h</dd></div>
552
- <div><dt>total cost</dt><dd>${fmtMoney(s.totalCost)}</dd></div></dl></article>`;
553
- }
554
-
555
- function renderCards() {
556
- const el = document.getElementById('scenario-cards');
557
- if (!el) return;
558
- const entries = Object.entries(DATA.computed.scenarios);
559
- el.innerHTML = secHead('Delivery scenarios',
560
- 'Each card is one committed way to staff and deliver the same scope. Months and cost are '
561
- + 'computed from the same task hours; the highlighted card is the recommended estimate. '
562
- + 'Sandbox variations live in the what-if panel.')
563
- + `<div class="cards">${entries.map(([id, s]) => scenarioCard(id, s)).join('')}</div>`;
319
+ // One sentence, only when an alternative beats the recommendation on both
320
+ // axes — the page must not bury a dominated choice.
321
+ function insightLine(alts, rec) {
322
+ const c = (s) => DATA.computed.scenarios[s.id];
323
+ const win = alts.find((s) => c(s).months < rec.months && c(s).totalCost < rec.totalCost);
324
+ if (!win) return '';
325
+ return `<p class="insight">&#9656; ${scenarioLabel(win)} finishes ${(rec.months - c(win).months).toFixed(2)} months `
326
+ + `sooner for ${fmtMoney(rec.totalCost - c(win).totalCost)} less than the recommended plan.</p>`;
327
+ }
328
+
329
+ function summaryAlts(rec, recC) {
330
+ const others = DATA.inputs.scenarios.filter((s) => s.id !== rec.id);
331
+ if (!others.length) return '';
332
+ const teams = others.filter((s) => !sameTeam(s, rec)).sort(byMonths);
333
+ const variants = others.filter((s) => sameTeam(s, rec)).map((s) => aiVariantLine(s, recC)).join('');
334
+ const table = teams.length ? `<table><caption>Alternatives</caption><thead><tr><th>Team</th>
335
+ <th class="num">Months</th><th class="num">Cost</th><th></th></tr></thead>
336
+ <tbody>${teams.map((s) => altRow(s, recC)).join('')}</tbody></table>` : '';
337
+ const why = DATA.inputs.recommendedReason
338
+ ? `<p class="why">Recommended because ${esc(DATA.inputs.recommendedReason)}.</p>` : '';
339
+ return `<div class="alts" ${INTERNAL_ATTR}>${why}${variants}${table}${insightLine(teams, recC)}</div>`;
340
+ }
341
+
342
+ // The client-facing range from proposal-figures.json, when render.mjs was
343
+ // handed it — the number the client is actually quoted.
344
+ function summaryRange() {
345
+ const f = DATA.figures;
346
+ if (!f?.cost || !f?.months) return '';
347
+ return `<p class="range">range ${f.months.low} – ${f.months.high} months · ${fmtMoney(f.cost.low)} – ${fmtMoney(f.cost.high)}</p>`;
348
+ }
349
+
350
+ function summarySize(recC) {
351
+ const feats = DATA.inputs.features;
352
+ const tasks = feats.reduce((n, f) => n + f.tasks.length, 0);
353
+ const milestones = new Set(feats.map((f) => f.milestone).filter(Boolean)).size;
354
+ const parts = [`${Math.round(recC.hours).toLocaleString()} h`, `${feats.length} features`, `${tasks} tasks`];
355
+ if (milestones) parts.push(`${milestones} milestones`);
356
+ return parts.join(' · ');
564
357
  }
565
358
 
566
- function renderBars() {
567
- const el = document.getElementById('cost-bars');
359
+ function summaryMethod() {
360
+ const feats = DATA.inputs.features;
361
+ const stated = feats.filter((f) => f.provenance === 'stated').length;
362
+ const ctx = DATA.inputs.agentContext;
363
+ return `measurement-based · ${ctx.agent} + ${ctx.model} · scope ${stated}/${feats.length} stated`;
364
+ }
365
+
366
+ function summaryRisks() {
367
+ return `${DATA.inputs.risks.length} risks priced in (${DATA.computed.riskBufferHours} h) · `
368
+ + `${DATA.inputs.assumptions.length} assumptions`;
369
+ }
370
+
371
+ function renderSummary() {
372
+ const el = document.getElementById('summary');
568
373
  if (!el) return;
569
- const entries = Object.entries(DATA.computed.scenarios);
570
- const max = Math.max(...entries.map(([, s]) => s.totalCost));
571
- el.innerHTML = secHead('Total cost by scenario',
572
- 'Labor (months × team rates) plus Claude plan seats, per scenario. Bar lengths are '
573
- + 'proportional to the most expensive scenario.')
574
- + `<div class="bar-group">${entries.map(([id, s]) => barRow({ label: id, value: s.totalCost,
575
- max, text: fmtMoney(s.totalCost),
576
- cls: id === DATA.inputs.recommendedScenario ? 'is-rec' : '' })).join('')}</div>`;
374
+ const rec = recScenario();
375
+ const recC = DATA.computed.scenarios[rec.id];
376
+ el.innerHTML = secHead('Summary',
377
+ 'The recommended way to deliver this scope, stated once: team, months and cost from the '
378
+ + 'committed estimate. Alternatives compare other rosters against it.')
379
+ + `<p class="lead">${scenarioLabel(rec)}</p>
380
+ <p class="figures">${recC.months.toFixed(2)} months<span class="sep">&middot;</span>${fmtMoney(recC.totalCost)}</p>
381
+ ${summaryRange()}
382
+ <p class="meta">${summarySize(recC)}</p>
383
+ <p class="meta">${summaryMethod()}</p>
384
+ <p class="meta">${summaryRisks()}</p>
385
+ ${summaryAlts(rec, recC)}`;
577
386
  }
578
387
 
388
+ const fmtMoney = (v) => `$${Math.round(v).toLocaleString()}`;
389
+
390
+ const help = (text) => `<details class="help"><summary aria-label="explain this section">?</summary><p>${text}</p></details>`;
391
+ const secHead = (title, text) => `<div class="sec-head"><h2>${title}</h2>${help(text)}</div>`;
392
+
393
+
394
+
395
+
396
+
397
+
398
+
579
399
  // Containers and roadmap are generic — they price/visualize hours, never a
580
400
  // task category — so they carry over unchanged. The task table and Evidence
581
401
  // section below are baseline-native: every column comes from a measured or
@@ -681,7 +501,7 @@ function roadmapAxis({ total, ticks }) {
681
501
  }
682
502
 
683
503
  // Committed numbers only: the roadmap draws the recommended scenario as
684
- // computed — the what-if rail owns every live number on this page.
504
+ // computed — nothing on this page recomputes a month or a cost.
685
505
  function renderRoadmap() {
686
506
  const el = document.getElementById('roadmap');
687
507
  if (!el) return;
@@ -830,70 +650,16 @@ function renderMethod() {
830
650
  <span>Buffer machinery — Atomic Object, atomicobject.com/client-resources/better-custom-software-estimates.</span></p></details>`;
831
651
  }
832
652
 
833
- // Live feedback at the point of interaction: the sticky rail is usually on
834
- // screen while the custom card is not, so the rail repeats the custom rollup.
835
- function renderReadout(custom) {
836
- const el = document.getElementById('whatif-readout');
837
- if (!el) return;
838
- el.innerHTML = Number.isFinite(custom.totalCost)
839
- ? `<p class="months"><span class="num">${custom.months.toFixed(2)}</span>months</p>
840
- <dl><div><dt>total cost</dt><dd>${fmtMoney(custom.totalCost)}</dd></div>
841
- <div><dt>effort</dt><dd>${custom.hours.toFixed(1)}h</dd></div></dl>`
842
- : '';
843
- }
844
-
845
- function renderAll(defaults) {
846
- renderCards();
847
- renderBars();
653
+ function renderAll() {
654
+ renderSummary();
848
655
  renderRoadmap();
849
656
  renderContainers();
850
657
  renderDetail();
851
658
  renderEvidence();
852
659
  renderRegister();
853
660
  renderMethod();
854
- renderReadout(recompute(currentParams(defaults)));
855
- }
856
-
857
- const defaults = defaultsFromRecommended();
858
-
859
- function applyDefaults() {
860
- setControls(defaults);
861
- renderTeam(defaults.team);
862
- syncOutputs();
863
- renderAll(defaults);
864
- }
865
- applyDefaults();
866
-
867
- function onWhatIfChange() {
868
- syncOutputs();
869
- renderAll(defaults);
870
- const banner = document.getElementById('modified-banner');
871
- if (banner) banner.hidden = false;
872
661
  }
873
-
874
- CTL_KEYS.forEach((key) => document.getElementById(ctlId(key))?.addEventListener('input', onWhatIfChange));
875
- teamBox()?.addEventListener('input', (e) => {
876
- if (e.target.matches('select')) {
877
- const rate = RATE_BY_SENIORITY[e.target.value];
878
- if (rate != null) e.target.closest('.team-row').querySelector('input').value = rate;
879
- }
880
- onWhatIfChange();
881
- });
882
- teamBox()?.addEventListener('click', (e) => {
883
- if (e.target.matches('.team-add')) {
884
- e.target.before(teamRow(currentTeam(defaults).at(-1)));
885
- } else if (e.target.matches('.team-del')) {
886
- e.target.closest('.team-row').remove();
887
- } else return;
888
- syncTeamButtons();
889
- onWhatIfChange();
890
- });
891
-
892
- document.getElementById('reset')?.addEventListener('click', () => {
893
- applyDefaults();
894
- const banner = document.getElementById('modified-banner');
895
- if (banner) banner.hidden = true;
896
- });
662
+ renderAll();
897
663
 
898
664
  document.getElementById('containers')?.addEventListener('mouseover', onPieHover);
899
665
  document.getElementById('containers')?.addEventListener('mouseout', onPieHover);