@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
@@ -3,7 +3,7 @@
3
3
  // currently visible rows, and keeps every tier/price formula live in-cell.
4
4
  import { test } from 'node:test';
5
5
  import assert from 'node:assert/strict';
6
- import { mkdtempSync } from 'node:fs';
6
+ import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs';
7
7
  import { execFileSync } from 'node:child_process';
8
8
  import { tmpdir } from 'node:os';
9
9
  import { join } from 'node:path';
@@ -15,11 +15,11 @@ import { readZip } from './zip.mjs';
15
15
  const skip = { skip: !findChrome() && 'no chrome on PATH' };
16
16
  const fixture = new URL('./fixtures/booking-inputs.json', import.meta.url).pathname;
17
17
 
18
- function buildPage() {
18
+ function buildPage(inputsPath = fixture) {
19
19
  const dir = mkdtempSync(join(tmpdir(), 'estimate-xlsx-'));
20
20
  const scripts = new URL('..', import.meta.url).pathname;
21
21
  const passMd = join(scripts, 'test/fixtures/estimation-pass.md');
22
- execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', fixture, '--out', join(dir, 'estimation.json')]);
22
+ execFileSync('node', [join(scripts, 'compute.mjs'), '--inputs', inputsPath, '--out', join(dir, 'estimation.json')]);
23
23
  execFileSync('node', [join(scripts, 'render.mjs'), '--json', join(dir, 'estimation.json'), '--md', passMd, '--out', dir]);
24
24
  return pathToFileURL(join(dir, 'estimate.html')).href;
25
25
  }
@@ -30,17 +30,19 @@ async function exportedFiles(page) {
30
30
  }
31
31
 
32
32
  const sheet1 = (files) => files.get('xl/worksheets/sheet1.xml').toString('utf8');
33
- const cell = (xml, ref) => new RegExp(`<c r="${ref}"[^>]*>(.*?)</c>`, 's').exec(xml)?.[1] ?? '';
33
+ const cell = (xml, ref) => new RegExp(`<c r="${ref}"[^>]*?(?:/>|>(.*?)</c>)`, 's').exec(xml)?.[1] ?? '';
34
34
  const inlineText = (frag) => /<t[^>]*>([^<]*)<\/t>/.exec(frag)?.[1];
35
35
  const cellNumber = (frag) => Number(/<v>([^<]*)<\/v>/.exec(frag)?.[1]);
36
36
  const cellFormula = (frag) => /<f>([^<]*)<\/f>/.exec(frag)?.[1];
37
37
 
38
- test('the breakdown filter bar carries an internal-only download button', skip, async () => {
38
+ // The workbook carries a Task Breakdown sheet and a Score Rationale sheet, so
39
+ // the export answers for the whole section rather than for either tab.
40
+ test('the section heading carries an internal-only download button', skip, async () => {
39
41
  const page = await openPage(buildPage());
40
42
  try {
41
43
  assert.ok(await page.eval(
42
- `!!document.querySelector('#feature-table .bd-filters button[data-download][data-internal]')`),
43
- 'expected a data-download button marked data-internal in the filter bar');
44
+ `!!document.querySelector('#feature-table .sec-head button[data-download][data-internal]')`),
45
+ 'expected a data-download button marked data-internal on the section heading');
44
46
  } finally { page.close(); }
45
47
  });
46
48
 
@@ -58,35 +60,111 @@ test('the export clones the sample workbook with its guide tabs intact', skip, a
58
60
  } finally { page.close(); }
59
61
  });
60
62
 
