analyzthis_design 2.5.0 → 2.5.2

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 (93) hide show
  1. package/HOW-TO-USE.md +249 -326
  2. package/README.md +58 -13
  3. package/agents/calibration-benchmark.json +187 -0
  4. package/agents/cards/anuj.md +2 -2
  5. package/agents/cards/arjun.md +2 -2
  6. package/agents/cards/kavi.md +2 -1
  7. package/agents/cards/mood-board.md +3 -2
  8. package/agents/cards/noor.md +2 -2
  9. package/agents/cards/priya.md +1 -1
  10. package/agents/cards/zara.md +3 -3
  11. package/agents/chain.json +1 -1
  12. package/agents/design-spec-schema.json +18 -1
  13. package/agents/manifests/mood-board.json +1 -0
  14. package/agents/model-policy.json +12 -0
  15. package/agents/router.json +1 -1
  16. package/agents/session-schema.json +12 -2
  17. package/dist/HOW-TO-USE.md +249 -326
  18. package/dist/README.md +58 -13
  19. package/dist/agents/calibration-benchmark.json +187 -0
  20. package/dist/agents/cards/anuj.md +2 -2
  21. package/dist/agents/cards/arjun.md +2 -2
  22. package/dist/agents/cards/kavi.md +2 -1
  23. package/dist/agents/cards/mood-board.md +3 -2
  24. package/dist/agents/cards/noor.md +2 -2
  25. package/dist/agents/cards/priya.md +1 -1
  26. package/dist/agents/cards/zara.md +3 -3
  27. package/dist/agents/chain.json +1 -1
  28. package/dist/agents/design-spec-schema.json +18 -1
  29. package/dist/agents/manifests/mood-board.json +1 -0
  30. package/dist/agents/model-policy.json +12 -0
  31. package/dist/agents/router.json +1 -1
  32. package/dist/agents/session-schema.json +12 -2
  33. package/dist/bin/cli.js +154 -5
  34. package/dist/lib/calibrate.js +816 -0
  35. package/dist/lib/chunk-executor.js +41 -1
  36. package/dist/lib/chunk-models.js +4 -18
  37. package/dist/lib/chunk-router.js +22 -6
  38. package/dist/lib/chunk-run.js +55 -1
  39. package/dist/lib/chunk-synthesis.js +18 -2
  40. package/dist/lib/chunk-telemetry.js +77 -17
  41. package/dist/lib/collect.js +15 -1
  42. package/dist/lib/cost.js +15 -7
  43. package/dist/lib/design-spec.js +32 -2
  44. package/dist/lib/evolution-metrics.js +23 -1
  45. package/dist/lib/feedback-submit.js +50 -1
  46. package/dist/lib/feedback.js +15 -0
  47. package/dist/lib/lessons.js +8 -0
  48. package/dist/lib/mcp-server.js +119 -5
  49. package/dist/lib/model-policy.js +174 -0
  50. package/dist/lib/model-registry.js +71 -0
  51. package/dist/lib/moodboard.js +162 -28
  52. package/dist/lib/orchestrator/run.js +67 -8
  53. package/dist/lib/outcome.js +7 -2
  54. package/dist/lib/output-quality.js +95 -0
  55. package/dist/lib/reference-pack.js +9 -1
  56. package/dist/lib/session.js +48 -4
  57. package/dist/lib/system-prompt.js +3 -0
  58. package/dist/lib/ui-libraries.js +232 -0
  59. package/dist/skills/anuj/SKILL.md +4 -1
  60. package/dist/skills/arjun/SKILL.md +2 -2
  61. package/dist/skills/arjun/references/lens.md +15 -2
  62. package/dist/skills/design-director/SKILL.md +2 -0
  63. package/dist/skills/design-reference/SKILL.md +6 -0
  64. package/dist/skills/design-reference/motion.csv +11 -0
  65. package/dist/skills/design-reference/schema.json +12 -0
  66. package/dist/skills/design-reference/stacks/shadcn.csv +6 -0
  67. package/dist/skills/design-reference/ui-libraries.csv +46 -0
  68. package/dist/skills/design-reference/ux-guidelines.csv +12 -1
  69. package/dist/skills/design-spec/SKILL.md +1 -1
  70. package/dist/skills/getting-started/SKILL.md +2 -2
  71. package/dist/skills/kavi/SKILL.md +4 -3
  72. package/dist/skills/mood-board/SKILL.md +29 -3
  73. package/dist/skills/noor/SKILL.md +5 -1
  74. package/dist/skills/priya/SKILL.md +3 -0
  75. package/dist/skills/zara/SKILL.md +50 -3
  76. package/package.json +5 -2
  77. package/skills/anuj/SKILL.md +4 -1
  78. package/skills/arjun/SKILL.md +2 -2
  79. package/skills/arjun/references/lens.md +15 -2
  80. package/skills/design-director/SKILL.md +2 -0
  81. package/skills/design-reference/SKILL.md +6 -0
  82. package/skills/design-reference/motion.csv +11 -0
  83. package/skills/design-reference/schema.json +12 -0
  84. package/skills/design-reference/stacks/shadcn.csv +6 -0
  85. package/skills/design-reference/ui-libraries.csv +46 -0
  86. package/skills/design-reference/ux-guidelines.csv +12 -1
  87. package/skills/design-spec/SKILL.md +1 -1
  88. package/skills/getting-started/SKILL.md +2 -2
  89. package/skills/kavi/SKILL.md +4 -3
  90. package/skills/mood-board/SKILL.md +29 -3
  91. package/skills/noor/SKILL.md +5 -1
  92. package/skills/priya/SKILL.md +3 -0
  93. package/skills/zara/SKILL.md +50 -3
