@massu/core 0.5.0 → 0.6.0

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 (118) hide show
  1. package/README.md +40 -0
  2. package/agents/massu-architecture-reviewer.md +104 -0
  3. package/agents/massu-blast-radius-analyzer.md +84 -0
  4. package/agents/massu-competitive-scorer.md +126 -0
  5. package/agents/massu-help-sync.md +73 -0
  6. package/agents/massu-migration-writer.md +94 -0
  7. package/agents/massu-output-scorer.md +87 -0
  8. package/agents/massu-pattern-reviewer.md +84 -0
  9. package/agents/massu-plan-auditor.md +170 -0
  10. package/agents/massu-schema-sync-verifier.md +70 -0
  11. package/agents/massu-security-reviewer.md +98 -0
  12. package/agents/massu-ux-reviewer.md +106 -0
  13. package/commands/_shared-preamble.md +53 -23
  14. package/commands/_shared-references/auto-learning-protocol.md +71 -0
  15. package/commands/_shared-references/blast-radius-protocol.md +76 -0
  16. package/commands/_shared-references/security-pre-screen.md +64 -0
  17. package/commands/_shared-references/test-first-protocol.md +87 -0
  18. package/commands/_shared-references/verification-table.md +52 -0
  19. package/commands/massu-article-review.md +343 -0
  20. package/commands/massu-autoresearch/references/eval-runner.md +84 -0
  21. package/commands/massu-autoresearch/references/safety-rails.md +125 -0
  22. package/commands/massu-autoresearch/references/scoring-protocol.md +151 -0
  23. package/commands/massu-autoresearch.md +258 -0
  24. package/commands/massu-batch.md +44 -12
  25. package/commands/massu-bearings.md +42 -8
  26. package/commands/massu-checkpoint.md +588 -0
  27. package/commands/massu-ci-fix.md +2 -2
  28. package/commands/massu-command-health.md +132 -0
  29. package/commands/massu-command-improve.md +232 -0
  30. package/commands/massu-commit.md +205 -44
  31. package/commands/massu-create-plan.md +239 -57
  32. package/commands/massu-data/references/common-queries.md +79 -0
  33. package/commands/massu-data/references/table-guide.md +50 -0
  34. package/commands/massu-data.md +66 -0
  35. package/commands/massu-dead-code.md +29 -34
  36. package/commands/massu-debug/references/auto-learning.md +61 -0
  37. package/commands/massu-debug/references/codegraph-tracing.md +80 -0
  38. package/commands/massu-debug/references/common-shortcuts.md +98 -0
  39. package/commands/massu-debug/references/investigation-phases.md +294 -0
  40. package/commands/massu-debug/references/report-format.md +107 -0
  41. package/commands/massu-debug.md +105 -386
  42. package/commands/massu-docs.md +1 -1
  43. package/commands/massu-full-audit.md +61 -0
  44. package/commands/massu-gap-enhancement-analyzer.md +276 -16
  45. package/commands/massu-golden-path/references/approval-points.md +216 -0
  46. package/commands/massu-golden-path/references/competitive-mode.md +273 -0
  47. package/commands/massu-golden-path/references/error-handling.md +121 -0
  48. package/commands/massu-golden-path/references/phase-0-requirements.md +53 -0
  49. package/commands/massu-golden-path/references/phase-1-plan-creation.md +168 -0
  50. package/commands/massu-golden-path/references/phase-2-implementation.md +397 -0
  51. package/commands/massu-golden-path/references/phase-2.5-gap-analyzer.md +156 -0
  52. package/commands/massu-golden-path/references/phase-3-simplify.md +40 -0
  53. package/commands/massu-golden-path/references/phase-4-commit.md +94 -0
  54. package/commands/massu-golden-path/references/phase-5-push.md +116 -0
  55. package/commands/massu-golden-path/references/phase-5.5-production-verify.md +170 -0
  56. package/commands/massu-golden-path/references/phase-6-completion.md +113 -0
  57. package/commands/massu-golden-path/references/qa-evaluator-spec.md +137 -0
  58. package/commands/massu-golden-path/references/sprint-contract-protocol.md +117 -0
  59. package/commands/massu-golden-path/references/vr-visual-calibration.md +73 -0
  60. package/commands/massu-golden-path.md +114 -848
  61. package/commands/massu-guide.md +72 -69
  62. package/commands/massu-hooks.md +27 -12
  63. package/commands/massu-hotfix.md +221 -144
  64. package/commands/massu-incident.md +49 -20
  65. package/commands/massu-infra-audit.md +187 -0
  66. package/commands/massu-learning-audit.md +211 -0
  67. package/commands/massu-loop/references/auto-learning.md +49 -0
  68. package/commands/massu-loop/references/checkpoint-audit.md +40 -0
  69. package/commands/massu-loop/references/guardrails.md +17 -0
  70. package/commands/massu-loop/references/iteration-structure.md +115 -0
  71. package/commands/massu-loop/references/loop-controller.md +188 -0
  72. package/commands/massu-loop/references/plan-extraction.md +78 -0
  73. package/commands/massu-loop/references/vr-plan-spec.md +140 -0
  74. package/commands/massu-loop-playwright.md +9 -9
  75. package/commands/massu-loop.md +115 -670
  76. package/commands/massu-new-pattern.md +423 -0
  77. package/commands/massu-perf.md +422 -0
  78. package/commands/massu-plan-audit.md +1 -1
  79. package/commands/massu-plan.md +389 -122
  80. package/commands/massu-production-verify.md +433 -0
  81. package/commands/massu-push.md +62 -378
  82. package/commands/massu-recap.md +29 -3
  83. package/commands/massu-rollback.md +613 -0
  84. package/commands/massu-scaffold-hook.md +2 -4
  85. package/commands/massu-scaffold-page.md +2 -3
  86. package/commands/massu-scaffold-router.md +1 -2
  87. package/commands/massu-security.md +619 -0
  88. package/commands/massu-simplify.md +115 -85
  89. package/commands/massu-squirrels.md +2 -2
  90. package/commands/massu-tdd.md +38 -22
  91. package/commands/massu-test.md +3 -3
  92. package/commands/massu-type-mismatch-audit.md +469 -0
  93. package/commands/massu-ui-audit.md +587 -0
  94. package/commands/massu-verify-playwright.md +287 -32
  95. package/commands/massu-verify.md +150 -46
  96. package/dist/cli.js +146 -95
  97. package/package.json +6 -2
  98. package/patterns/build-patterns.md +302 -0
  99. package/patterns/component-patterns.md +246 -0
  100. package/patterns/display-patterns.md +185 -0
  101. package/patterns/form-patterns.md +890 -0
  102. package/patterns/integration-testing-checklist.md +445 -0
  103. package/patterns/security-patterns.md +219 -0
  104. package/patterns/testing-patterns.md +569 -0
  105. package/patterns/tool-routing.md +81 -0
  106. package/patterns/ui-patterns.md +371 -0
  107. package/protocols/plan-implementation.md +267 -0
  108. package/protocols/recovery.md +225 -0
  109. package/protocols/verification.md +404 -0
  110. package/reference/command-taxonomy.md +178 -0
  111. package/reference/cr-rules-reference.md +76 -0
  112. package/reference/hook-execution-order.md +148 -0
  113. package/reference/lessons-learned.md +175 -0
  114. package/reference/patterns-quickref.md +208 -0
  115. package/reference/standards.md +135 -0
  116. package/reference/subagents-reference.md +17 -0
  117. package/reference/vr-verification-reference.md +867 -0
  118. package/src/commands/install-commands.ts +149 -53