61
- test('rows land as inline strings ordered by milestone with derived 1-5 scores', skip, async () => {
63
+ test('rows land ordered by milestone with the interview scores verbatim', skip, async () => {
62
64
  const page = await openPage(buildPage());
63
65
  try {
64
66
  const xml = sheet1(await exportedFiles(page));
65
- // M1 feature before M2 feature regardless of the table's hour sort
66
67
  assert.equal(inlineText(cell(xml, 'A7')), 'User can book appointment');
67
68
  assert.equal(inlineText(cell(xml, 'A8')), 'Email reminders');
68
- for (const row of [7, 8]) {
69
- for (const col of ['B', 'C', 'D', 'E', 'F']) {
70
- const v = cellNumber(cell(xml, `${col}${row}`));
71
- assert.ok(Number.isInteger(v) && v >= 1 && v <= 5, `${col}${row} must be 1-5, got ${v}`);
72
- }
73
- }
69
+ assert.deepEqual(['B', 'C', 'D', 'E', 'F'].map((c) => cellNumber(cell(xml, `${c}7`))), [3, 3, 2, 3, 3]);
70
+ assert.deepEqual(['B', 'C', 'D', 'E', 'F'].map((c) => cellNumber(cell(xml, `${c}8`))), [2, 2, 3, 2, 2]);
71
+ } finally { page.close(); }
72
+ });
73
+
74
+ // Row 6 is the sample workbook's own header row — the export never writes it,
75
+ // it writes scores into B–F underneath. Pin the seam: if the sample's score
76
+ // columns are ever reordered or renamed, every exported score lands under the
77
+ // wrong heading and nothing else would notice. The sample keeps these as
78
+ // shared strings, unlike the cells the export writes inline.
79
+ function sharedText(files, frag) {
80
+ const idx = Number(/<v>(\d+)<\/v>/.exec(frag)?.[1]);
81
+ const items = [...files.get('xl/sharedStrings.xml').toString('utf8').matchAll(/<si>([\s\S]*?)<\/si>/g)];
82
+ return [...items[idx][1].matchAll(/<t[^>]*>([^<]*)<\/t>/g)].map((m) => m[1]).join('');
83
+ }
84
+
85
+ const headerText = (files, frag) => inlineText(frag) ?? sharedText(files, frag);
86
+
87
+ test('the score columns sit under the sample workbook\'s five score headers', skip, async () => {
88
+ const page = await openPage(buildPage());
89
+ try {
90
+ const files = await exportedFiles(page);
91
+ const xml = sheet1(files);
92
+ assert.deepEqual(['B', 'C', 'D', 'E', 'F'].map((c) => headerText(files, cell(xml, `${c}6`))),
93
+ ['TECH\nCOMPLEXITY\n(1–5)', 'FEATURE\nSIZE\n(1–5)', 'DEPEND-\nENCIES\n(1–5)',
94
+ 'UNCER-\nTAINTY\n(1–5)', 'RISK\n(1–5)']);
74
95
  } finally { page.close(); }
75
96
  });
76
97
 
77
- test('tech and size scores follow the Scoring Guide definitions', skip, async () => {
98
+ test('column N carries the plain-words note for sales readers', skip, async () => {
78
99
  const page = await openPage(buildPage());
79
100
  try {
80
101
  const xml = sheet1(await exportedFiles(page));
81
- // TECH: hours-weighted category score (boilerplate 1.5, logic 3, novel 5).
82
- // Booking mixes boilerplate(25.3h) + logic(44h) → 2.45 → 2; reminders is
83
- // logic-only → 3.
84
- assert.equal(cellNumber(cell(xml, 'B7')), 2);
85
- assert.equal(cellNumber(cell(xml, 'B8')), 3);
86
- // SIZE: absolute expected-hour bands [8, 24, 64, 128] per the guide's
87
- // "<1 day → epic" scale. Booking ≈69h → 4; reminders ≈21h → 2.
88
- assert.equal(cellNumber(cell(xml, 'C7')), 4);
89
- assert.equal(cellNumber(cell(xml, 'C8')), 2);
102
+ assert.equal(inlineText(cell(xml, 'N6')), 'WHY THIS TIER');
103
+ assert.match(inlineText(cell(xml, 'N7')) ?? '', /open questions/);
104
+ assert.match(xml, /<autoFilter ref="A6:N26"\/>/);
105
+ } finally { page.close(); }
106
+ });
107
+
108
+ const sheetRationale = (files) => files.get('xl/worksheets/sheet5.xml')?.toString('utf8') ?? '';
109
+
110
+ test('a Score Rationale tab lists anchor, evidence and both sources per factor', skip, async () => {
111
+ const page = await openPage(buildPage());
112
+ try {
113
+ const files = await exportedFiles(page);
114
+ assert.match(files.get('xl/workbook.xml').toString('utf8'), /name="Score Rationale"/);
115
+ assert.match(files.get('xl/_rels/workbook.xml.rels').toString('utf8'), /Target="worksheets\/sheet5\.xml"/);
116
+ assert.match(files.get('[Content_Types].xml').toString('utf8'), /PartName="\/xl\/worksheets\/sheet5\.xml"/);
117
+ const xml = sheetRationale(files);
118
+ assert.deepEqual(['A1', 'B1', 'C1', 'D1', 'E1', 'F1', 'G1'].map((r) => inlineText(cell(xml, r))),
119
+ ['FEATURE', 'FACTOR', 'SCORE', 'ANCHOR', 'EVIDENCE', 'FEATURE SOURCE', 'SCORE ORIGIN']);
120
+ assert.equal(inlineText(cell(xml, 'A2')), 'User can book appointment');
121
+ assert.equal(inlineText(cell(xml, 'B2')), 'Tech');
122
+ assert.equal(cellNumber(cell(xml, 'C2')), 3);
123
+ assert.equal(inlineText(cell(xml, 'D2')), 'Custom business logic, moderate algorithm complexity, multiple states');
124
+ assert.equal(inlineText(cell(xml, 'E2')), 'slot conflict + cancellation rules');
125
+ assert.equal(inlineText(cell(xml, 'F2')), 'stated'); // the client asked for the feature
126
+ assert.equal(inlineText(cell(xml, 'G2')), 'reviewer changed'); // and a human edited its score
127
+ assert.match(xml, /<autoFilter ref="A1:G11"\/>/); // 2 features × 5 factors
128
+ } finally { page.close(); }
129
+ });
130
+
131
+ // The two columns answer different questions about different people — whether
132
+ // the client asked for the feature, and whether a reviewer overrode the
133
+ // agent's score. The booking fixture happens to agree on both, so this pins
134
+ // them apart: one feature the client asked for, whose score nobody touched.
135
+ test('feature source and score origin are read from separate fields', skip, async () => {
136
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-xlsx-sources-'));
137
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
138
+ inputs.features[0].provenance = 'stated';
139
+ inputs.features[0].scoreProvenance = 'proposed';
140
+ const inputsPath = join(dir, 'inputs.json');
141
+ writeFileSync(inputsPath, JSON.stringify(inputs));
142
+ const page = await openPage(buildPage(inputsPath));
143
+ try {
144
+ const xml = sheetRationale(await exportedFiles(page));
145
+ assert.equal(inlineText(cell(xml, 'F2')), 'stated');
146
+ assert.equal(inlineText(cell(xml, 'G2')), 'agent proposed');
147
+ assert.deepEqual(page.errors, []);
148
+ } finally { page.close(); }
149
+ });
150
+
151
+ test('QUICK inputs export blank score cells and an empty rationale tab', skip, async () => {
152
+ const dir = mkdtempSync(join(tmpdir(), 'estimate-xlsx-quick-'));
153
+ const inputs = JSON.parse(readFileSync(fixture, 'utf8'));
154
+ inputs.depth = 'QUICK';
155
+ for (const f of inputs.features) {
156
+ delete f.scores; delete f.scoreNote; delete f.scoreProvenance;
157
+ f.tasks = [{ ...f.tasks[0], id: `${f.id}-band`, o: 60, m: 110, p: 160 }];
158
+ }
159
+ const inputsPath = join(dir, 'inputs.json');
160
+ writeFileSync(inputsPath, JSON.stringify(inputs));
161
+ const page = await openPage(buildPage(inputsPath));
162
+ try {
163
+ const files = await exportedFiles(page);
164
+ const xml = sheet1(files);
165
+ assert.equal(cell(xml, 'B7'), '', 'no score value at QUICK');
166
+ assert.match(xml, /<c r="B7" s="\d+"\/>/);
167
+ assert.match(sheetRationale(files), /<autoFilter ref="A1:G1"\/>/);
90
168
  } finally { page.close(); }
91
169
  });
92
170
 
@@ -113,14 +191,18 @@ test('milestone and container fill L/M under an autofiltered header', skip, asyn
113
191
  assert.equal(inlineText(cell(xml, 'L7')), 'M1 - Booking core');
114
192
  assert.equal(inlineText(cell(xml, 'M7')), 'Booking API');
115
193
  assert.equal(inlineText(cell(xml, 'M8')), 'Notification Service');
116
- assert.match(xml, /<autoFilter ref="A6:M26"\/>/);
194
+ assert.match(xml, /<autoFilter ref="A6:N26"\/>/);
117
195
  } finally { page.close(); }
118
196
  });
119
197
 
120
198
  test('the export honours the active source filter', skip, async () => {
121
199
  const page = await openPage(buildPage());
122
200
  try {
123
- await page.eval(`document.querySelector('#feature-table [data-prov="stated"]').click()`);
201
+ await page.eval(`(() => {
202
+ const sel = document.querySelector('#feature-table select[data-select="prov"]');
203
+ sel.value = 'stated';
204
+ sel.dispatchEvent(new Event('change', { bubbles: true }));
205
+ })()`);
124
206
  const xml = sheet1(await exportedFiles(page));
125
207
  assert.match(xml, /User can book appointment/);
126
208
  assert.doesNotMatch(xml, /Email reminders/);
@@ -144,7 +226,11 @@ test('the export adds a registered Task Breakdown tab', skip, async () => {
144
226
  test('task rows carry the PERT formula in-cell and ride the feature filter', skip, async () => {
145
227
  const page = await openPage(buildPage());
146
228
  try {
147
- await page.eval(`document.querySelector('#feature-table [data-prov="stated"]').click()`);
229
+ await page.eval(`(() => {
230
+ const sel = document.querySelector('#feature-table select[data-select="prov"]');
231
+ sel.value = 'stated';
232
+ sel.dispatchEvent(new Event('change', { bubbles: true }));
233
+ })()`);
148
234
  const xml = sheetTasks(await exportedFiles(page));
149
235
  assert.equal(inlineText(cell(xml, 'A2')), 'User can book appointment');
150
236
  assert.equal(inlineText(cell(xml, 'B2')), 'Booking CRUD API');
@@ -127,6 +127,6 @@ function scenarioNodes(est) {
127
127
  id: `scenario-${s.id ?? s.name}`,
128
128
  type: 'scenario',
129
129
  position: { x: 0, y: 0 },
130
- data: { label: s.label ?? s.plan ?? String(s.id ?? s.name), status: 'ready', href: null, detail: null },
130
+ data: { label: s.label ?? String(s.id ?? s.name), status: 'ready', href: null, detail: null },
131
131
  }));
132
132
  }
@@ -8,8 +8,8 @@ import { JARGON } from '../lib/jargon.mjs';
8
8
  const estimation = {
9
9
  inputs: {
10
10
  scenarios: [
11
- { id: 's1', plan: 'max5x', team: [{ seniority: 'senior', rate: 50 }] },
12
- { id: 's2-secret', plan: 'none', team: [{ seniority: 'mid', rate: 40 }] },
11
+ { id: 's1', aiAssisted: true, toolingCostPerSeat: 100, team: [{ seniority: 'senior', rate: 50 }] },
12
+ { id: 's2-secret', aiAssisted: false, toolingCostPerSeat: null, team: [{ seniority: 'mid', rate: 40 }] },
13
13
  ],
14
14
  },
15
15
  computed: {
@@ -11,7 +11,7 @@ import { deriveFigures, formatMoney } from '../lib/figures.mjs';
11
11
  const estimation = {
12
12
  inputs: {
13
13
  scenarios: [{
14
- id: 's1', plan: 'max5x',
14
+ id: 's1', aiAssisted: true, toolingCostPerSeat: 100,
15
15
  team: [{ seniority: 'senior', rate: 50 }, { seniority: 'mid', rate: 40 }],
16
16
  }],
17
17
  },