@v11g/agents-rock 1.0.8 → 1.0.9
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 +1 -1
- package/package.json +1 -1
- package/plugins/reasoning/.claude-plugin/plugin.json +1 -1
- package/plugins/reasoning/evals/format-handoff-folder/graders/folder-named.md +8 -0
- package/plugins/reasoning/evals/format-handoff-folder/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-handoff-folder/prompt.md +9 -0
- package/plugins/reasoning/evals/format-ids-and-supports/graders/ids-in-chat.md +8 -0
- package/plugins/reasoning/evals/format-ids-and-supports/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-ids-and-supports/graders/supports-resolve.md +11 -0
- package/plugins/reasoning/evals/format-ids-and-supports/prompt.md +8 -0
- package/plugins/reasoning/evals/format-root-candidate-status/graders/candidate-status.md +11 -0
- package/plugins/reasoning/evals/format-root-candidate-status/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-root-candidate-status/prompt.md +8 -0
- package/plugins/reasoning/evals/format-unsaved-continues/graders/analysis-completes.md +9 -0
- package/plugins/reasoning/evals/format-unsaved-continues/graders/not-saved-stated.md +9 -0
- package/plugins/reasoning/evals/format-unsaved-continues/graders/skill-fired.md +7 -0
- package/plugins/reasoning/evals/format-unsaved-continues/prompt.md +8 -0
- package/plugins/reasoning/skills/problem-router/README.md +6 -0
- package/plugins/reasoning/skills/problem-router/SKILL.md +4 -0
- package/plugins/reasoning/skills/problem-router/references/contract.md +114 -19
- package/plugins/reasoning/skills/problem-solving/README.md +6 -0
- package/plugins/reasoning/skills/problem-solving/SKILL.md +2 -0
- package/plugins/reasoning/skills/problem-solving/references/contract.md +114 -19
- package/plugins/reasoning/skills/problem-solving/references/interview.md +2 -0
- package/plugins/reasoning/skills/systemic-design/README.md +3 -0
- package/plugins/reasoning/skills/systemic-design/SKILL.md +2 -0
- package/plugins/reasoning/skills/systemic-design/references/contract.md +114 -19
- package/plugins/reasoning/skills/systemic-design/references/interview.md +2 -0
- package/plugins/reasoning/skills/systems-thinking/README.md +3 -0
- package/plugins/reasoning/skills/systems-thinking/SKILL.md +2 -0
- package/plugins/reasoning/skills/systems-thinking/frameworks/leverage-points.md +15 -6
- package/plugins/reasoning/skills/systems-thinking/references/contract.md +114 -19
- package/plugins/reasoning/skills/systems-thinking/references/interview.md +2 -0
- package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +4 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +16 -1
- package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +9 -0
- package/plugins/solution-architect/skills/estimate/README.md +20 -15
- package/plugins/solution-architect/skills/estimate/SKILL.md +10 -6
- package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +111 -138
- package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +361 -247
- package/plugins/solution-architect/skills/estimate/assets/scores-review-template.html +5 -4
- package/plugins/solution-architect/skills/estimate/evals/evals.json +7 -7
- package/plugins/solution-architect/skills/estimate/references/agentic-estimation.md +4 -2
- package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +38 -82
- package/plugins/solution-architect/skills/estimate/references/interview.md +56 -35
- package/plugins/solution-architect/skills/estimate/references/scoring-guide.md +40 -4
- package/plugins/solution-architect/skills/estimate/references/techniques.md +29 -21
- package/plugins/solution-architect/skills/estimate/references/writing.md +75 -43
- package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +37 -5
- package/plugins/solution-architect/skills/estimate/scripts/lib/context-schema.mjs +35 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +17 -75
- package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +5 -5
- package/plugins/solution-architect/skills/estimate/scripts/lib/pricing.mjs +78 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/project-price.mjs +96 -0
- package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +67 -19
- package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +4 -5
- package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +48 -73
- package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +28 -13
- package/plugins/solution-architect/skills/estimate/scripts/lib/score-csv.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/scripts/lib/score-html.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/scripts/lib/scoring.mjs +2 -2
- package/plugins/solution-architect/skills/estimate/scripts/render.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/scripts/score-review.mjs +1 -1
- package/plugins/solution-architect/skills/estimate/scripts/test/browser-agentic.test.mjs +143 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +209 -50
- package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +57 -32
- package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +52 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +25 -112
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-fail.md +0 -10
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-pass.md +0 -10
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +1 -7
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +11 -10
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +6 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +17 -21
- package/plugins/solution-architect/skills/estimate/scripts/test/pricing.test.mjs +88 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/project-price.test.mjs +93 -0
- package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +86 -24
- package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +185 -31
- package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +114 -61
- package/plugins/solution-architect/skills/estimate/scripts/test/score-review.test.mjs +34 -1
- package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +103 -9
- package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +292 -71
- package/plugins/solution-architect/skills/new-lead/SKILL.md +4 -3
- package/plugins/solution-architect/skills/proposal/README.md +9 -7
- package/plugins/solution-architect/skills/proposal/SKILL.md +10 -7
- package/plugins/solution-architect/skills/proposal/evals/evals.json +29 -11
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/ARCHITECTURE.md +65 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/brief.md +21 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation-inputs.json +126 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation.json +215 -0
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation-inputs.json +224 -34
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.json +103 -114
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.md +48 -22
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation-inputs.json +211 -33
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.json +102 -117
- package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.md +48 -25
- package/plugins/solution-architect/skills/proposal/references/interview.md +3 -6
- package/plugins/solution-architect/skills/proposal/references/review.md +5 -4
- package/plugins/solution-architect/skills/proposal/references/writing.md +33 -31
- package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +5 -22
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +18 -8
- package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +6 -2
- package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +24 -33
- package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +50 -47
- package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +99 -40
- package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +11 -5
- package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +39 -0
- package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +67 -54
- package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +6 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +8 -12
- package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +1 -1
- package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +3 -2
- package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +0 -39
|
@@ -10,11 +10,10 @@ and the exact command sequence from computed numbers to a served page.
|
|
|
10
10
|
|
|
11
11
|
Do not re-derive the shape from prose — read
|
|
12
12
|
`scripts/test/fixtures/booking-inputs.json` and match it field for field:
|
|
13
|
-
top-level `project`, `technique`, `depth`, `calibration`, `
|
|
14
|
-
`
|
|
15
|
-
`
|
|
16
|
-
`
|
|
17
|
-
`m`, `p`, `confidence`, `assumptions`, `provenance`.
|
|
13
|
+
top-level `project`, `technique`, `depth`, `calibration`, `verificationPct`,
|
|
14
|
+
`exposeRatesToClient`, `features` (each with `id`, `name`, `provenance`,
|
|
15
|
+
`tasks`), `risks`, and `assumptions`. Every task carries `id`, `name`,
|
|
16
|
+
`category`, `o`, `m`, `p`, `confidence`, `assumptions`, `provenance`.
|
|
18
17
|
|
|
19
18
|
Add top-level `deliveryMode` — `"agentic"` or `"traditional"` — on every
|
|
20
19
|
estimate you write, even though the field is optional and the booking fixture
|
|
@@ -31,16 +30,39 @@ for a non-technical reader: no file names, factor names or `§`) and a
|
|
|
31
30
|
`scoreProvenance` of `stated` or `proposed`. `schema.mjs` checks the anchor
|
|
32
31
|
against the guide byte for byte. At `QUICK` these fields must be absent.
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
At `STANDARD`/`DEEP`, non-agentic estimates also carry top-level
|
|
34
|
+
`contextLevels` and `contextProvenance` — the five factors from
|
|
35
|
+
`CONTEXT_FACTORS` in `project-price.mjs`: `codebaseMaturity`,
|
|
36
|
+
`stackFamiliarity`, `specQuality`, `compliance`, `clientDecisions`, each an
|
|
37
|
+
integer level 1–4 in `contextLevels`. `contextProvenance` carries one entry
|
|
38
|
+
per factor: `{ "level": <matching contextLevels>, "anchor": "...", "cite":
|
|
39
|
+
"...", "source": "derived"|"stated" }`. The `anchor` is the chosen level's
|
|
40
|
+
definition from the context-factor table in `scoring-guide.md`. Four of the five factors are derived
|
|
41
|
+
from upstream artifacts rather than asked, so each arrives as a proposal
|
|
42
|
+
with its evidence attached, not a silent default, and can be overridden in
|
|
43
|
+
review. `schema.mjs` refuses a factor missing from either object, or whose
|
|
44
|
+
`contextProvenance` level disagrees with `contextLevels`. Both fields are
|
|
45
|
+
skipped at `QUICK` depth and in agentic mode.
|
|
46
|
+
|
|
47
|
+
Optional top-level `recommendedReason` (non-empty string) — free text for
|
|
48
|
+
a judgment call worth explaining to the reader (why AGENTIC over
|
|
49
|
+
TRADITIONAL, why one technique over another, anything else worth a
|
|
50
|
+
sentence). The rendered page shows it verbatim under the summary figures as
|
|
51
|
+
"Approach: …" — not as a recommendation over other options, because there
|
|
52
|
+
are no other options to price. `schema.mjs` neither requires it nor
|
|
53
|
+
validates its content — nothing in `estimation-inputs.json` compares options
|
|
54
|
+
to generate it automatically, so write it only when there is a real call to
|
|
55
|
+
explain.
|
|
56
|
+
`schema.mjs` is the enforced half of this contract (`checkInputs`) — this
|
|
57
|
+
doc is the readable half; if the two ever disagree, the code wins.
|
|
38
58
|
|
|
39
59
|
At `depth: QUICK`, each feature's `tasks` array holds exactly one synthetic
|
|
40
60
|
task carrying the tiering technique's calibration band as its `o`/`m`/`p`
|
|
41
61
|
(mid = the band's midpoint) — see `references/techniques.md` §2. That keeps
|
|
42
62
|
`schema.mjs`'s at-least-one-task rule and `compute.mjs`'s PERT path
|
|
43
|
-
unchanged; QUICK never bypasses the compute pipeline.
|
|
63
|
+
unchanged; QUICK never bypasses the compute pipeline. These calibration
|
|
64
|
+
bands feed task hours for delivery planning only — they never price
|
|
65
|
+
anything; QUICK's price fields stay absent regardless (`techniques.md` §2).
|
|
44
66
|
|
|
45
67
|
Features may each carry an optional `milestone` string (e.g. `"M1 - Booking
|
|
46
68
|
core"`). Milestones are all-or-nothing: if any feature has one, every feature
|
|
@@ -71,25 +93,16 @@ sections, in this order:
|
|
|
71
93
|
| --- | --- | --- | --- |
|
|
72
94
|
| <feature name> | S/M/L | <low>–<high> | stated|proposed |
|
|
73
95
|
|
|
74
|
-
Recommended delivery: <team + AI-assisted summary> — see detail.
|
|
75
|
-
|
|
76
|
-
| Line | Hours |
|
|
77
|
-
| --- | --- |
|
|
78
|
-
| Development | <hours> |
|
|
79
|
-
| Overhead (<pct>%) | <hours> |
|
|
80
|
-
| Risk buffer | <hours> |
|
|
81
|
-
| Estimate-spread buffer | <hours> |
|
|
82
|
-
|
|
83
96
|
### Roadmap
|
|
84
97
|
|
|
85
98
|
(only when features carry milestones — omit the heading entirely otherwise)
|
|
86
99
|
|
|
87
|
-
| Milestone | Features |
|
|
100
|
+
| Milestone | Features | Share |
|
|
88
101
|
| --- | --- | --- |
|
|
89
|
-
| <label> | <feature names> | <
|
|
102
|
+
| <label> | <feature names> | <share>% |
|
|
90
103
|
|
|
91
|
-
|
|
92
|
-
|
|
104
|
+
Bands are relative shares of total effort, not durations. This estimate
|
|
105
|
+
produces no timeline. Ordering: <stated|proposed>.
|
|
93
106
|
|
|
94
107
|
### Assumptions
|
|
95
108
|
|
|
@@ -109,16 +122,23 @@ Technique: <technique name> — <one line on why>.
|
|
|
109
122
|
| --- | --- | --- | --- | --- | --- | --- |
|
|
110
123
|
| <task name> | boilerplate|logic|novel | <o>/<m>/<p> | <e> | HIGH|MED|LOW | <text or "none"> | observed|stated|researched|proposed |
|
|
111
124
|
|
|
112
|
-
###
|
|
125
|
+
### Price
|
|
113
126
|
|
|
114
|
-
|
|
|
115
|
-
| --- | --- |
|
|
116
|
-
|
|
|
127
|
+
| Figure | Value |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| Presented range | <presentLow> – <presentHigh> |
|
|
130
|
+
| If a single number is required | <singleNumber> |
|
|
131
|
+
| Contingency rate | <contingencyRate> |
|
|
132
|
+
| Implied accuracy | <impliedAccuracy> |
|
|
117
133
|
|
|
118
134
|
### Calibration
|
|
119
135
|
|
|
120
|
-
|
|
121
|
-
|
|
136
|
+
State the band's implied rate: divide the tier's price midpoint by the
|
|
137
|
+
hours actually spent on a comparable delivered feature, and confirm that
|
|
138
|
+
blended rate is defensible. Recalibrate the bands against delivered
|
|
139
|
+
actuals roughly twice a year. Whatever AI leverage the team has is priced
|
|
140
|
+
into the bands already — it is never shown as a client-visible discount;
|
|
141
|
+
it becomes margin instead, and that is deliberate.
|
|
122
142
|
```
|
|
123
143
|
|
|
124
144
|
## 3. Contract rules
|
|
@@ -133,11 +153,12 @@ Structure:
|
|
|
133
153
|
2. Summary must contain an `### Out of scope` heading.
|
|
134
154
|
3. Summary must contain an `### Assumptions` heading whose table has at
|
|
135
155
|
least one row.
|
|
136
|
-
4.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
4. Estimation detail must contain a line matching `/calibration/i`.
|
|
157
|
+
5. The document must not contain a table with a `Scenario` column — the
|
|
158
|
+
price block replaces it (`checkPrice` in `scripts/lib/checks.mjs`).
|
|
159
|
+
6. `computed.price.presentLow` and `presentHigh` must both appear in the
|
|
160
|
+
document as formatted numbers (`Number.toLocaleString('en-US')`) — skipped
|
|
161
|
+
when `computed.price.p50` is `0` (agentic deliverables carry no price).
|
|
141
162
|
|
|
142
163
|
Row-level, on the task table (found by header, needs `Task`, `Confidence`,
|
|
143
164
|
`Assumptions`, `src` columns):
|
|
@@ -175,11 +196,19 @@ Roadmap (mirrors `checkRoadmap` in `scripts/lib/checks.mjs`):
|
|
|
175
196
|
14. Inputs carry milestones → Summary must contain a `### Roadmap` heading
|
|
176
197
|
with a table of at least one row; no milestones → the heading must be
|
|
177
198
|
absent.
|
|
178
|
-
15. The Roadmap section must contain a line matching `/
|
|
179
|
-
— the bands claim
|
|
180
|
-
16. Band numbers come from
|
|
181
|
-
|
|
182
|
-
|
|
199
|
+
15. The Roadmap section must contain a line matching `/relative shares/i`
|
|
200
|
+
— the bands claim relative shares of effort, never durations.
|
|
201
|
+
16. Band numbers come from `computed.roadmap` — covered by the recompute
|
|
202
|
+
rule 12, same as every other number.
|
|
203
|
+
|
|
204
|
+
Deep estimates (mirrors `checkDeepEstimates` in `scripts/lib/checks.mjs`):
|
|
205
|
+
|
|
206
|
+
17. A feature whose `computed.features[<id>].flag` starts with `Deep
|
|
207
|
+
estimate` or `SPLIT` needs either a real task breakdown (two or more
|
|
208
|
+
`inputs` `tasks` — one task is not a breakdown, and every feature
|
|
209
|
+
already has one) or a `deepEstimateWaiver` — a non-empty string
|
|
210
|
+
naming why the band price stands without one (`schema.mjs` refuses a
|
|
211
|
+
bare `true`). Neither present is refused.
|
|
183
212
|
|
|
184
213
|
## 3b. Agentic deliverable additions
|
|
185
214
|
|
|
@@ -202,10 +231,13 @@ skeleton with these additions (mirror
|
|
|
202
231
|
`computed.tasks[*].evidence` — the validator refuses an evidence row whose
|
|
203
232
|
id isn't script-matched, or whose minutes cell doesn't match the matched
|
|
204
233
|
record, so never invent, hand-add, or alter a history row.
|
|
205
|
-
- **Risks table** —
|
|
206
|
-
|
|
207
|
-
Reason`. Every
|
|
208
|
-
|
|
234
|
+
- **Risks table** — `### Risks`, required in the agentic template (mirror
|
|
235
|
+
`agentic-estimation-pass.md` §Risks): `Risk | Probability | Impact (min) |
|
|
236
|
+
Reason`. Every row needs all four cells — `schema.mjs` requires `reason`
|
|
237
|
+
on agentic risks specifically. Team mode's own §2 skeleton carries no
|
|
238
|
+
equivalent section today; `risks` is a required top-level input either
|
|
239
|
+
way (§1), but nothing requires `reason` on a team-mode risk, and nothing
|
|
240
|
+
requires team mode's `estimation.md` to surface the risk register at all.
|
|
209
241
|
- **Calibration nudge** — when any task is UNCALIBRATED or low-sample, the
|
|
210
242
|
detail section's calibration line should point at recording actuals to
|
|
211
243
|
close the loop (see `docs/requirements/record-task.md` — the capture
|
|
@@ -19,9 +19,6 @@ function checkStructure(md) {
|
|
|
19
19
|
if (!/^###?\s*Out of scope\b/im.test(summary ?? '')) out.push('Out of scope heading missing from Summary');
|
|
20
20
|
const assumptionRows = tables(heading(md, 'Assumptions')).flatMap((t) => t.rows);
|
|
21
21
|
if (assumptionRows.length < 1) out.push('assumptions register is empty (### Assumptions needs >= 1 row)');
|
|
22
|
-
if (!/\|.*buffer.*\|/i.test(summary ?? '')) out.push('no buffer line item found in Summary (/buffer/i)');
|
|
23
|
-
const scenarioTable = tables(detail ?? '').find((t) => t.header.includes('Scenario'));
|
|
24
|
-
if (!scenarioTable || scenarioTable.rows.length < 1) out.push('scenario comparison table missing or empty');
|
|
25
22
|
if (!/calibration/i.test(detail ?? '')) out.push('no calibration line found in Estimation detail');
|
|
26
23
|
return out;
|
|
27
24
|
}
|
|
@@ -65,8 +62,41 @@ function checkRoadmap(md, estimation, out) {
|
|
|
65
62
|
}
|
|
66
63
|
if (section === null) { out.push('missing ### Roadmap section (inputs carry milestones)'); return; }
|
|
67
64
|
if (tables(section).flatMap((t) => t.rows).length < 1) out.push('roadmap table is empty');
|
|
68
|
-
if (!/
|
|
69
|
-
out.push('roadmap must state bands are relative
|
|
65
|
+
if (!/relative shares/i.test(section)) {
|
|
66
|
+
out.push('roadmap must state bands are relative shares, not durations');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The scenario table priced a team; there is no team any more. Leaving it in
|
|
71
|
+
// a document would show a cost nothing computed.
|
|
72
|
+
const SCENARIO_HEADER = /\|\s*Scenario\s*\|/i;
|
|
73
|
+
|
|
74
|
+
export function checkPrice(md, estimation, out) {
|
|
75
|
+
if (!estimation.computed.price || estimation.computed.price.p50 === 0) return;
|
|
76
|
+
if (SCENARIO_HEADER.test(md)) out.push('the scenario table was removed — show the price block instead');
|
|
77
|
+
const { presentLow, presentHigh } = estimation.computed.price;
|
|
78
|
+
for (const n of [presentLow, presentHigh]) {
|
|
79
|
+
if (!md.includes(n.toLocaleString('en-US'))) {
|
|
80
|
+
out.push(`presented range bound ${n.toLocaleString('en-US')} missing from the document`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// v2's flag column is the handoff to the deep pass. A flagged feature that
|
|
86
|
+
// nobody broke down and nobody waived is the one failure mode this whole
|
|
87
|
+
// model has, so it is refused rather than reported. schema.mjs already makes
|
|
88
|
+
// every feature carry one task, so one task is not a breakdown — two are.
|
|
89
|
+
const DEEP_MIN_TASKS = 2;
|
|
90
|
+
|
|
91
|
+
export function checkDeepEstimates(estimation, out) {
|
|
92
|
+
const byId = new Map((estimation.inputs.features ?? []).map((f) => [f.id, f]));
|
|
93
|
+
for (const [id, row] of Object.entries(estimation.computed.features ?? {})) {
|
|
94
|
+
if (!/^Deep estimate|^SPLIT/.test(row.flag ?? '')) continue;
|
|
95
|
+
const feature = byId.get(id);
|
|
96
|
+
if (typeof feature?.deepEstimateWaiver === 'string' && feature.deepEstimateWaiver.trim()) continue;
|
|
97
|
+
if (!((feature?.tasks?.length ?? 0) >= DEEP_MIN_TASKS)) {
|
|
98
|
+
out.push(`feature ${id}: flagged "${row.flag}" but has fewer than ${DEEP_MIN_TASKS} tasks and no deepEstimateWaiver`);
|
|
99
|
+
}
|
|
70
100
|
}
|
|
71
101
|
}
|
|
72
102
|
|
|
@@ -105,6 +135,8 @@ function checkNumbers(estimation) {
|
|
|
105
135
|
export function checkDeliverables({ md, estimation }) {
|
|
106
136
|
const out = [...checkStructure(md), ...checkRows(md, estimation), ...checkNumbers(estimation)];
|
|
107
137
|
checkRoadmap(md, estimation, out);
|
|
138
|
+
checkPrice(md, estimation, out);
|
|
139
|
+
checkDeepEstimates(estimation, out);
|
|
108
140
|
out.push(...scoringFindings({ md, estimation }));
|
|
109
141
|
if (estimation.inputs.deliveryMode === 'agentic') out.push(...agenticFindings({ md, estimation }));
|
|
110
142
|
return out;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// The five project-wide context factors from Estimator v2's roll-up. Each
|
|
2
|
+
// carries its level plus the provenance the score factors already carry, so
|
|
3
|
+
// a derived level arrives as a proposal with its evidence attached and can
|
|
4
|
+
// be overridden in review — never as a silent default.
|
|
5
|
+
import { CONTEXT_FACTORS } from './project-price.mjs';
|
|
6
|
+
|
|
7
|
+
const SOURCES = ['derived', 'stated'];
|
|
8
|
+
const nonEmpty = (v) => typeof v === 'string' && v.trim() !== '';
|
|
9
|
+
const FACTORS = Object.keys(CONTEXT_FACTORS);
|
|
10
|
+
|
|
11
|
+
function checkOne(key, { level, prov }, out) {
|
|
12
|
+
if (!(Number.isInteger(level) && level >= 1 && level <= 4)) {
|
|
13
|
+
out.push(`contextLevels.${key}: must be an integer 1-4`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (typeof prov !== 'object' || prov === null) { out.push(`contextProvenance.${key}: required`); return; }
|
|
17
|
+
if (prov.level !== level) {
|
|
18
|
+
out.push(`contextProvenance.${key}: level ${prov.level} disagrees with contextLevels.${key} = ${level}`);
|
|
19
|
+
}
|
|
20
|
+
if (!nonEmpty(prov.anchor)) out.push(`contextProvenance.${key}: anchor is required`);
|
|
21
|
+
if (!nonEmpty(prov.cite)) out.push(`contextProvenance.${key}: cite is required`);
|
|
22
|
+
if (!SOURCES.includes(prov.source)) out.push(`contextProvenance.${key}: source must be derived|stated`);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// QUICK never persists scores, and agentic runs carry no feature scores by
|
|
26
|
+
// design (scoring-schema.mjs's checkScoring returns early for the same
|
|
27
|
+
// deliveryMode). With no score to scale, demanding five levels, anchors and
|
|
28
|
+
// cites would make a human justify multipliers applied to zero — one rule
|
|
29
|
+
// for "this run is not score-priced", not two that could disagree.
|
|
30
|
+
export function checkContext(inputs, out) {
|
|
31
|
+
if (inputs.depth === 'QUICK' || inputs.deliveryMode === 'agentic') return;
|
|
32
|
+
const levels = inputs.contextLevels ?? {};
|
|
33
|
+
const prov = inputs.contextProvenance ?? {};
|
|
34
|
+
for (const key of FACTORS) checkOne(key, { level: levels[key], prov: prov[key] }, out);
|
|
35
|
+
}
|
|
@@ -1,89 +1,31 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
|
|
1
|
+
// What survives of the hours model after pricing moved to scores: PERT for
|
|
2
|
+
// task sizing, and the milestone shares the roadmap is drawn from. Nothing
|
|
3
|
+
// here converts hours to money or to months — price comes from pricing.mjs
|
|
4
|
+
// and project-price.mjs, and duration is deliberately not produced at all.
|
|
5
|
+
|
|
6
|
+
// Kept as a vocabulary, not as math: schema.mjs validates task.category
|
|
7
|
+
// against it and the Task Breakdown tab shows it. It no longer discounts
|
|
8
|
+
// anything, because nothing converts hours to money.
|
|
6
9
|
export const AI_CATEGORIES = {
|
|
7
10
|
boilerplate: { min: 0.5, max: 0.8 },
|
|
8
11
|
logic: { min: 0.2, max: 0.4 },
|
|
9
12
|
novel: { min: 0.0, max: 0.1 },
|
|
10
13
|
};
|
|
11
|
-
export const SENIORITY_FACTOR = { junior: 1.15, mid: 1.0, senior: 0.85 };
|
|
12
|
-
export const HOURS_PER_MONTH = 140;
|
|
13
|
-
export const COORDINATION_TAX = 0.10;
|
|
14
|
-
// The team workbook's tier scale (its sheet-1 formula and Tier Reference tab):
|
|
15
|
-
// one scale for the interview, the validator, the page and the xlsx export.
|
|
16
|
-
export const TIER_BREAKS = [
|
|
17
|
-
{ max: 11, tier: 'S' }, { max: 17, tier: 'M' }, { max: 22, tier: 'L' }, { max: Infinity, tier: 'XL' },
|
|
18
|
-
];
|
|
19
14
|
|
|
20
15
|
export function pert({ o, m, p }) {
|
|
21
16
|
return { e: (o + 4 * m + p) / 6, sigma: (p - o) / 6 };
|
|
22
17
|
}
|
|
23
18
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export function tierFor(scores) {
|
|
29
|
-
const total = Object.values(scores).reduce((a, b) => a + b, 0);
|
|
30
|
-
return { total, tier: TIER_BREAKS.find((b) => total <= b.max).tier };
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const clampRed = (r) => Math.min(Math.max(r, 0), 0.9);
|
|
34
|
-
|
|
35
|
-
export function aiAdjust({ e, category, verificationPct, scale = 1 }) {
|
|
36
|
-
const { min, max } = AI_CATEGORIES[category];
|
|
37
|
-
const red = clampRed(((min + max) / 2) * scale);
|
|
38
|
-
const redMax = clampRed(max * scale);
|
|
39
|
-
const [tr, ar, ao] = [e, e * (1 - red), e * (1 - redMax)];
|
|
40
|
-
return ((ao + 2 * ar + tr) / 4) * (1 + verificationPct);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Seniority scales the base effort on every path; the AI reduction is a
|
|
44
|
-
// property of the task category alone. Scaling the reduction by seniority
|
|
45
|
-
// instead made juniors come out faster than seniors on AI plans.
|
|
46
|
-
export function taskHours({ e, seniority, aiAssisted, category, verificationPct, scale = 1 }) {
|
|
47
|
-
const base = e * SENIORITY_FACTOR[seniority];
|
|
48
|
-
return aiAssisted ? aiAdjust({ e: base, category, verificationPct, scale }) : base;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// One seniority drives effort for a whole team: the most common level wins,
|
|
52
|
-
// ties go to the more senior. Rank comes from the factor values themselves
|
|
53
|
-
// (more senior = lower factor), never from key order. Lives here (not
|
|
54
|
-
// rollup.mjs) so the inlined bundle hands the page the same function the
|
|
55
|
-
// committed rollup uses.
|
|
56
|
-
export const dominantSeniority = (team) => Object.keys(SENIORITY_FACTOR)
|
|
57
|
-
.sort((a, b) => SENIORITY_FACTOR[a] - SENIORITY_FACTOR[b])
|
|
58
|
-
.map((level) => [level, team.filter((m) => m.seniority === level).length])
|
|
59
|
-
.reduce((best, cur) => (cur[1] > best[1] ? cur : best))[0];
|
|
60
|
-
|
|
61
|
-
export function riskBufferHours(risks) {
|
|
62
|
-
return risks.reduce((sum, r) => sum + r.probability * r.impactHours, 0);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export function effectiveCapacity(engineers) {
|
|
66
|
-
return Math.max(1, engineers * (1 - COORDINATION_TAX * (engineers - 1)));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Tooling is priced per seat per month, vendor-neutral. A null seat cost is
|
|
70
|
-
// a recorded gap (the schema demands an assumption for it) and prices as 0.
|
|
71
|
-
export function scenarioRollup({ hours, team, toolingCostPerSeat }) {
|
|
72
|
-
const months = hours / (effectiveCapacity(team.length) * HOURS_PER_MONTH);
|
|
73
|
-
const laborCost = months * team.reduce((sum, t) => sum + t.rate * HOURS_PER_MONTH, 0);
|
|
74
|
-
const toolingCost = months * (toolingCostPerSeat ?? 0) * team.length;
|
|
75
|
-
return { months, laborCost, toolingCost, totalCost: laborCost + toolingCost };
|
|
19
|
+
// Shared money/hours rounding. Lives here (not rollup.mjs) so roadmap.mjs can
|
|
20
|
+
// import it too without rollup.mjs <-> roadmap.mjs becoming a cycle.
|
|
21
|
+
export function round2(n) {
|
|
22
|
+
return Math.round(n * 100) / 100;
|
|
76
23
|
}
|
|
77
24
|
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
export function roadmapBands({ milestones
|
|
25
|
+
// Milestone widths as shares of total task hours. Seniority and the
|
|
26
|
+
// verification percentage were uniform multipliers and cancelled out of
|
|
27
|
+
// these ratios exactly, which is why dropping them moves no boundary.
|
|
28
|
+
export function roadmapBands({ milestones }) {
|
|
82
29
|
const total = milestones.reduce((sum, m) => sum + m.hours, 0);
|
|
83
|
-
|
|
84
|
-
return milestones.map((m) => {
|
|
85
|
-
const startMonths = at;
|
|
86
|
-
at += total > 0 ? (m.hours / total) * months : 0;
|
|
87
|
-
return { name: m.name, startMonths, endMonths: at };
|
|
88
|
-
});
|
|
30
|
+
return milestones.map((m) => ({ name: m.name, share: total > 0 ? m.hours / total : 0 }));
|
|
89
31
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// The
|
|
1
|
+
// The pricing module is written once as ESM and shipped twice: imported by
|
|
2
2
|
// compute.mjs, and inlined into a page as a plain script. Only the score
|
|
3
|
-
// review page needs any of it — score-html.mjs extracts
|
|
4
|
-
// tierFor so the page can re-tier an edited row —
|
|
5
|
-
// by name, never the whole module.
|
|
3
|
+
// review page needs any of it — score-html.mjs extracts WEIGHTS, BANDS,
|
|
4
|
+
// weightedScore, bandFor and tierFor so the page can re-tier an edited row —
|
|
5
|
+
// so the extraction is by name, never the whole module.
|
|
6
6
|
export function inlineModule(src) {
|
|
7
7
|
return src.replaceAll(/^export /gm, '');
|
|
8
8
|
}
|
|
@@ -12,7 +12,7 @@ export function stripInternal(html) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// Anchors on `export const NAME` / `export function NAME` at line start, the
|
|
15
|
-
// declaration shapes
|
|
15
|
+
// declaration shapes pricing.mjs uses throughout.
|
|
16
16
|
export function extractExports(src, names) {
|
|
17
17
|
const starts = [...src.matchAll(/^export (?:const|function) (\w+)/gm)];
|
|
18
18
|
return starts
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Per-feature pricing, transcribed from Estimator v2's Ballpark Estimator
|
|
2
|
+
// sheet. Size is deliberately the lightest weight and uncertainty the
|
|
3
|
+
// heaviest: in agent-assisted delivery, volume of code is cheap and unclear
|
|
4
|
+
// requirements are not. Bands are continuous — each band's price high is the
|
|
5
|
+
// next band's price low — which is what removes the tier cliff v1 had.
|
|
6
|
+
|
|
7
|
+
export const WEIGHTS = { tech: 0.20, size: 0.10, deps: 0.20, unc: 0.30, risk: 0.20 };
|
|
8
|
+
|
|
9
|
+
export const BANDS = [
|
|
10
|
+
{ tier: 'S', start: 5, end: 11.5, priceLow: 500, priceHigh: 1500 },
|
|
11
|
+
{ tier: 'M', start: 11.5, end: 17.5, priceLow: 1500, priceHigh: 4000 },
|
|
12
|
+
{ tier: 'L', start: 17.5, end: 22.5, priceLow: 4000, priceHigh: 10000 },
|
|
13
|
+
{ tier: 'XL', start: 22.5, end: 25, priceLow: 10000, priceHigh: 25000 },
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export const MODEL_PARAMS = {
|
|
17
|
+
baseSpread: 0.15,
|
|
18
|
+
perUncertaintyPoint: 0.07,
|
|
19
|
+
perRiskPoint: 0.03,
|
|
20
|
+
deepEstimateAbove: 6000,
|
|
21
|
+
deepEstimateSpread: 0.4,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export function weightedScore(scores) {
|
|
25
|
+
return Object.keys(WEIGHTS).reduce((sum, k) => sum + scores[k] * WEIGHTS[k], 0) * 5;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// v2 uses MATCH(score, band starts, 1): the last band whose start is at or
|
|
29
|
+
// below the score. A score exactly on a boundary therefore takes the upper
|
|
30
|
+
// band, and anything at or above the final start stays XL.
|
|
31
|
+
export function bandFor(score) {
|
|
32
|
+
return BANDS.reduce((best, b) => (score >= b.start ? b : best), BANDS[0]);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function pointEstimate(score) {
|
|
36
|
+
const b = bandFor(Math.min(score, BANDS[BANDS.length - 1].end));
|
|
37
|
+
const through = (Math.min(score, b.end) - b.start) / (b.end - b.start);
|
|
38
|
+
return b.priceLow + through * (b.priceHigh - b.priceLow);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function spreadFor({ unc, risk }, params = MODEL_PARAMS) {
|
|
42
|
+
return params.baseSpread
|
|
43
|
+
+ Math.max(0, unc - 1) * params.perUncertaintyPoint
|
|
44
|
+
+ Math.max(0, risk - 1) * params.perRiskPoint;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function flagFor({ score, point, spread, size }, params) {
|
|
48
|
+
const xl = BANDS[BANDS.length - 1].start;
|
|
49
|
+
if (score >= xl && size === 5) return 'SPLIT into sub-features';
|
|
50
|
+
if (score >= xl) return 'Deep estimate required';
|
|
51
|
+
if (spread >= params.deepEstimateSpread) return 'Deep estimate recommended';
|
|
52
|
+
if (point >= params.deepEstimateAbove) return 'Deep estimate recommended';
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function featurePrice(scores, params = MODEL_PARAMS) {
|
|
57
|
+
const score = weightedScore(scores);
|
|
58
|
+
const point = pointEstimate(score);
|
|
59
|
+
const spread = spreadFor(scores, params);
|
|
60
|
+
return {
|
|
61
|
+
score,
|
|
62
|
+
tier: bandFor(score).tier,
|
|
63
|
+
point,
|
|
64
|
+
spread,
|
|
65
|
+
low: point * (1 - spread),
|
|
66
|
+
high: point * (1 + spread),
|
|
67
|
+
flag: flagFor({ score, point, spread, size: scores.size }, params),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// The score review page re-tiers an edited row in the browser and groups
|
|
72
|
+
// rows by identical total, so the total is rounded here rather than at each
|
|
73
|
+
// call site — float noise would split two identically scored features into
|
|
74
|
+
// separate groups.
|
|
75
|
+
export function tierFor(scores) {
|
|
76
|
+
const total = Math.round(weightedScore(scores) * 100) / 100;
|
|
77
|
+
return { total, tier: bandFor(total).tier };
|
|
78
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Estimator v2's Project Roll-up sheet. Feature build effort is roughly half
|
|
2
|
+
// of a project; everything here is the other half. Context factors combine
|
|
3
|
+
// additively (1 + the sum of the deviations) because multiplying five
|
|
4
|
+
// factors together produces numbers nobody can defend.
|
|
5
|
+
|
|
6
|
+
export const CONTEXT_FACTORS = {
|
|
7
|
+
codebaseMaturity: [1.0, 1.1, 1.2, 1.45],
|
|
8
|
+
stackFamiliarity: [1.0, 1.15, 1.35, 1.35],
|
|
9
|
+
specQuality: [0.95, 1.0, 1.2, 1.45],
|
|
10
|
+
compliance: [1.0, 1.15, 1.4, 1.4],
|
|
11
|
+
clientDecisions: [1.0, 1.1, 1.25, 1.4],
|
|
12
|
+
};
|
|
13
|
+
export const CONTEXT_CAP = 2.5;
|
|
14
|
+
|
|
15
|
+
export const OVERHEADS = {
|
|
16
|
+
foundation: 0.12, discovery: 0.06, ux: 0.08, qa: 0.08,
|
|
17
|
+
devops: 0.05, docs: 0.03, pm: 0.10,
|
|
18
|
+
};
|
|
19
|
+
export const INTEGRATION = { perFeature: 0.02, cap: 0.25 };
|
|
20
|
+
export const CONTINGENCY = { base: 0.05, perUncertaintyPoint: 0.02, perRiskPoint: 0.02 };
|
|
21
|
+
export const ROUNDING = 500;
|
|
22
|
+
const Z = { p20: -0.84, p80: 0.84, p95: 1.645 };
|
|
23
|
+
|
|
24
|
+
// A level outside 1-4, or absent, prices as 1.0 — v2's IFERROR(INDEX(..),1).
|
|
25
|
+
const multiplierFor = (mults, level) => mults[level - 1] ?? 1;
|
|
26
|
+
|
|
27
|
+
export function contextMultiplier(levels, factors = CONTEXT_FACTORS, cap = CONTEXT_CAP) {
|
|
28
|
+
const deviations = Object.entries(factors)
|
|
29
|
+
.reduce((sum, [k, mults]) => sum + (multiplierFor(mults, levels[k]) - 1), 0);
|
|
30
|
+
return Math.min(cap, 1 + deviations);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function overheadFor(featureCount, lines = OVERHEADS, integration = INTEGRATION) {
|
|
34
|
+
const all = { ...lines, integration: Math.min(integration.cap, integration.perFeature * featureCount) };
|
|
35
|
+
return { lines: all, totalPct: Object.values(all).reduce((a, b) => a + b, 0) };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function contingencyRate({ avgUnc, avgRisk }, params = CONTINGENCY) {
|
|
39
|
+
return params.base + avgUnc * params.perUncertaintyPoint + avgRisk * params.perRiskPoint;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const mean = (xs) => (xs.length ? xs.reduce((a, b) => a + b, 0) / xs.length : 0);
|
|
43
|
+
const ceilTo = (n, step) => Math.ceil(n / step) * step;
|
|
44
|
+
|
|
45
|
+
// The percentile spread and its rounded, client-facing presentation. All seven
|
|
46
|
+
// fields derive from p50, sigma and the rounding step alone — nothing else
|
|
47
|
+
// projectPrice computes feeds them — which is what makes this a clean seam.
|
|
48
|
+
function percentileBlock(p50, sigma, rounding) {
|
|
49
|
+
return {
|
|
50
|
+
p20: p50 + Z.p20 * sigma,
|
|
51
|
+
p80: p50 + Z.p80 * sigma,
|
|
52
|
+
p95: p50 + Z.p95 * sigma,
|
|
53
|
+
presentLow: ceilTo(p50, rounding),
|
|
54
|
+
presentHigh: ceilTo(p50 + Z.p95 * sigma, rounding),
|
|
55
|
+
singleNumber: ceilTo(p50 + Z.p80 * sigma, rounding),
|
|
56
|
+
impliedAccuracy: p50 === 0 ? 0 : sigma / p50,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The money arithmetic: points through p50 — context, overheads, contingency.
|
|
61
|
+
// Split out purely to hold projectPrice under the function-length gate; it
|
|
62
|
+
// has no meaning of its own outside that one caller.
|
|
63
|
+
function moneyArithmetic(features, levels) {
|
|
64
|
+
const featurePoints = features.reduce((sum, f) => sum + f.point, 0);
|
|
65
|
+
const multiplier = contextMultiplier(levels);
|
|
66
|
+
const adjustedBase = featurePoints * multiplier;
|
|
67
|
+
const { lines, totalPct } = overheadFor(features.length);
|
|
68
|
+
const overheadAmount = adjustedBase * totalPct;
|
|
69
|
+
const rate = contingencyRate({
|
|
70
|
+
avgUnc: mean(features.map((f) => f.unc)), avgRisk: mean(features.map((f) => f.risk)),
|
|
71
|
+
});
|
|
72
|
+
const contingencyAmount = (adjustedBase + overheadAmount) * rate;
|
|
73
|
+
const p50 = adjustedBase + overheadAmount + contingencyAmount;
|
|
74
|
+
return {
|
|
75
|
+
featurePoints, multiplier, adjustedBase, lines, totalPct, overheadAmount, rate, contingencyAmount, p50,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function projectPrice({ features, levels, rounding = ROUNDING }) {
|
|
80
|
+
const {
|
|
81
|
+
featurePoints, multiplier, adjustedBase, lines, totalPct, overheadAmount, rate, contingencyAmount, p50,
|
|
82
|
+
} = moneyArithmetic(features, levels);
|
|
83
|
+
const buildSigma = Math.sqrt(features.reduce((sum, f) => sum + (f.point * f.spread) ** 2, 0));
|
|
84
|
+
const sigma = featurePoints === 0 ? 0 : buildSigma * p50 / featurePoints;
|
|
85
|
+
return {
|
|
86
|
+
featurePoints,
|
|
87
|
+
contextMultiplier: multiplier,
|
|
88
|
+
adjustedBase,
|
|
89
|
+
overheads: { lines, totalPct, amount: overheadAmount },
|
|
90
|
+
contingencyRate: rate,
|
|
91
|
+
contingencyAmount,
|
|
92
|
+
p50,
|
|
93
|
+
sigma,
|
|
94
|
+
...percentileBlock(p50, sigma, rounding),
|
|
95
|
+
};
|
|
96
|
+
}
|