@@ -0,0 +1,185 @@
1
+ # Display Patterns
2
+
3
+ **Purpose**: Centralized formatting functions and display conventions for data presentation.
4
+
5
+ **When to Read**: Before displaying formatted data (currency, phone numbers, dates, names, file sizes).
6
+
7
+ ---
8
+
9
+ ## Centralized Formatters
10
+
11
+ ### Canonical Formatting Functions
12
+
13
+ All formatting MUST use centralized functions from `@/lib/formatting/fields`:
14
+
15
+ ```typescript
16
+ import {
17
+ formatMoney,
18
+ formatPhone,
19
+ formatDate,
20
+ formatFullName,
21
+ formatFileSize,
22
+ } from '@/lib/formatting/fields';
23
+ ```
24
+
25
+ ### Function Reference
26
+
27
+ | Function | Input | Output | Notes |
28
+ |----------|-------|--------|-------|
29
+ | `formatMoney(amount)` | `number` | `$1,234.56` | US currency, 2 decimal places |
30
+ | `formatPhone(phone)` | `string` (E.164) | `(555) 123-4567` | US format from E.164 |
31
+ | `formatDate(date)` | `Date \| string` | `Jan 15, 2026` | Medium format |
32
+ | `formatFullName(first, last)` | `string, string` | `John Doe` | Null-safe, trims whitespace |
33
+ | `formatFileSize(bytes)` | `number` | `1.5 MB` | Auto-scales units |
34
+
35
+ ### Usage Examples
36
+
37
+ ```typescript
38
+ // Currency
39
+ <span>{formatMoney(order.total)}</span>
40
+ // Output: "$1,234.56"
41
+
42
+ // Phone
43
+ <span>{formatPhone(contact.phone)}</span>
44
+ // Output: "(555) 123-4567"
45
+
46
+ // Date
47
+ <span>{formatDate(order.created_at)}</span>
48
+ // Output: "Jan 15, 2026"
49
+
50
+ // Name
51
+ <span>{formatFullName(user.first_name, user.last_name)}</span>
52
+ // Output: "John Doe"
53
+
54
+ // File size
55
+ <span>{formatFileSize(file.size)}</span>
56
+ // Output: "1.5 MB"
57
+ ```
58
+
59
+ ---
60
+
61
+ ## formatFileSize Pattern
62
+
63
+ **WRONG (inline definition - causes duplication):**
64
+ ```typescript
65
+ // WRONG - creates duplicate implementations
66
+ function formatFileSize(bytes: number): string {
67
+ if (bytes === 0) return '0 B';
68
+ const k = 1024;
69
+ const sizes = ['B', 'KB', 'MB', 'GB'];
70
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
71
+ return `${parseFloat((bytes / k ** i).toFixed(2))} ${sizes[i]}`;
72
+ }
73
+ ```
74
+
75
+ **CORRECT (import from canonical location):**
76
+ ```typescript
77
+ import { formatFileSize } from '@/lib/formatting/fields';
78
+
79
+ <span>{formatFileSize(file.size)}</span>
80
+ ```
81
+
82
+ ---
83
+
84
+ ## EditableField Component
85
+
86
+ For inline editing with type-appropriate display:
87
+
88
+ ```typescript
89
+ import { EditableField } from '@/components/common/EditableField';
90
+
91
+ <EditableField
92
+ label="Phone"
93
+ value={contact.phone}
94
+ type="phone"
95
+ onSave={(value) => updateContact({ phone: value })}
96
+ />
97
+ ```
98
+
99
+ ### Supported Types
100
+
101
+ | Type | Display | Edit Control |
102
+ |------|---------|-------------|
103
+ | `text` | Plain text | Input |
104
+ | `phone` | Formatted phone | PhoneInput |
105
+ | `email` | Email with link | Input type=email |
106
+ | `money` | Currency formatted | Input type=number |
107
+ | `date` | Formatted date | DatePicker |
108
+ | `select` | Selected label | Select dropdown |
109
+ | `textarea` | Multi-line text | Textarea |
110
+
111
+ ---
112
+
113
+ ## DataTable Column Type Handlers
114
+
115
+ When defining DataTable columns, use type-appropriate formatters:
116
+
117
+ ```typescript
118
+ const columns = [
119
+ {
120
+ accessorKey: 'name',
121
+ header: 'Name',
122
+ cell: ({ row }) => formatFullName(row.original.first_name, row.original.last_name),
123
+ },
124
+ {
125
+ accessorKey: 'phone',
126
+ header: 'Phone',
127
+ cell: ({ row }) => row.original.phone ? formatPhone(row.original.phone) : '—',
128
+ },
129
+ {
130
+ accessorKey: 'total',
131
+ header: 'Total',
132
+ cell: ({ row }) => formatMoney(row.original.total),
133
+ },
134
+ {
135
+ accessorKey: 'created_at',
136
+ header: 'Created',
137
+ cell: ({ row }) => formatDate(row.original.created_at),
138
+ },
139
+ ];
140
+ ```
141
+
142
+ ---
143
+
144
+ ## International Formatting
145
+
146
+ For locale-aware formatting, use functions from `@/lib/i18n/formatting`:
147
+
148
+ ```typescript
149
+ import {
150
+ formatCurrency,
151
+ formatNumber,
152
+ formatRelativeTime,
153
+ } from '@/lib/i18n/formatting';
154
+
155
+ // Currency with locale
156
+ formatCurrency(1234.56, 'USD', 'en-US') // "$1,234.56"
157
+ formatCurrency(1234.56, 'EUR', 'de-DE') // "1.234,56 €"
158
+
159
+ // Relative time
160
+ formatRelativeTime(new Date('2026-01-14')) // "2 days ago"
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Display Rules
166
+
167
+ | Rule | Pattern | Error if Violated |
168
+ |------|---------|-------------------|
169
+ | Always use centralized formatters | Import from `@/lib/formatting/fields` | Inconsistent formatting |
170
+ | Never inline format functions | Use canonical imports | Duplicate code, drift |
171
+ | Null-safe display | `value ?? '—'` for missing data | Blank cells confuse users |
172
+ | Consistent empty state | Use em dash `—` not empty string | Visual clarity |
173
+
174
+ ---
175
+
176
+ ## Related Documentation
177
+
178
+ - **Component Patterns**: `patterns/component-patterns.md`
179
+ - **Form Patterns**: `patterns/form-patterns.md`
180
+ - **UI Patterns**: `patterns/ui-patterns.md`
181
+
182
+ ---
183
+
184
+ **Document Status**: ACTIVE
185
+ **Compliance**: Mandatory — all formatting must use centralized functions