package/dist/bin/cli.js CHANGED
@@ -19,6 +19,7 @@ const designSpec = require('../lib/design-spec');
19
19
  const { run: orchestratorRun } = require('../lib/orchestrator/run');
20
20
  const hostLlm = require('../lib/host-llm');
21
21
  const moodboard = require('../lib/moodboard');
22
+ const calibrator = require('../lib/calibrate');
22
23
 
23
24
  const HELP = `
24
25
  Analyzthis_Design — 8 AI design personas with a personal knowledge bank
@@ -79,6 +80,9 @@ Usage:
79
80
  ── Efficiency / cost commands ────────────────────────────────
80
81
  metrics Print the last run's cost metrics (--all for every project)
81
82
  cost Print the last run's $ cost from config.pricing (--all for every project)
83
+ calibrate Compare available models on the fixed persona benchmark
84
+ (--max-usd 5, --max-calls 500, --runs 3, --judge, --apply)
85
+ Preview only with --dry-run; share text-free results with --share
82
86
  receipt Inferred token receipt for host (slash/MCP) turns — not a bill
83
87
  export-training Write accepted-output JSONL pairs for LoRA prep
84
88
  (--persona <id>, --all, --output <path>)
@@ -99,8 +103,10 @@ Usage:
99
103
 
100
104
  ── Mood board commands ─────────────────────────────────────
101
105
  moodboard create --task <text> Build a mood board from web + DS references
102
- [--url <url> ...] [--auto]
103
- moodboard critique --board <id> Run team deliberation over a board
106
+ [--url <url> ...] [--auto] [--kind mood|ui]
107
+ moodboard frames --board <id> Add Zara scout frames to a --kind ui board
108
+ --url <url> [--title t] [--steal s] [--refuse r] [--peak p]
109
+ moodboard critique --board <id> Run team deliberation (jury on ui boards)
104
110
  moodboard add --board <id> Add a user reference and rerun critique
105
111
  [--url <url>] [--title <t>] [--desc <d>]
106
112
  [--tags a,b] [--note <text>]
@@ -156,6 +162,14 @@ Usage:
156
162
  --budget free | cheap | auto — chunk model budget (run command; default: auto)
157
163
  --sequential Run chunks sequentially (run command; default on)
158
164
  --max-chunks Cap number of planner chunks (run command; default 6)
165
+ --max-usd Calibration hard spending limit in USD (default 5)
166
+ --max-calls Calibration hard model-call limit (default 500)
167
+ --runs Calibration repeats per fixed task/model (default 3)
168
+ --delta Non-inferiority margin on the 0-1 score scale (default 0.05)
169
+ --judge Enable blind cross-family calibration judges
170
+ --apply Write qualified calibration winners to the local policy
171
+ --resume Resume a calibration checkpoint path
172
+ --share Opt-in submission of text-free fixed-benchmark aggregates
159
173
  --unchunked Force legacy single-pass orchestrator (run command)
160
174
  --output Write final session-state.json to this path (run / run-unchunked command); or JSONL path (export-training)
161
175
  --persona Persona id (session accept; export-training; feedback commands)
@@ -210,6 +224,8 @@ Usage:
210
224
  npx analyzthis_design research --query "EY design system tokens"
211
225
 
212
226
  npx analyzthis_design moodboard create --task "B2B fintech dashboard, trustworthy, high-contrast" --auto
227
+ npx analyzthis_design moodboard create --task "Invoice approval, partner signs" --kind ui
228
+ npx analyzthis_design moodboard frames --board <id> --url https://example.com/shot.png --title "Dense table" --steal "one stamp" --refuse "purple glow"
213
229
  npx analyzthis_design moodboard critique --board <boardId>
214
230
  npx analyzthis_design moodboard add --board <boardId> --url https://dribbble.com/shots/example --title "Alt hero" --tags "landing,trust"
215
231
 
@@ -326,6 +342,10 @@ const boardVal = getFlag('board');
326
342
  const titleVal = getFlag('title');
327
343
  const descVal = getFlag('desc');
328
344
  const autoFlag = flags.includes('--auto');
345
+ const kindVal = getFlag('kind');
346
+ const stealVal = getFlag('steal');
347
+ const refuseVal = getFlag('refuse');
348
+ const peakVal = getFlag('peak');
329
349
  const budgetVal = getFlag('budget');
330
350
  const sequentialFlag = flags.includes('--sequential');
331
351
  const maxChunksVal = getFlag('max-chunks');
@@ -335,6 +355,14 @@ const fixFlag = flags.includes('--fix') || flags.includes('--no');
335
355
  const likedFlag = flags.includes('--liked');
336
356
  const becauseVal = getFlag('because');
337
357
  const sendFlag = flags.includes('--send');
358
+ const applyFlag = flags.includes('--apply');
359
+ const shareFlag = flags.includes('--share');
360
+ const judgeFlag = flags.includes('--judge');
361
+ const maxUsdVal = getFlag('max-usd');
362
+ const maxCallsVal = getFlag('max-calls');
363
+ const runsVal = getFlag('runs');
364
+ const deltaVal = getFlag('delta');
365
+ const resumeVal = getFlag('resume');
338
366
 
339
367
  // ─── Commands ────────────────────────────────────────────────────────────────
340
368
 
@@ -675,11 +703,20 @@ switch (cmd) {
675
703
  project: projectVal,
676
704
  task: taskVal,
677
705
  urls: urls,
706
+ kind: kindVal || 'mood',
678
707
  discover: autoFlag || urls.length > 0,
679
708
  dryRun: dryRunFlag,
680
709
  });
681
- console.log(`\n✅ Mood board created: ${result.board.board_id}`);
682
- console.log(` References: ${result.board.references.length}`);
710
+ console.log(`\n✅ ${result.board.kind === 'ui' ? 'UI image board' : 'Mood board'} created: ${result.board.board_id}`);
711
+ if (result.board.kind === 'ui') {
712
+ console.log(` Scout: Zara round ${result.board.scout.round} — ${result.board.scout.status}`);
713
+ console.log(` Next: /zara (Scout Pass), then moodboard frames --board ${result.board.board_id}`);
714
+ console.log('');
715
+ console.log(result.board.scout.brief);
716
+ console.log('');
717
+ } else {
718
+ console.log(` References: ${result.board.references.length}`);
719
+ }
683
720
  console.log(` Board dir: ${result.boardDir}`);
684
721
  console.log(` Workspace: ${result.workspacePath}\n`);
685
722
  if (dryRunFlag) {
@@ -712,6 +749,13 @@ switch (cmd) {
712
749
  });
713
750
  console.log(`\n✅ Mood board critique complete: ${result.board.board_id}`);
714
751
  console.log(` Verdict: ${result.board.synthesis?.verdict || 'n/a'}`);
752
+ if (result.board.kind === 'ui' && result.board.scout) {
753
+ console.log(` Scout: round ${result.board.scout.round} — ${result.board.scout.status}`);
754
+ if (result.board.scout.status === 'awaiting_scout') {
755
+ console.log('');
756
+ console.log(result.board.scout.brief);
757
+ }
758
+ }
715
759
  console.log(` Rounds: ${result.board.deliberation?.round || 0}`);
716
760
  console.log(` Board: ${result.boardDir || path.join(session.sessionDir(projectVal || session.getProjectId()), 'moodboard', boardVal)}`);
717
761
  console.log(` Workspace: ${result.workspacePath}\n`);
@@ -726,6 +770,31 @@ switch (cmd) {
726
770
  })();
727
771
  break;
728
772
  }
773
+ if (msub === 'frames') {
774
+ if (!boardVal || !urlVal) {
775
+ console.error('\n ✗ --board and --url are required. Example: npx analyzthis_design moodboard frames --board <id> --url https://example.com/shot.png --title "Dense table" --steal "one stamp" --refuse "purple glow"\n');
776
+ process.exit(1);
777
+ }
778
+ try {
779
+ const result = moodboard.addFrames({
780
+ project: projectVal,
781
+ boardId: boardVal,
782
+ frame: {
783
+ url: urlVal,
784
+ title: titleVal || '',
785
+ steal: stealVal || '',
786
+ refuse: refuseVal || '',
787
+ peak: peakVal || '',
788
+ },
789
+ });
790
+ console.log(`\n✅ Frame added to UI board ${result.board.board_id} (${result.board.frames.length} total)`);
791
+ console.log(` Scout: ${result.board.scout.status} — next: moodboard critique --board ${result.board.board_id}\n`);
792
+ } catch (err) {
793
+ console.error(`\n ✗ ${err.message}\n`);
794
+ process.exit(1);
795
+ }
796
+ break;
797
+ }
729
798
  if (msub === 'add') {
730
799
  if (!boardVal) {
731
800
  console.error('\n ✗ --board is required. Example: npx analyzthis_design moodboard add --board <id> --url <url>\n');
@@ -776,7 +845,7 @@ switch (cmd) {
776
845
  }
777
846
  break;
778
847
  }
779
- console.error('\n Unknown moodboard subcommand. Use: create | critique | add | list\n');
848
+ console.error('\n Unknown moodboard subcommand. Use: create | frames | critique | add | list\n');
780
849
  process.exit(1);
781
850
  }
782
851
 
@@ -1000,6 +1069,86 @@ switch (cmd) {
1000
1069
  break;
1001
1070
  }
1002
1071
 
1072
+ case 'calibrate': {
1073
+ (async () => {
1074
+ try {
1075
+ if (shareFlag && dryRunFlag && resumeVal) {
1076
+ const saved = JSON.parse(fs.readFileSync(path.resolve(resumeVal), 'utf8'));
1077
+ const shared = await feedbackSubmit.submitCalibration(saved, { dryRun: true, yes: yesFlag });
1078
+ console.log(`\n── Calibration share preview (${shared.rows.length} text-free rows) ──`);
1079
+ console.log(JSON.stringify(shared.rows[0], null, 2));
1080
+ console.log('');
1081
+ return;
1082
+ }
1083
+
1084
+ const options = {
1085
+ maxUsd: maxUsdVal == null ? 5 : Number(maxUsdVal),
1086
+ maxCalls: maxCallsVal == null ? 500 : Number(maxCallsVal),
1087
+ runs: runsVal == null ? 3 : Number(runsVal),
1088
+ delta: deltaVal == null ? 0.05 : Number(deltaVal),
1089
+ judge: judgeFlag,
1090
+ apply: applyFlag,
1091
+ resume: resumeVal || null,
1092
+ };
1093
+ const preview = await calibrator.preview(options);
1094
+ console.log('\n── Calibration preview ─────────────────────────────');
1095
+ console.log(` Models: ${preview.models}`);
1096
+ console.log(` Fixed tasks: ${preview.tasks}`);
1097
+ console.log(` Planned calls: ${preview.estimated_calls}/${options.maxCalls}`);
1098
+ console.log(` Worst-case cost: $${preview.estimated_usd.toFixed(4)}/$${options.maxUsd.toFixed(2)}`);
1099
+ if (!preview.allowed) {
1100
+ console.error(` Blocked by: ${preview.reasons.join(', ')}\n`);
1101
+ process.exitCode = 1;
1102
+ return;
1103
+ }
1104
+ if (dryRunFlag) {
1105
+ console.log(' Preview only: no model calls or policy writes.\n');
1106
+ return;
1107
+ }
1108
+
1109
+ if (!yesFlag) {
1110
+ if (!process.stdin.isTTY) {
1111
+ throw new Error('Non-interactive terminal. Pass --yes after reviewing the cost preview.');
1112
+ }
1113
+ const readline = require('readline');
1114
+ const approved = await new Promise((resolve) => {
1115
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
1116
+ rl.question('Run this calibration? [y/N] ', (answer) => {
1117
+ rl.close();
1118
+ resolve(/^y(es)?$/i.test(String(answer || '').trim()));
1119
+ });
1120
+ });
1121
+ if (!approved) {
1122
+ console.log('\n Calibration cancelled.\n');
1123
+ return;
1124
+ }
1125
+ }
1126
+
1127
+ const result = await calibrator.calibrate(options);
1128
+ console.log(`\n── Calibration ${result.status} ─────────────────────`);
1129
+ console.log(` Calls: ${result.calls}`);
1130
+ console.log(` Cost: $${Number(result.spent_usd || 0).toFixed(4)}`);
1131
+ console.log(` Checkpoint: ${result.checkpoint}`);
1132
+ Object.entries(result.selections || {}).forEach(([persona, efforts]) => {
1133
+ Object.entries(efforts).forEach(([effort, selection]) => {
1134
+ console.log(` ${persona}/${effort}: ${selection.winner || 'keep current'} (${selection.reason})`);
1135
+ });
1136
+ });
1137
+ if (result.policy_file) console.log(` Local policy: ${result.policy_file}`);
1138
+
1139
+ if (shareFlag) {
1140
+ const shared = await feedbackSubmit.submitCalibration(result, { dryRun: false, yes: yesFlag });
1141
+ console.log(` Shared: ${shared.submitted || 0} fixed-benchmark rows`);
1142
+ }
1143
+ console.log('');
1144
+ } catch (error) {
1145
+ console.error(`\n ✗ ${error.message}\n`);
1146
+ process.exitCode = 1;
1147
+ }
1148
+ })();
1149
+ break;
1150
+ }
1151
+
1003
1152
  case 'scores': {
1004
1153
  const em = require('../lib/evolution-metrics');
1005
1154
  if (flags.includes('--submit') || flags.includes('--submit-dry-run')) {