@greenharness/greenrack-cli 0.0.0-stage → 7.0.1
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 +335 -2
- package/agents/design-system-lookup.md +59 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +145 -0
- package/dist/bin.js.map +1 -0
- package/dist/catalog.d.ts +13 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +67 -0
- package/dist/catalog.js.map +1 -0
- package/dist/commands/context.d.ts +17 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +110 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/doctor.d.ts +75 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +1008 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/hook.d.ts +10 -0
- package/dist/commands/hook.d.ts.map +1 -0
- package/dist/commands/hook.js +323 -0
- package/dist/commands/hook.js.map +1 -0
- package/dist/commands/list.d.ts +4 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +59 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/lookup.d.ts +13 -0
- package/dist/commands/lookup.d.ts.map +1 -0
- package/dist/commands/lookup.js +66 -0
- package/dist/commands/lookup.js.map +1 -0
- package/dist/commands/manifest.d.ts +5 -0
- package/dist/commands/manifest.d.ts.map +1 -0
- package/dist/commands/manifest.js +33 -0
- package/dist/commands/manifest.js.map +1 -0
- package/dist/commands/mcp.d.ts +159 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +235 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/mockup.d.ts +80 -0
- package/dist/commands/mockup.d.ts.map +1 -0
- package/dist/commands/mockup.js +714 -0
- package/dist/commands/mockup.js.map +1 -0
- package/dist/commands/skill.d.ts +15 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +398 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/disambiguation.d.ts +24 -0
- package/dist/disambiguation.d.ts.map +1 -0
- package/dist/disambiguation.js +56 -0
- package/dist/disambiguation.js.map +1 -0
- package/dist/extension-pointer.d.ts +7 -0
- package/dist/extension-pointer.d.ts.map +1 -0
- package/dist/extension-pointer.js +30 -0
- package/dist/extension-pointer.js.map +1 -0
- package/dist/format.d.ts +19 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +213 -0
- package/dist/format.js.map +1 -0
- package/dist/hook-script.d.ts +73 -0
- package/dist/hook-script.d.ts.map +1 -0
- package/dist/hook-script.js +165 -0
- package/dist/hook-script.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy-names.d.ts +26 -0
- package/dist/legacy-names.d.ts.map +1 -0
- package/dist/legacy-names.js +26 -0
- package/dist/legacy-names.js.map +1 -0
- package/dist/manifest.d.ts +51 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +229 -0
- package/dist/manifest.js.map +1 -0
- package/dist/registry-types.d.ts +106 -0
- package/dist/registry-types.d.ts.map +1 -0
- package/dist/registry-types.js +2 -0
- package/dist/registry-types.js.map +1 -0
- package/dist/registry.d.ts +52 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +95 -0
- package/dist/registry.js.map +1 -0
- package/dist/scan.d.ts +19 -0
- package/dist/scan.d.ts.map +1 -0
- package/dist/scan.js +29 -0
- package/dist/scan.js.map +1 -0
- package/dist/search.d.ts +16 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +75 -0
- package/dist/search.js.map +1 -0
- package/dist/skill-template.d.ts +24 -0
- package/dist/skill-template.d.ts.map +1 -0
- package/dist/skill-template.js +140 -0
- package/dist/skill-template.js.map +1 -0
- package/greenharness.toml +38 -0
- package/package.json +76 -3
- package/registry.json +12893 -0
- package/skills/colors/LICENSE +21 -0
- package/skills/colors/NOTICE.md +36 -0
- package/skills/colors/SKILL.md +101 -0
- package/skills/colors/color-formats.md +90 -0
- package/skills/colors/color-usage.md +109 -0
- package/skills/colors/contrast.md +70 -0
- package/skills/colors/palette-generation.md +108 -0
- package/skills/colors/palette-structure.md +72 -0
- package/skills/colors/token-naming.md +99 -0
- package/skills/greenrack-mockup/SKILL.md +115 -0
- package/skills/typography/LICENSE +21 -0
- package/skills/typography/NOTICE.md +36 -0
- package/skills/typography/SKILL.md +171 -0
- package/skills/typography/choosing-fonts.md +53 -0
- package/skills/typography/css-cheat-sheet.md +67 -0
- package/skills/typography/details-and-accessibility.md +84 -0
- package/skills/typography/spacing-and-sizing.md +87 -0
- package/skills/typography/variable-fonts-and-opentype.md +100 -0
- package/skills/typography/wrapping-and-punctuation.md +23 -0
- package/skills/ui/LICENSE +21 -0
- package/skills/ui/NOTICE.md +38 -0
- package/skills/ui/SKILL.md +141 -0
- package/skills/ui/animations.md +170 -0
- package/skills/ui/enter-exit.md +157 -0
- package/skills/ui/icon-transitions.md +72 -0
- package/skills/ui/icons.md +105 -0
- package/skills/ui/performance.md +63 -0
- package/skills/ui/surfaces.md +166 -0
package/dist/format.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RelatedPair } from './disambiguation.js';
|
|
2
|
+
import type { ComponentEntry, IconRegistry, RecipeEntry, Registry, RulesRegistry, TokenGroup } from './registry-types.js';
|
|
3
|
+
export declare function renderComponent(registry: Registry, key: string, entry: ComponentEntry, options?: {
|
|
4
|
+
part?: string;
|
|
5
|
+
propsOnly?: boolean;
|
|
6
|
+
}): string;
|
|
7
|
+
export declare function renderRecipe(entry: RecipeEntry, options?: {
|
|
8
|
+
sourceOnly?: boolean;
|
|
9
|
+
}): string;
|
|
10
|
+
export declare function renderTokenGroup(key: string, group: TokenGroup): string;
|
|
11
|
+
export declare function renderIcons(icons: IconRegistry): string;
|
|
12
|
+
export declare function renderRules(rules: RulesRegistry): string;
|
|
13
|
+
export declare function renderList(registry: Registry, kind?: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* A neighbour-pair table. Its own section per kind, because the index answers
|
|
16
|
+
* "what exists" and these answer "which one" and "what goes inside what".
|
|
17
|
+
*/
|
|
18
|
+
export declare function renderPairs(pairs: RelatedPair[], heading: string, joiner: string): string;
|
|
19
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EAEZ,WAAW,EACX,QAAQ,EACR,aAAa,EACb,UAAU,EACX,MAAM,qBAAqB,CAAA;AAgE5B,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,cAAc,EACrB,OAAO,GAAE;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAM,GACjD,MAAM,CAgER;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,GAAE;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAM,GAAG,MAAM,CAS7F;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAuBvE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAUvD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAWxD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAsCpE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASzF"}
|
package/dist/format.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { guideNames } from './registry.js';
|
|
2
|
+
const useColor = process.env.NO_COLOR === undefined &&
|
|
3
|
+
process.stdout.isTTY === true &&
|
|
4
|
+
!process.argv.includes('--no-color');
|
|
5
|
+
const bold = (text) => (useColor ? `\u001b[1m${text}\u001b[22m` : text);
|
|
6
|
+
const dim = (text) => (useColor ? `\u001b[2m${text}\u001b[22m` : text);
|
|
7
|
+
function wrap(text, indent, width = 88) {
|
|
8
|
+
const words = text.split(/\s+/);
|
|
9
|
+
const lines = [];
|
|
10
|
+
let line = '';
|
|
11
|
+
for (const word of words) {
|
|
12
|
+
if (line.length + word.length + 1 > width - indent.length && line) {
|
|
13
|
+
lines.push(line);
|
|
14
|
+
line = word;
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
line = line ? `${line} ${word}` : word;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (line)
|
|
21
|
+
lines.push(line);
|
|
22
|
+
return lines.map((l) => indent + l).join('\n');
|
|
23
|
+
}
|
|
24
|
+
function propLines(props, indent = ' ') {
|
|
25
|
+
const ordered = [...props].sort((a, b) => Number(b.required) - Number(a.required));
|
|
26
|
+
const nameWidth = Math.max(...ordered.map((prop) => prop.name.length + (prop.required ? 1 : 0)), 8);
|
|
27
|
+
const typeWidth = Math.max(...ordered.map((prop) => Math.min(prop.type.length, 40)), 8);
|
|
28
|
+
const lines = [];
|
|
29
|
+
for (const prop of ordered) {
|
|
30
|
+
const name = (prop.name + (prop.required ? '*' : '')).padEnd(nameWidth + 2);
|
|
31
|
+
const type = prop.type.length > 40 ? prop.type.slice(0, 37) + '...' : prop.type;
|
|
32
|
+
const def = prop.default !== undefined ? ` = ${prop.default}` : '';
|
|
33
|
+
const deprecated = prop.deprecated ? ' (deprecated)' : '';
|
|
34
|
+
lines.push(`${indent}${name}${type.padEnd(typeWidth + 2)}${def}${deprecated}`);
|
|
35
|
+
if (prop.union)
|
|
36
|
+
lines.push(dim(`${indent}${' '.repeat(nameWidth + 2)}${prop.union.map((u) => `'${u}'`).join(' | ')}`));
|
|
37
|
+
if (prop.description)
|
|
38
|
+
lines.push(dim(wrap(prop.description, indent + ' '.repeat(nameWidth + 2))));
|
|
39
|
+
}
|
|
40
|
+
return lines.join('\n');
|
|
41
|
+
}
|
|
42
|
+
function metaBlocks(entry) {
|
|
43
|
+
const blocks = [];
|
|
44
|
+
const meta = entry.meta;
|
|
45
|
+
if (!meta)
|
|
46
|
+
return blocks;
|
|
47
|
+
blocks.push(wrap(meta.description, ''));
|
|
48
|
+
if (meta.whenToUse.length > 0) {
|
|
49
|
+
blocks.push(`${bold('USE WHEN')}\n${meta.whenToUse.map((w) => ` · ${w}`).join('\n')}`);
|
|
50
|
+
}
|
|
51
|
+
if (meta.whenNotToUse.length > 0) {
|
|
52
|
+
blocks.push(`${bold("DON'T USE WHEN")}\n${meta.whenNotToUse.map((w) => ` · ${w}`).join('\n')}`);
|
|
53
|
+
}
|
|
54
|
+
return blocks;
|
|
55
|
+
}
|
|
56
|
+
export function renderComponent(registry, key, entry, options = {}) {
|
|
57
|
+
const blocks = [];
|
|
58
|
+
const compound = entry.kind === 'compound' ? ' (compound)' : '';
|
|
59
|
+
blocks.push(`${bold(key)} — import {${entry.name}} from '${entry.importPath}'${compound}`);
|
|
60
|
+
if (entry.deprecated)
|
|
61
|
+
blocks.push(`DEPRECATED: ${entry.deprecated}`);
|
|
62
|
+
if (entry.native !== undefined) {
|
|
63
|
+
blocks.push(entry.native
|
|
64
|
+
? 'React Native: yes'
|
|
65
|
+
: 'React Native: no — not in the native barrel yet; do not use it in a native screen');
|
|
66
|
+
}
|
|
67
|
+
if (!options.propsOnly)
|
|
68
|
+
blocks.push(...metaBlocks(entry));
|
|
69
|
+
const meta = entry.meta;
|
|
70
|
+
if (meta?.anatomy && !options.propsOnly && !options.part) {
|
|
71
|
+
const optional = meta.anatomy.optional?.length
|
|
72
|
+
? ` optional: ${meta.anatomy.optional.join(' · ')}`
|
|
73
|
+
: '';
|
|
74
|
+
blocks.push(`${bold('ANATOMY')} required: ${meta.anatomy.required.join(' > ')}${optional}`);
|
|
75
|
+
}
|
|
76
|
+
if (entry.parts) {
|
|
77
|
+
const parts = options.part
|
|
78
|
+
? Object.entries(entry.parts).filter(([name]) => name === options.part)
|
|
79
|
+
: Object.entries(entry.parts);
|
|
80
|
+
if (options.part && parts.length === 0) {
|
|
81
|
+
const available = Object.keys(entry.parts).join(', ');
|
|
82
|
+
throw Object.assign(new Error(`${key} has no part "${options.part}" — parts: ${available}`), {
|
|
83
|
+
exitCode: 1,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
for (const [name, part] of parts) {
|
|
87
|
+
const deprecated = part.deprecated ? ` ${dim(`(deprecated: ${part.deprecated})`)}` : '';
|
|
88
|
+
blocks.push(`${bold(`${entry.name}.${name}`)}${deprecated}${part.props.length > 0 ? '\n' + propLines(part.props) : dim('\n (no props)')}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else if (entry.props && entry.props.length > 0) {
|
|
92
|
+
blocks.push(`${bold('PROPS')}\n${propLines(entry.props)}`);
|
|
93
|
+
}
|
|
94
|
+
if (!options.propsOnly && meta?.example) {
|
|
95
|
+
blocks.push(`${bold('EXAMPLE')}\n${meta.example
|
|
96
|
+
.split('\n')
|
|
97
|
+
.map((line) => ` ${line}`)
|
|
98
|
+
.join('\n')}`);
|
|
99
|
+
}
|
|
100
|
+
if (!options.propsOnly && meta?.relatedTo?.length) {
|
|
101
|
+
const width = Math.max(...meta.relatedTo.map((related) => related.component.length));
|
|
102
|
+
blocks.push(`${bold('RELATED')}\n${meta.relatedTo.map((related) => ` ${related.component.padEnd(width + 2)}${related.relationship}`).join('\n')}`);
|
|
103
|
+
}
|
|
104
|
+
if (!options.propsOnly) {
|
|
105
|
+
const recipesUsing = Object.values(registry.recipes)
|
|
106
|
+
.filter((recipe) => recipe.usesComponents.includes(entry.name))
|
|
107
|
+
.map((recipe) => recipe.name);
|
|
108
|
+
if (recipesUsing.length > 0)
|
|
109
|
+
blocks.push(dim(`Recipes using this: ${recipesUsing.join(', ')}`));
|
|
110
|
+
}
|
|
111
|
+
return blocks.join('\n\n');
|
|
112
|
+
}
|
|
113
|
+
export function renderRecipe(entry, options = {}) {
|
|
114
|
+
if (options.sourceOnly)
|
|
115
|
+
return entry.source;
|
|
116
|
+
const blocks = [
|
|
117
|
+
`${bold(entry.name)} — ${entry.title}`,
|
|
118
|
+
...metaBlocks(entry),
|
|
119
|
+
`Uses: ${entry.usesComponents.join(', ')}${entry.peerDeps.length > 0 ? `\nPeer deps: ${entry.peerDeps.join(', ')}` : ''}`,
|
|
120
|
+
`${dim(`--- source (${entry.name}.recipe.tsx) ---`)}\n${entry.source}`,
|
|
121
|
+
];
|
|
122
|
+
return blocks.join('\n\n');
|
|
123
|
+
}
|
|
124
|
+
export function renderTokenGroup(key, group) {
|
|
125
|
+
const lines = [
|
|
126
|
+
`${bold(key)} — import {${group.exportName}} from '${group.importPath}'`,
|
|
127
|
+
'',
|
|
128
|
+
];
|
|
129
|
+
const hasThemes = group.entries.some((entry) => entry.values);
|
|
130
|
+
if (hasThemes) {
|
|
131
|
+
const keyWidth = Math.max(...group.entries.map((entry) => entry.key.length)) + 2;
|
|
132
|
+
lines.push(` ${'token'.padEnd(keyWidth)}${'dark'.padEnd(28)}${'light'.padEnd(28)}high-contrast`);
|
|
133
|
+
for (const entry of group.entries) {
|
|
134
|
+
const themed = entry.values ?? {};
|
|
135
|
+
lines.push(` ${entry.key.padEnd(keyWidth)}${(themed.dark ?? '').padEnd(28)}${(themed.light ?? '').padEnd(28)}${themed.highContrast ?? ''}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
for (const entry of group.entries) {
|
|
140
|
+
lines.push(` ${entry.key.padEnd(14)}${entry.value !== undefined ? String(entry.value) : ''}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return lines.join('\n');
|
|
144
|
+
}
|
|
145
|
+
export function renderIcons(icons) {
|
|
146
|
+
const lines = [
|
|
147
|
+
`${bold('icons')} — <Icon name="..." size="sm|md|lg|xl|xxl" /> (${Object.entries(icons.sizes)
|
|
148
|
+
.map(([token, px]) => `${token} ${px}px`)
|
|
149
|
+
.join(' · ')})`,
|
|
150
|
+
];
|
|
151
|
+
for (const group of icons.groups) {
|
|
152
|
+
lines.push('', ` ${group.label ?? 'Core'}`, wrap(group.names.join(' · '), ' '));
|
|
153
|
+
}
|
|
154
|
+
return lines.join('\n');
|
|
155
|
+
}
|
|
156
|
+
export function renderRules(rules) {
|
|
157
|
+
const lint = rules.lint
|
|
158
|
+
.map((rule) => {
|
|
159
|
+
const fix = rule.fixable === 'none' ? '' : ` (${rule.fixable})`;
|
|
160
|
+
return ` ${rule.severity.padEnd(6)}${rule.id}${fix}\n${dim(wrap(rule.description, ' '))}`;
|
|
161
|
+
})
|
|
162
|
+
.join('\n');
|
|
163
|
+
return [
|
|
164
|
+
`${bold('CRITICAL RULES')} ${dim('(source: CLAUDE.md)')}\n\n${rules.critical}`,
|
|
165
|
+
`${bold('ENFORCED BY @greenharness/greenrack-eslint-plugin')} ${dim('(greenrack.configs.recommended)')}\n${lint}`,
|
|
166
|
+
].join('\n\n');
|
|
167
|
+
}
|
|
168
|
+
export function renderList(registry, kind) {
|
|
169
|
+
const sections = [];
|
|
170
|
+
const nameWidth = Math.max(...Object.keys(registry.components).map((name) => name.length), 12) + 2;
|
|
171
|
+
if (!kind || kind === 'components') {
|
|
172
|
+
const rows = Object.entries(registry.components)
|
|
173
|
+
.map(([key, entry]) => ` ${key.padEnd(nameWidth)}${entry.meta?.description.split('. ')[0] ?? dim(`(${entry.kind})`)}`)
|
|
174
|
+
.join('\n');
|
|
175
|
+
sections.push(`${bold('COMPONENTS')} (${Object.keys(registry.components).length})\n${rows}`);
|
|
176
|
+
}
|
|
177
|
+
if (!kind || kind === 'recipes') {
|
|
178
|
+
const rows = Object.entries(registry.recipes)
|
|
179
|
+
.map(([key, entry]) => ` ${key.padEnd(nameWidth)}${entry.meta.description}`)
|
|
180
|
+
.join('\n');
|
|
181
|
+
sections.push(`${bold('RECIPES')} (${Object.keys(registry.recipes).length})\n${rows}`);
|
|
182
|
+
}
|
|
183
|
+
if (!kind || kind === 'tokens') {
|
|
184
|
+
const rows = Object.entries(registry.tokens.groups)
|
|
185
|
+
.map(([key, group]) => ` ${key.padEnd(nameWidth)}${group.entries.length} tokens — ${group.importPath}`)
|
|
186
|
+
.join('\n');
|
|
187
|
+
sections.push(`${bold('TOKENS')}\n${rows}\n ${'icons'.padEnd(nameWidth)}${registry.icons.names.length} names — greenrack icons`);
|
|
188
|
+
}
|
|
189
|
+
if (kind === 'guides') {
|
|
190
|
+
const rows = guideNames(registry)
|
|
191
|
+
.map((name) => ` ${name}`)
|
|
192
|
+
.join('\n');
|
|
193
|
+
sections.push(`${bold('GUIDES')} (${guideNames(registry).length})\n${rows}`);
|
|
194
|
+
}
|
|
195
|
+
sections.push(dim(`greenrack <name> for details · greenrack rules · greenrack manifest`));
|
|
196
|
+
return sections.join('\n\n');
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* A neighbour-pair table. Its own section per kind, because the index answers
|
|
200
|
+
* "what exists" and these answer "which one" and "what goes inside what".
|
|
201
|
+
*/
|
|
202
|
+
export function renderPairs(pairs, heading, joiner) {
|
|
203
|
+
if (pairs.length === 0)
|
|
204
|
+
return '';
|
|
205
|
+
const labels = pairs.map((pair) => `${pair.a} ${joiner} ${pair.b}`);
|
|
206
|
+
const width = Math.max(...labels.map((label) => label.length)) + 2;
|
|
207
|
+
const rows = pairs.map((pair, index) => {
|
|
208
|
+
const body = wrap(pair.relationship, ' '.repeat(width + 2)).trimStart();
|
|
209
|
+
return ` ${labels[index].padEnd(width)}${body}`;
|
|
210
|
+
});
|
|
211
|
+
return `${bold(heading)} (${pairs.length})\n${rows.join('\n')}`;
|
|
212
|
+
}
|
|
213
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AAYxC,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;IAC7B,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;AAEtC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAC/E,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,YAAY,IAAI,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AAE9E,SAAS,IAAI,CAAC,IAAY,EAAE,MAAc,EAAE,KAAK,GAAG,EAAE;IACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,IAAI,IAAI,GAAG,EAAE,CAAA;IACb,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YAClE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAChB,IAAI,GAAG,IAAI,CAAA;QACb,CAAC;aAAM,CAAC;YACN,IAAI,GAAG,IAAI,CAAC,C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,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,MAAM,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAA;IACnE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAA;IAClE,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAA;QACvE,OAAO,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,EAAE,CAAA;IAClD,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,KAAK,CAAC,MAAM,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generated Claude Code hooks — SessionStart (catalog) and UserPromptSubmit
|
|
3
|
+
* (plan-mode nudge) — and the wiring they need.
|
|
4
|
+
*
|
|
5
|
+
* Kept as data (not prose in a README) so `greenrack hook install` can write it and
|
|
6
|
+
* `greenrack hook install --check` can byte-compare it: every consuming repo runs
|
|
7
|
+
* the same script, and an upgrade is a regenerate rather than nine hand-edits.
|
|
8
|
+
*/
|
|
9
|
+
/** Repo-relative paths the hook owns. */
|
|
10
|
+
export declare const HOOK_SCRIPT_PATH = ".claude/hooks/greenrack-catalog.sh";
|
|
11
|
+
export declare const HOOK_SETTINGS_PATH = ".claude/settings.json";
|
|
12
|
+
export declare const HOOK_CACHE_PATH = ".claude/.greenrack-session.cache";
|
|
13
|
+
/**
|
|
14
|
+
* `greenrack doctor --session` output, and the key of the files it was computed
|
|
15
|
+
* from. Named under HOOK_CACHE_PATH so the existing ignore glob covers them —
|
|
16
|
+
* no .gitignore drift in the repos already wired.
|
|
17
|
+
*/
|
|
18
|
+
export declare const HOOK_DOCTOR_CACHE_PATH = ".claude/.greenrack-session.cache.doctor";
|
|
19
|
+
/**
|
|
20
|
+
* Glob, not the bare path: the script stages the fetch through
|
|
21
|
+
* "<cache>.tmp", and a session-start hook killed mid-npx leaves that behind.
|
|
22
|
+
*/
|
|
23
|
+
export declare const HOOK_CACHE_IGNORE = ".claude/.greenrack-session.cache*";
|
|
24
|
+
/** Repo-specific caveats, appended by the hook and never touched by install. */
|
|
25
|
+
export declare const HOOK_NOTES_PATH = ".claude/greenrack-hook.local.md";
|
|
26
|
+
/** What settings.json runs. Also the marker install matches on. */
|
|
27
|
+
export declare const HOOK_COMMAND = "sh .claude/hooks/greenrack-catalog.sh";
|
|
28
|
+
/**
|
|
29
|
+
* Floor for the npx pin. Raise this only when the session payload needs
|
|
30
|
+
* newer CLI behavior — a floating pin keeps patch releases from showing up
|
|
31
|
+
* as --check drift, but a floor left behind a major means no consumer ever
|
|
32
|
+
* sees what the payload gained (1.2.0 pinned every repo out of 2.x).
|
|
33
|
+
* 3.0.0: the SCREENS section and the /greenrack-mockup pointer.
|
|
34
|
+
* 3.4.0: greenrack doctor --session.
|
|
35
|
+
* 4.4.0: the first CLI whose payload matches @greenharness/greenrack-ui 4 — a ^3 floor
|
|
36
|
+
* never reaches 4.x, so 4.x consumers were served 3.x docs. The
|
|
37
|
+
* release refuses a tag whose major differs from this floor's
|
|
38
|
+
* (scripts/check-pin-major.mjs).
|
|
39
|
+
* 5.0.0: @greenharness/greenrack-ui 5 (every measure is a token, ADR-0027); 5.x consumers
|
|
40
|
+
* get the sizes/borders tables and Critical Rule 4.
|
|
41
|
+
* 6.0.0: the design extension for grh (greenharness.toml) and `greenrack context`,
|
|
42
|
+
* which `hook session-start` now delegates to.
|
|
43
|
+
*/
|
|
44
|
+
export declare const HOOK_MIN_CLI = "7.0.0";
|
|
45
|
+
/**
|
|
46
|
+
* First line of the catalog cache: the floor it was fetched with. A cache
|
|
47
|
+
* from another floor is refetched, and this line is never printed.
|
|
48
|
+
*/
|
|
49
|
+
export declare const HOOK_PIN_LINE = "#greenrack-hook-pin 7.0.0";
|
|
50
|
+
export declare const HOOK_SCRIPT = "#!/bin/sh\n# greenrack design-system session bootstrap \u2014 GENERATED by `greenrack hook install`.\n# Regenerate: npx -y @greenharness/greenrack-cli@^7 hook install (--check verifies it in CI)\n#\n# Injects the consult-first preamble plus the component catalog into agent\n# context at SessionStart, so \"check the design system before building UI\" is\n# ambient context instead of a step an agent has to remember. Then runs\n# `greenrack doctor`, which says nothing unless this repo's build wiring flattens\n# the components' styles.\n#\n# Do not hand-edit. Repo-specific caveats go in\n# .claude/greenrack-hook.local.md \u2014 appended below, and left alone by regeneration.\ncache=\".claude/.greenrack-session.cache\"\nnotes=\".claude/greenrack-hook.local.md\"\ndoctor=\".claude/.greenrack-session.cache.doctor\"\npin=\"#greenrack-hook-pin 7.0.0\"\n\n# npx resolution dominates session start; the catalog only changes on upgrade.\n# Refetch when it is missing, a week old, fetched with another floor (its\n# first line), or older than this script (a regenerate).\nif [ ! -s \"$cache\" ] || [ \"$(head -n 1 \"$cache\" 2>/dev/null)\" != \"$pin\" ] ||\n [ -n \"$(find \"$cache\" -mtime +7 2>/dev/null)\" ] || [ \".claude/hooks/greenrack-catalog.sh\" -nt \"$cache\" ]; then\n # The pin is written with the payload, so a failed fetch (or one that\n # printed nothing) leaves the old cache as it was and never a pin-only file.\n if { echo \"$pin\"; npx -y @greenharness/greenrack-cli@^7.0.0 hook session-start; } >\"$cache.tmp\" 2>/dev/null &&\n [ -n \"$(tail -n +2 \"$cache.tmp\")\" ]; then\n mv \"$cache.tmp\" \"$cache\"\n else\n rm -f \"$cache.tmp\"\n if [ -s \"$cache\" ] && [ \"$(head -n 1 \"$cache\")\" != \"$pin\" ]; then\n echo \"greenrack: the catalog below is from an older CLI and could not be refreshed; run: npx -y @greenharness/greenrack-cli@^7.0.0 hook install\" >&2\n fi\n fi\nfi\n\n# Offline with no cache yet: stay silent rather than fail the session.\nif [ -s \"$cache\" ]; then\n # The pin line is bookkeeping, not catalog: skip it, and only it.\n case \"$(head -n 1 \"$cache\")\" in\n '#greenrack-hook-pin '*) tail -n +2 \"$cache\" ;;\n *) cat \"$cache\" ;;\n esac\n if [ -s \"$notes\" ]; then\n echo\n cat \"$notes\"\n fi\nfi\n\n# greenrack doctor reads build config, entries and stylesheets. Re-run it when one\n# of those changes rather than on a timer, so an edit shows up next session\n# and a healthy repo only pays for npx after touching its config.\nkey=$(find . -maxdepth 4 \\( -name node_modules -o -name .git -o -name dist -o -name build \\) -prune -o \\\n -type f \\( -name package.json -o -name pnpm-workspace.yaml -o -name '*.css' -o -name 'vite*' \\\n -o -name 'babel*' -o -name '.babelrc*' -o -name '*.babel.*' -o -name 'postcss*' \\\n -o -name 'root.tsx' -o -name 'main.tsx' -o -name 'index.tsx' \\) -exec cksum {} + 2>/dev/null |\n sort | cksum)\n# The floor is part of the key: a new floor reruns the doctor.\nkey=\"7.0.0 $key\"\nif [ \"$key\" != \"$(cat \"$doctor.key\" 2>/dev/null)\" ]; then\n if npx -y @greenharness/greenrack-cli@^7.0.0 doctor --session >\"$doctor.tmp\" 2>/dev/null; then\n mv \"$doctor.tmp\" \"$doctor\"\n echo \"$key\" >\"$doctor.key\"\n else\n rm -f \"$doctor.tmp\"\n fi\nfi\nif [ -s \"$doctor\" ]; then\n echo\n cat \"$doctor\"\nfi\n";
|
|
51
|
+
/**
|
|
52
|
+
* The UserPromptSubmit hook: a plan-mode nudge toward fresh mockup
|
|
53
|
+
* directions (fleet decision `handoff.fresh-directions-trigger`), so a plan
|
|
54
|
+
* that adds a screen or makes a material UI choice puts the direction pick
|
|
55
|
+
* first without anyone typing /greenrack-mockup.
|
|
56
|
+
*/
|
|
57
|
+
export declare const PLAN_HOOK_SCRIPT_PATH = ".claude/hooks/greenrack-plan.sh";
|
|
58
|
+
/** What settings.json runs on UserPromptSubmit. Also the marker install matches on. */
|
|
59
|
+
export declare const PLAN_HOOK_COMMAND = "sh .claude/hooks/greenrack-plan.sh";
|
|
60
|
+
/** Printed into the planner's context, and only while in plan mode. */
|
|
61
|
+
export declare const PLAN_NUDGE = "Planning in a greenrack consumer. If this plan adds a new screen, or makes a material choice in\nlayout, hierarchy or interaction (handoff.fresh-directions-trigger), its first \uD83E\uDDD1 decision is\npicking a direction: load the greenrack-mockup skill now (greenrack skill install if this repo lacks it; it installs the colors, typography and ui skills too)\nand draw 2\u20134 directions with `greenrack mockup` before ExitPlanMode. A fix that restores an existing\ndesign reuses the picked artboard instead; any other UI change needs no mockup.\n";
|
|
62
|
+
/**
|
|
63
|
+
* Runs on every prompt, so it is pure sh with one grep: no npx, no node, no
|
|
64
|
+
* network. Claude Code sends the event as one JSON object on stdin, and
|
|
65
|
+
* stdout of a UserPromptSubmit hook that exits 0 joins the model's context.
|
|
66
|
+
* Every path exits 0 — exit 2 would block the prompt. The whole payload is
|
|
67
|
+
* read before grep runs, so an early grep exit never breaks Claude Code's
|
|
68
|
+
* write. A `"permission_mode":"plan"` typed inside the prompt arrives
|
|
69
|
+
* escaped (\"permission_mode\"), which the pattern does not match.
|
|
70
|
+
*/
|
|
71
|
+
export declare const PLAN_HOOK_SCRIPT = "#!/bin/sh\n# greenrack plan-mode nudge \u2014 GENERATED by `greenrack hook install`.\n# Regenerate: npx -y @greenharness/greenrack-cli@^7 hook install (--check verifies it in CI)\n#\n# Claude Code runs this on every UserPromptSubmit with the event as JSON on\n# stdin. In plan mode it prints a short nudge toward fresh mockup directions\n# (handoff.fresh-directions-trigger); otherwise, or on input it cannot read,\n# it prints nothing. Always exits 0: it must never fail the prompt.\n#\n# Do not hand-edit.\n{ payload=$(cat); } 2>/dev/null || exit 0\nif printf '%s\\n' \"$payload\" |\n grep -Eq '\"permission_mode\"[[:space:]]*:[[:space:]]*\"plan\"' 2>/dev/null; then\n cat <<'NUDGE'\nPlanning in a greenrack consumer. If this plan adds a new screen, or makes a material choice in\nlayout, hierarchy or interaction (handoff.fresh-directions-trigger), its first \uD83E\uDDD1 decision is\npicking a direction: load the greenrack-mockup skill now (greenrack skill install if this repo lacks it; it installs the colors, typography and ui skills too)\nand draw 2\u20134 directions with `greenrack mockup` before ExitPlanMode. A fix that restores an existing\ndesign reuses the picked artboard instead; any other UI change needs no mockup.\nNUDGE\nfi\nexit 0\n";
|
|
72
|
+
export declare const GITIGNORE_BLOCK = "# greenrack session-hook cache (greenrack hook install)\n.claude/.greenrack-session.cache*\n";
|
|
73
|
+
//# sourceMappingURL=hook-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-script.d.ts","sourceRoot":"","sources":["../src/hook-script.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yCAAyC;AACzC,eAAO,MAAM,gBAAgB,uCAAuC,CAAA;AACpE,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AACzD,eAAO,MAAM,eAAe,qCAAqC,CAAA;AACjE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,4CAA8B,CAAA;AACjE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,sCAAwB,CAAA;AACtD,gFAAgF;AAChF,eAAO,MAAM,eAAe,oCAAoC,CAAA;AAEhE,mEAAmE;AACnE,eAAO,MAAM,YAAY,0CAA2B,CAAA;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,UAAU,CAAA;AAEnC;;;GAGG;AACH,eAAO,MAAM,aAAa,8BAAwC,CAAA;AAElE,eAAO,MAAM,WAAW,syGAsEvB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,oCAAoC,CAAA;AAEtE,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,uCAAgC,CAAA;AAE9D,uEAAuE;AACvE,eAAO,MAAM,UAAU,2iBAKtB,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,gvCAiB5B,CAAA;AAED,eAAO,MAAM,eAAe,iGAAoF,CAAA"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generated Claude Code hooks — SessionStart (catalog) and UserPromptSubmit
|
|
3
|
+
* (plan-mode nudge) — and the wiring they need.
|
|
4
|
+
*
|
|
5
|
+
* Kept as data (not prose in a README) so `greenrack hook install` can write it and
|
|
6
|
+
* `greenrack hook install --check` can byte-compare it: every consuming repo runs
|
|
7
|
+
* the same script, and an upgrade is a regenerate rather than nine hand-edits.
|
|
8
|
+
*/
|
|
9
|
+
/** Repo-relative paths the hook owns. */
|
|
10
|
+
export const HOOK_SCRIPT_PATH = '.claude/hooks/greenrack-catalog.sh';
|
|
11
|
+
export const HOOK_SETTINGS_PATH = '.claude/settings.json';
|
|
12
|
+
export const HOOK_CACHE_PATH = '.claude/.greenrack-session.cache';
|
|
13
|
+
/**
|
|
14
|
+
* `greenrack doctor --session` output, and the key of the files it was computed
|
|
15
|
+
* from. Named under HOOK_CACHE_PATH so the existing ignore glob covers them —
|
|
16
|
+
* no .gitignore drift in the repos already wired.
|
|
17
|
+
*/
|
|
18
|
+
export const HOOK_DOCTOR_CACHE_PATH = `${HOOK_CACHE_PATH}.doctor`;
|
|
19
|
+
/**
|
|
20
|
+
* Glob, not the bare path: the script stages the fetch through
|
|
21
|
+
* "<cache>.tmp", and a session-start hook killed mid-npx leaves that behind.
|
|
22
|
+
*/
|
|
23
|
+
export const HOOK_CACHE_IGNORE = `${HOOK_CACHE_PATH}*`;
|
|
24
|
+
/** Repo-specific caveats, appended by the hook and never touched by install. */
|
|
25
|
+
export const HOOK_NOTES_PATH = '.claude/greenrack-hook.local.md';
|
|
26
|
+
/** What settings.json runs. Also the marker install matches on. */
|
|
27
|
+
export const HOOK_COMMAND = `sh ${HOOK_SCRIPT_PATH}`;
|
|
28
|
+
/**
|
|
29
|
+
* Floor for the npx pin. Raise this only when the session payload needs
|
|
30
|
+
* newer CLI behavior — a floating pin keeps patch releases from showing up
|
|
31
|
+
* as --check drift, but a floor left behind a major means no consumer ever
|
|
32
|
+
* sees what the payload gained (1.2.0 pinned every repo out of 2.x).
|
|
33
|
+
* 3.0.0: the SCREENS section and the /greenrack-mockup pointer.
|
|
34
|
+
* 3.4.0: greenrack doctor --session.
|
|
35
|
+
* 4.4.0: the first CLI whose payload matches @greenharness/greenrack-ui 4 — a ^3 floor
|
|
36
|
+
* never reaches 4.x, so 4.x consumers were served 3.x docs. The
|
|
37
|
+
* release refuses a tag whose major differs from this floor's
|
|
38
|
+
* (scripts/check-pin-major.mjs).
|
|
39
|
+
* 5.0.0: @greenharness/greenrack-ui 5 (every measure is a token, ADR-0027); 5.x consumers
|
|
40
|
+
* get the sizes/borders tables and Critical Rule 4.
|
|
41
|
+
* 6.0.0: the design extension for grh (greenharness.toml) and `greenrack context`,
|
|
42
|
+
* which `hook session-start` now delegates to.
|
|
43
|
+
*/
|
|
44
|
+
export const HOOK_MIN_CLI = '7.0.0';
|
|
45
|
+
/**
|
|
46
|
+
* First line of the catalog cache: the floor it was fetched with. A cache
|
|
47
|
+
* from another floor is refetched, and this line is never printed.
|
|
48
|
+
*/
|
|
49
|
+
export const HOOK_PIN_LINE = `#greenrack-hook-pin ${HOOK_MIN_CLI}`;
|
|
50
|
+
export const HOOK_SCRIPT = `#!/bin/sh
|
|
51
|
+
# greenrack design-system session bootstrap — GENERATED by \`greenrack hook install\`.
|
|
52
|
+
# Regenerate: npx -y @greenharness/greenrack-cli@^7 hook install (--check verifies it in CI)
|
|
53
|
+
#
|
|
54
|
+
# Injects the consult-first preamble plus the component catalog into agent
|
|
55
|
+
# context at SessionStart, so "check the design system before building UI" is
|
|
56
|
+
# ambient context instead of a step an agent has to remember. Then runs
|
|
57
|
+
# \`greenrack doctor\`, which says nothing unless this repo's build wiring flattens
|
|
58
|
+
# the components' styles.
|
|
59
|
+
#
|
|
60
|
+
# Do not hand-edit. Repo-specific caveats go in
|
|
61
|
+
# ${HOOK_NOTES_PATH} — appended below, and left alone by regeneration.
|
|
62
|
+
cache="${HOOK_CACHE_PATH}"
|
|
63
|
+
notes="${HOOK_NOTES_PATH}"
|
|
64
|
+
doctor="${HOOK_DOCTOR_CACHE_PATH}"
|
|
65
|
+
pin="${HOOK_PIN_LINE}"
|
|
66
|
+
|
|
67
|
+
# npx resolution dominates session start; the catalog only changes on upgrade.
|
|
68
|
+
# Refetch when it is missing, a week old, fetched with another floor (its
|
|
69
|
+
# first line), or older than this script (a regenerate).
|
|
70
|
+
if [ ! -s "$cache" ] || [ "$(head -n 1 "$cache" 2>/dev/null)" != "$pin" ] ||
|
|
71
|
+
[ -n "$(find "$cache" -mtime +7 2>/dev/null)" ] || [ "${HOOK_SCRIPT_PATH}" -nt "$cache" ]; then
|
|
72
|
+
# The pin is written with the payload, so a failed fetch (or one that
|
|
73
|
+
# printed nothing) leaves the old cache as it was and never a pin-only file.
|
|
74
|
+
if { echo "$pin"; npx -y @greenharness/greenrack-cli@^${HOOK_MIN_CLI} hook session-start; } >"$cache.tmp" 2>/dev/null &&
|
|
75
|
+
[ -n "$(tail -n +2 "$cache.tmp")" ]; then
|
|
76
|
+
mv "$cache.tmp" "$cache"
|
|
77
|
+
else
|
|
78
|
+
rm -f "$cache.tmp"
|
|
79
|
+
if [ -s "$cache" ] && [ "$(head -n 1 "$cache")" != "$pin" ]; then
|
|
80
|
+
echo "greenrack: the catalog below is from an older CLI and could not be refreshed; run: npx -y @greenharness/greenrack-cli@^${HOOK_MIN_CLI} hook install" >&2
|
|
81
|
+
fi
|
|
82
|
+
fi
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
# Offline with no cache yet: stay silent rather than fail the session.
|
|
86
|
+
if [ -s "$cache" ]; then
|
|
87
|
+
# The pin line is bookkeeping, not catalog: skip it, and only it.
|
|
88
|
+
case "$(head -n 1 "$cache")" in
|
|
89
|
+
'#greenrack-hook-pin '*) tail -n +2 "$cache" ;;
|
|
90
|
+
*) cat "$cache" ;;
|
|
91
|
+
esac
|
|
92
|
+
if [ -s "$notes" ]; then
|
|
93
|
+
echo
|
|
94
|
+
cat "$notes"
|
|
95
|
+
fi
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# greenrack doctor reads build config, entries and stylesheets. Re-run it when one
|
|
99
|
+
# of those changes rather than on a timer, so an edit shows up next session
|
|
100
|
+
# and a healthy repo only pays for npx after touching its config.
|
|
101
|
+
key=$(find . -maxdepth 4 \\( -name node_modules -o -name .git -o -name dist -o -name build \\) -prune -o \\
|
|
102
|
+
-type f \\( -name package.json -o -name pnpm-workspace.yaml -o -name '*.css' -o -name 'vite*' \\
|
|
103
|
+
-o -name 'babel*' -o -name '.babelrc*' -o -name '*.babel.*' -o -name 'postcss*' \\
|
|
104
|
+
-o -name 'root.tsx' -o -name 'main.tsx' -o -name 'index.tsx' \\) -exec cksum {} + 2>/dev/null |
|
|
105
|
+
sort | cksum)
|
|
106
|
+
# The floor is part of the key: a new floor reruns the doctor.
|
|
107
|
+
key="${HOOK_MIN_CLI} $key"
|
|
108
|
+
if [ "$key" != "$(cat "$doctor.key" 2>/dev/null)" ]; then
|
|
109
|
+
if npx -y @greenharness/greenrack-cli@^${HOOK_MIN_CLI} doctor --session >"$doctor.tmp" 2>/dev/null; then
|
|
110
|
+
mv "$doctor.tmp" "$doctor"
|
|
111
|
+
echo "$key" >"$doctor.key"
|
|
112
|
+
else
|
|
113
|
+
rm -f "$doctor.tmp"
|
|
114
|
+
fi
|
|
115
|
+
fi
|
|
116
|
+
if [ -s "$doctor" ]; then
|
|
117
|
+
echo
|
|
118
|
+
cat "$doctor"
|
|
119
|
+
fi
|
|
120
|
+
`;
|
|
121
|
+
/**
|
|
122
|
+
* The UserPromptSubmit hook: a plan-mode nudge toward fresh mockup
|
|
123
|
+
* directions (fleet decision `handoff.fresh-directions-trigger`), so a plan
|
|
124
|
+
* that adds a screen or makes a material UI choice puts the direction pick
|
|
125
|
+
* first without anyone typing /greenrack-mockup.
|
|
126
|
+
*/
|
|
127
|
+
export const PLAN_HOOK_SCRIPT_PATH = '.claude/hooks/greenrack-plan.sh';
|
|
128
|
+
/** What settings.json runs on UserPromptSubmit. Also the marker install matches on. */
|
|
129
|
+
export const PLAN_HOOK_COMMAND = `sh ${PLAN_HOOK_SCRIPT_PATH}`;
|
|
130
|
+
/** Printed into the planner's context, and only while in plan mode. */
|
|
131
|
+
export const PLAN_NUDGE = `Planning in a greenrack consumer. If this plan adds a new screen, or makes a material choice in
|
|
132
|
+
layout, hierarchy or interaction (handoff.fresh-directions-trigger), its first 🧑 decision is
|
|
133
|
+
picking a direction: load the greenrack-mockup skill now (greenrack skill install if this repo lacks it; it installs the colors, typography and ui skills too)
|
|
134
|
+
and draw 2–4 directions with \`greenrack mockup\` before ExitPlanMode. A fix that restores an existing
|
|
135
|
+
design reuses the picked artboard instead; any other UI change needs no mockup.
|
|
136
|
+
`;
|
|
137
|
+
/**
|
|
138
|
+
* Runs on every prompt, so it is pure sh with one grep: no npx, no node, no
|
|
139
|
+
* network. Claude Code sends the event as one JSON object on stdin, and
|
|
140
|
+
* stdout of a UserPromptSubmit hook that exits 0 joins the model's context.
|
|
141
|
+
* Every path exits 0 — exit 2 would block the prompt. The whole payload is
|
|
142
|
+
* read before grep runs, so an early grep exit never breaks Claude Code's
|
|
143
|
+
* write. A `"permission_mode":"plan"` typed inside the prompt arrives
|
|
144
|
+
* escaped (\"permission_mode\"), which the pattern does not match.
|
|
145
|
+
*/
|
|
146
|
+
export const PLAN_HOOK_SCRIPT = `#!/bin/sh
|
|
147
|
+
# greenrack plan-mode nudge — GENERATED by \`greenrack hook install\`.
|
|
148
|
+
# Regenerate: npx -y @greenharness/greenrack-cli@^7 hook install (--check verifies it in CI)
|
|
149
|
+
#
|
|
150
|
+
# Claude Code runs this on every UserPromptSubmit with the event as JSON on
|
|
151
|
+
# stdin. In plan mode it prints a short nudge toward fresh mockup directions
|
|
152
|
+
# (handoff.fresh-directions-trigger); otherwise, or on input it cannot read,
|
|
153
|
+
# it prints nothing. Always exits 0: it must never fail the prompt.
|
|
154
|
+
#
|
|
155
|
+
# Do not hand-edit.
|
|
156
|
+
{ payload=$(cat); } 2>/dev/null || exit 0
|
|
157
|
+
if printf '%s\\n' "$payload" |
|
|
158
|
+
grep -Eq '"permission_mode"[[:space:]]*:[[:space:]]*"plan"' 2>/dev/null; then
|
|
159
|
+
cat <<'NUDGE'
|
|
160
|
+
${PLAN_NUDGE}NUDGE
|
|
161
|
+
fi
|
|
162
|
+
exit 0
|
|
163
|
+
`;
|
|
164
|
+
export const GITIGNORE_BLOCK = `# greenrack session-hook cache (greenrack hook install)\n${HOOK_CACHE_IGNORE}\n`;
|
|
165
|
+
//# sourceMappingURL=hook-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-script.js","sourceRoot":"","sources":["../src/hook-script.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yCAAyC;AACzC,MAAM,CAAC,MAAM,gBAAgB,GAAG,oCAAoC,CAAA;AACpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,uBAAuB,CAAA;AACzD,MAAM,CAAC,MAAM,eAAe,GAAG,kCAAkC,CAAA;AACjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,eAAe,SAAS,CAAA;AACjE;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,eAAe,GAAG,CAAA;AACtD,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG,iCAAiC,CAAA;AAEhE,mEAAmE;AACnE,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,gBAAgB,EAAE,CAAA;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAA;AAEnC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,uBAAuB,YAAY,EAAE,CAAA;AAElE,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;IAWvB,eAAe;SACV,eAAe;SACf,eAAe;UACd,sBAAsB;OACzB,aAAa;;;;;;0DAMsC,gBAAgB;;;0DAGhB,YAAY;;;;;;qIAM+D,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2B1I,YAAY;;2CAEwB,YAAY;;;;;;;;;;;CAWtD,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,iCAAiC,CAAA;AAEtE,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,qBAAqB,EAAE,CAAA;AAE9D,uEAAuE;AACvE,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;CAKzB,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;EAc9B,UAAU;;;CAGX,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,4DAA4D,iBAAiB,IAAI,CAAA"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type * from './registry-types.js';
|
|
2
|
+
export { loadRegistry, lookup, lookupNames } from './registry.js';
|
|
3
|
+
export { search, suggestions } from './search.js';
|
|
4
|
+
export { buildManifest, COMMANDS } from './manifest.js';
|
|
5
|
+
export { checkArtboard, seedArtboard, type Finding } from './commands/mockup.js';
|
|
6
|
+
export { runDoctor, type DoctorFinding, type DoctorRule } from './commands/doctor.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,qBAAqB,CAAA;AACxC,OAAO,EAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAA;AACrD,OAAO,EAAC,aAAa,EAAE,YAAY,EAAE,KAAK,OAAO,EAAC,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAC,SAAS,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAC,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { loadRegistry, lookup, lookupNames } from './registry.js';
|
|
2
|
+
export { search, suggestions } from './search.js';
|
|
3
|
+
export { buildManifest, COMMANDS } from './manifest.js';
|
|
4
|
+
export { checkArtboard, seedArtboard } from './commands/mockup.js';
|
|
5
|
+
export { runDoctor } from './commands/doctor.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAE,MAAM,EAAE,WAAW,EAAC,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAC,MAAM,EAAE,WAAW,EAAC,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,eAAe,CAAA;AACrD,OAAO,EAAC,aAAa,EAAE,YAAY,EAAe,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAC,SAAS,EAAsC,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The names the old Duro CLI wrote into a repository. `greenrack hook install`
|
|
3
|
+
* reads them to recognise its predecessor's wiring and migrate it; nothing
|
|
4
|
+
* else spells them.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LEGACY_HOOK_SCRIPT_PATH = ".claude/hooks/duro-catalog.sh";
|
|
7
|
+
export declare const LEGACY_PLAN_HOOK_SCRIPT_PATH = ".claude/hooks/duro-plan.sh";
|
|
8
|
+
export declare const LEGACY_HOOK_NOTES_PATH = ".claude/duro-hook.local.md";
|
|
9
|
+
export declare const LEGACY_HOOK_CACHE_PATH = ".claude/.duro-session.cache";
|
|
10
|
+
/** What the old `duro skill install` wrote: the skill directory, its notes file and the line marking it generated. */
|
|
11
|
+
export declare const LEGACY_SKILL_DIR = ".claude/skills/duro-mockup";
|
|
12
|
+
export declare const LEGACY_SKILL_NOTES_PATH = ".claude/duro-mockup.local.md";
|
|
13
|
+
export declare const LEGACY_SKILL_GENERATED_MARKER = "GENERATED by `duro skill install`";
|
|
14
|
+
/**
|
|
15
|
+
* The old scope's package names and CSS names, which `greenrack doctor` reads
|
|
16
|
+
* until a census finds no app still on them. Nothing else spells them.
|
|
17
|
+
*/
|
|
18
|
+
export declare const LEGACY_UI_PACKAGE = "@duro-app/ui";
|
|
19
|
+
export declare const LEGACY_TOKENS_PACKAGE = "@duro-app/tokens";
|
|
20
|
+
export declare const LEGACY_CLI_PACKAGE = "@duro-app/cli";
|
|
21
|
+
export declare const LEGACY_PROSE_LAYER = "duro-prose";
|
|
22
|
+
export declare const LEGACY_CSS_VARIABLE_PREFIX = "--duro-";
|
|
23
|
+
export declare const LEGACY_DATA_ATTRIBUTE_PREFIX = "data-duro";
|
|
24
|
+
/** The line the old `duro hook install` wrote at the top of both hook scripts. */
|
|
25
|
+
export declare const LEGACY_HOOK_GENERATED_MARKER = "GENERATED by `duro hook install`";
|
|
26
|
+
//# sourceMappingURL=legacy-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-names.d.ts","sourceRoot":"","sources":["../src/legacy-names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,kCAAkC,CAAA;AACtE,eAAO,MAAM,4BAA4B,+BAA+B,CAAA;AACxE,eAAO,MAAM,sBAAsB,+BAA+B,CAAA;AAClE,eAAO,MAAM,sBAAsB,gCAAgC,CAAA;AAEnE,sHAAsH;AACtH,eAAO,MAAM,gBAAgB,+BAA+B,CAAA;AAC5D,eAAO,MAAM,uBAAuB,iCAAiC,CAAA;AACrE,eAAO,MAAM,6BAA6B,sCAAsC,CAAA;AAEhF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,iBAAiB,CAAA;AAC/C,eAAO,MAAM,qBAAqB,qBAAqB,CAAA;AACvD,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AACjD,eAAO,MAAM,kBAAkB,eAAe,CAAA;AAC9C,eAAO,MAAM,0BAA0B,YAAY,CAAA;AACnD,eAAO,MAAM,4BAA4B,cAAc,CAAA;AAEvD,kFAAkF;AAClF,eAAO,MAAM,4BAA4B,qCAAqC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The names the old Duro CLI wrote into a repository. `greenrack hook install`
|
|
3
|
+
* reads them to recognise its predecessor's wiring and migrate it; nothing
|
|
4
|
+
* else spells them.
|
|
5
|
+
*/
|
|
6
|
+
export const LEGACY_HOOK_SCRIPT_PATH = '.claude/hooks/duro-catalog.sh';
|
|
7
|
+
export const LEGACY_PLAN_HOOK_SCRIPT_PATH = '.claude/hooks/duro-plan.sh';
|
|
8
|
+
export const LEGACY_HOOK_NOTES_PATH = '.claude/duro-hook.local.md';
|
|
9
|
+
export const LEGACY_HOOK_CACHE_PATH = '.claude/.duro-session.cache';
|
|
10
|
+
/** What the old `duro skill install` wrote: the skill directory, its notes file and the line marking it generated. */
|
|
11
|
+
export const LEGACY_SKILL_DIR = '.claude/skills/duro-mockup';
|
|
12
|
+
export const LEGACY_SKILL_NOTES_PATH = '.claude/duro-mockup.local.md';
|
|
13
|
+
export const LEGACY_SKILL_GENERATED_MARKER = 'GENERATED by `duro skill install`';
|
|
14
|
+
/**
|
|
15
|
+
* The old scope's package names and CSS names, which `greenrack doctor` reads
|
|
16
|
+
* until a census finds no app still on them. Nothing else spells them.
|
|
17
|
+
*/
|
|
18
|
+
export const LEGACY_UI_PACKAGE = '@duro-app/ui';
|
|
19
|
+
export const LEGACY_TOKENS_PACKAGE = '@duro-app/tokens';
|
|
20
|
+
export const LEGACY_CLI_PACKAGE = '@duro-app/cli';
|
|
21
|
+
export const LEGACY_PROSE_LAYER = 'duro-prose';
|
|
22
|
+
export const LEGACY_CSS_VARIABLE_PREFIX = '--duro-';
|
|
23
|
+
export const LEGACY_DATA_ATTRIBUTE_PREFIX = 'data-duro';
|
|
24
|
+
/** The line the old `duro hook install` wrote at the top of both hook scripts. */
|
|
25
|
+
export const LEGACY_HOOK_GENERATED_MARKER = 'GENERATED by `duro hook install`';
|
|
26
|
+
//# sourceMappingURL=legacy-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-names.js","sourceRoot":"","sources":["../src/legacy-names.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,+BAA+B,CAAA;AACtE,MAAM,CAAC,MAAM,4BAA4B,GAAG,4BAA4B,CAAA;AACxE,MAAM,CAAC,MAAM,sBAAsB,GAAG,4BAA4B,CAAA;AAClE,MAAM,CAAC,MAAM,sBAAsB,GAAG,6BAA6B,CAAA;AAEnE,sHAAsH;AACtH,MAAM,CAAC,MAAM,gBAAgB,GAAG,4BAA4B,CAAA;AAC5D,MAAM,CAAC,MAAM,uBAAuB,GAAG,8BAA8B,CAAA;AACrE,MAAM,CAAC,MAAM,6BAA6B,GAAG,mCAAmC,CAAA;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,cAAc,CAAA;AAC/C,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAA;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAA;AACjD,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAA;AAC9C,MAAM,CAAC,MAAM,0BAA0B,GAAG,SAAS,CAAA;AACnD,MAAM,CAAC,MAAM,4BAA4B,GAAG,WAAW,CAAA;AAEvD,kFAAkF;AAClF,MAAM,CAAC,MAAM,4BAA4B,GAAG,kCAAkC,CAAA"}
|