@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
@@ -4,16 +4,9 @@ import { embed } from '../../analyze-requirements/scripts/lib/embed.mjs';
4
4
  import { buildFontFaces } from '../../analyze-requirements/scripts/lib/fonts.mjs';
5
5
  import { escapeHtml } from '../../analyze-requirements/scripts/lib/md-inline.mjs';
6
6
  import { checkDeliverables } from './lib/checks.mjs';
7
- import { inlineModule, stripInternal, extractExports } from './lib/inline.mjs';
7
+ import { stripInternal } from './lib/inline.mjs';
8
8
  import { redactForClient } from './lib/redact.mjs';
9
-
10
- // The agentic template's what-if rail only prices team/plan capacity —
11
- // task hours are constants from the estimation data, not recomputed from
12
- // PERT/AI-category inputs — so it needs only these exports inlined.
13
- const AGENTIC_MATH_EXPORTS = [
14
- 'HOURS_PER_MONTH', 'COORDINATION_TAX', 'PLAN_PRICES', 'SENIORITY_FACTOR',
15
- 'effectiveCapacity', 'scenarioRollup',
16
- ];
9
+ import { loadGuide, guideTableHtml } from './lib/scoring.mjs';
17
10
 
18
11
  function parseArgs(argv) {
19
12
  const args = {};
@@ -29,7 +22,6 @@ function parseArgs(argv) {
29
22
  }
30
23
 
31
24
  const archFontsDir = new URL('../../analyze-requirements/assets/fonts/', import.meta.url).pathname;
32
- const mathPath = new URL('./lib/estimate-math.mjs', import.meta.url).pathname;
33
25
  const assetsDir = new URL('../assets/', import.meta.url).pathname;
34
26
 
35
27
  const args = parseArgs(process.argv.slice(2));
@@ -46,7 +38,12 @@ if (findings.length) {
46
38
  process.exit(1);
47
39
  }
48
40
 
49
- const dataForEmbed = args['client-only'] ? redactForClient(estimation) : estimation;
41
+ // --figures: the proposal's client-facing range (proposal-figures.json), when
42
+ // the proposal exists. Client-safe by definition — it is what the client is
43
+ // quoted — so it rides along in both renders.
44
+ const figures = typeof args.figures === 'string' ? JSON.parse(readFileSync(args.figures, 'utf8')) : null;
45
+ const base = args['client-only'] ? redactForClient(estimation) : estimation;
46
+ const dataForEmbed = figures ? { ...base, figures: { cost: figures.cost, months: figures.months } } : base;
50
47
  // Companion mode: --viewer carries the caller-known path back to the analyze-requirements
51
48
  // viewer. It sits in the header's internal range, so the client render (which
52
49
  // must not point at an internal document set) strips it with everything else.
@@ -54,7 +51,6 @@ const viewerSlot = typeof args.viewer === 'string'
54
51
  ? `<a id="viewer-link" data-internal href="${escapeHtml(args.viewer)}">architecture docs</a>`
55
52
  : '';
56
53
  const template = readFileSync(templatePath, 'utf8');
57
- const mathSrc = readFileSync(mathPath, 'utf8');
58
54
  const html = embed({
59
55
  template,
60
56
  slots: {
@@ -62,8 +58,13 @@ const html = embed({
62
58
  FONTS: buildFontFaces(archFontsDir),
63
59
  // Escaped so a literal </script in the JSON can't close the data tag early.
64
60
  DATA: JSON.stringify(dataForEmbed).replaceAll('</script', '<\\/script'),
65
- MATH: inlineModule(isAgentic ? extractExports(mathSrc, AGENTIC_MATH_EXPORTS) : mathSrc),
66
61
  VIEWER: viewerSlot,
62
+ // The team page computes nothing — every number it shows is committed in
63
+ // estimation.json; the agentic page reads measured numbers only. The team
64
+ // page's one extra slot is the rubric, which lives in
65
+ // references/scoring-guide.md: the page shows the same sentences the
66
+ // interviewer read, so a score means one thing.
67
+ ...(isAgentic ? {} : { GUIDE: guideTableHtml(loadGuide()) }),
67
68
  },
68
69
  });
69
70
 
@@ -0,0 +1,59 @@
1
+ // Score review round-trip. --write turns the agent's draft into a CSV or an
2
+ // HTML review page; --read takes the edited CSV (or the page's feedback
3
+ // JSON) and prints the diff plus the re-anchored features for the agent to
4
+ // write into estimation-inputs.json. It scores nothing itself.
5
+ import { readFileSync, writeFileSync } from 'node:fs';
6
+ import { toCsv, fromCsv } from './lib/score-csv.mjs';
7
+ import { diffScores, applyDiff } from './lib/score-diff.mjs';
8
+ import { toHtml } from './lib/score-html.mjs';
9
+ import { loadGuide, guideTableHtml, SCORE_FACTORS } from './lib/scoring.mjs';
10
+
11
+ function parseArgs(argv) {
12
+ const args = {};
13
+ for (let i = 0; i < argv.length; i += 1) {
14
+ if (argv[i].startsWith('--')) args[argv[i].slice(2)] = argv[++i];
15
+ }
16
+ return args;
17
+ }
18
+
19
+ const templatePath = new URL('../assets/scores-review-template.html', import.meta.url).pathname;
20
+ const mathPath = new URL('./lib/estimate-math.mjs', import.meta.url).pathname;
21
+ const json = (path) => JSON.parse(readFileSync(path, 'utf8'));
22
+
23
+ function write(args) {
24
+ const draft = json(args.write);
25
+ const out = args.format === 'html'
26
+ ? toHtml({ draft, template: readFileSync(templatePath, 'utf8'), guideHtml: guideTableHtml(loadGuide()), mathSrc: readFileSync(mathPath, 'utf8') })
27
+ : toCsv(draft);
28
+ writeFileSync(args.out, out);
29
+ console.log(args.out);
30
+ }
31
+
32
+ function read(args) {
33
+ const draft = json(args.draft);
34
+ const edited = args.read.endsWith('.json') ? json(args.read) : fromCsv(readFileSync(args.read, 'utf8'));
35
+ const diff = diffScores(draft, edited);
36
+ const features = applyDiff({ draft, diff, guide: loadGuide() });
37
+ // Every changed score is a question the agent owes the reviewer ("what
38
+ // makes it a 4?"); the old cite is the evidence the answer argues against.
39
+ // A rewritten plain note is the reviewer's own words and needs no reason.
40
+ const needsReason = diff.filter((c) => SCORE_FACTORS.includes(c.field))
41
+ .map((c) => ({ ...c, oldCite: draft.features.find((f) => f.id === c.id).scores[c.field].cite }));
42
+ console.log(JSON.stringify({ diff, needsReason, features }, null, 2));
43
+ }
44
+
45
+ function usage() {
46
+ console.error('usage: score-review.mjs --write draft.json --format csv|html --out <file>\n score-review.mjs --read <csv|feedback.json> --draft draft.json');
47
+ process.exit(1);
48
+ }
49
+
50
+ // A missing --out or --draft would otherwise fail somewhere inside fs, and an
51
+ // unknown --format would silently write a CSV under the asked-for name.
52
+ const args = parseArgs(process.argv.slice(2));
53
+ if (args.write) {
54
+ if (!args.out || (args.format && !['csv', 'html'].includes(args.format))) usage();
55
+ write(args);
56
+ } else if (args.read) {
57
+ if (!args.draft) usage();
58
+ read(args);
59
+ } else usage();