@imfusion/web-ui 0.5.1-dev.33.gadde98d1 → 0.5.1-dev.39.gfc64049e
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 +18 -10
- package/bin/install.js +96 -42
- package/bin/install.test.ts +150 -64
- package/dist/llms/gen-tokens.d.ts +7 -0
- package/package.json +6 -3
- package/src/llms/install-templates/codex-hooks.json +44 -0
- package/src/llms/install-templates/hooks/session-start.sh +5 -0
- package/src/llms/install-templates/hooks/stop.sh +18 -0
- package/src/llms/install-templates/hooks/subagent-start.sh +5 -0
- package/src/llms/install-templates/hooks/user-prompt-submit.sh +5 -0
- package/src/llms/{skills/imf-web-ui-agent-setup/templates → install-templates}/settings.json +14 -6
- package/src/llms/skills/imf-web-ui/SKILL.md +8 -11
- package/src/llms/skills/imf-web-ui-audit/SKILL.md +87 -0
- package/src/llms/skills/imf-web-ui-components/SKILL.md +1 -1
- package/src/llms/skills/imf-web-ui-conventions/SKILL.md +57 -0
- package/src/llms/skills/imf-web-ui-conventions/templates/AUDIT_CHECKLIST.md +141 -0
- package/src/llms/skills/{imf-web-ui-frontend-setup/templates/FRONTEND_SETUP_REPORT.md → imf-web-ui-conventions/templates/REPORT.md} +4 -4
- package/src/llms/skills/imf-web-ui-conventions/topics/agent-tooling.md +82 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/assets.md +27 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/authentication.md +65 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/class-names.md +50 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/components.md +101 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/data.md +212 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/docs-structure.md +40 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/git.md +34 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/library-boundary.md +33 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/library-setup.md +26 -0
- package/src/llms/skills/{imf-web-ui-frontend-conventions/references → imf-web-ui-conventions/topics}/npm-project.md +14 -18
- package/src/llms/skills/imf-web-ui-conventions/topics/project-structure.md +44 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/react.md +107 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/styling.md +88 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/testing.md +25 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/tokens.md +7 -0
- package/src/llms/skills/imf-web-ui-conventions/topics/tooling.md +116 -0
- package/src/llms/skills/{imf-web-ui-frontend-conventions/references → imf-web-ui-conventions/topics}/typescript.md +3 -4
- package/src/llms/skills/imf-web-ui-conventions/topics/validation.md +62 -0
- package/src/llms/skills/imf-web-ui-setup/SKILL.md +71 -0
- package/src/llms/skills/imf-web-ui-update/SKILL.md +9 -3
- package/src/llms/skills/imf-web-ui-ux/SKILL.md +4 -4
- package/src/llms/skills/imf-web-ui-ux/references/forms.md +2 -2
- package/src/llms/tokens.gen.json +887 -0
- package/src/llms/skills/imf-web-ui-agent-setup/SKILL.md +0 -82
- package/src/llms/skills/imf-web-ui-agent-setup/templates/hooks/post-tool-use.sh +0 -33
- package/src/llms/skills/imf-web-ui-agent-setup/templates/hooks/session-start.sh +0 -4
- package/src/llms/skills/imf-web-ui-agent-setup/templates/hooks/user-prompt-submit.sh +0 -4
- package/src/llms/skills/imf-web-ui-frontend-conventions/SKILL.md +0 -46
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/assets.md +0 -23
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/class-names.md +0 -42
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/components.md +0 -63
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/data.md +0 -201
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/docs-structure.md +0 -44
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/git.md +0 -33
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/library-boundary.md +0 -37
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/project-structure.md +0 -21
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/react.md +0 -110
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/stack.md +0 -39
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/styling.md +0 -91
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/testing.md +0 -18
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/tooling.md +0 -76
- package/src/llms/skills/imf-web-ui-frontend-conventions/references/validation.md +0 -88
- package/src/llms/skills/imf-web-ui-frontend-setup/SKILL.md +0 -66
- package/src/llms/skills/imf-web-ui-frontend-setup/templates/README.md +0 -27
- package/src/llms/skills/imf-web-ui-library-setup/SKILL.md +0 -36
- /package/src/llms/{skills/imf-web-ui-frontend-setup/templates → install-templates}/AGENTS.md +0 -0
- /package/src/llms/{skills/imf-web-ui-agent-setup/templates → install-templates}/hooks/baseline-staleness.sh +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "\"$(git rev-parse --show-toplevel)/.agents/hooks/imf-web-ui/session-start.sh\""
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"Stop": [
|
|
14
|
+
{
|
|
15
|
+
"hooks": [
|
|
16
|
+
{
|
|
17
|
+
"type": "command",
|
|
18
|
+
"command": "\"$(git rev-parse --show-toplevel)/.agents/hooks/imf-web-ui/stop.sh\""
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"SubagentStart": [
|
|
24
|
+
{
|
|
25
|
+
"hooks": [
|
|
26
|
+
{
|
|
27
|
+
"type": "command",
|
|
28
|
+
"command": "\"$(git rev-parse --show-toplevel)/.agents/hooks/imf-web-ui/subagent-start.sh\""
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"UserPromptSubmit": [
|
|
34
|
+
{
|
|
35
|
+
"hooks": [
|
|
36
|
+
{
|
|
37
|
+
"type": "command",
|
|
38
|
+
"command": "\"$(git rev-parse --show-toplevel)/.agents/hooks/imf-web-ui/user-prompt-submit.sh\""
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# SessionStart: inject the web-ui router pointer once per session. Fixed string — the
|
|
3
|
+
# hook-injection eval asserts on it verbatim.
|
|
4
|
+
echo "This project depends on @imfusion/web-ui. Start at the imf-web-ui skill: it decides whether guidance is needed and routes to the right companion. Repo docs carry only what is unique to this repo."
|
|
5
|
+
exit 0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# Stop: the turn-end verify gate. When this turn edited source files, block the
|
|
3
|
+
# agent from finishing once, instructing it to run the project's verification.
|
|
4
|
+
# Both hosts send stop_hook_active=true when the turn continues because of a
|
|
5
|
+
# prior block, so the gate can never loop. Fails open everywhere else: no git,
|
|
6
|
+
# a clean tree, or no edit evidence in the transcript all pass silently.
|
|
7
|
+
PAYLOAD=$(cat)
|
|
8
|
+
printf '%s' "$PAYLOAD" | grep -q '"stop_hook_active"[[:space:]]*:[[:space:]]*true' && exit 0
|
|
9
|
+
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || exit 0
|
|
10
|
+
[ -n "$(git status --porcelain -- '*.ts' '*.tsx' '*.js' '*.jsx' '*.css' 2>/dev/null)" ] || exit 0
|
|
11
|
+
# Gate only turns that actually edited files — a tree left dirty by an earlier
|
|
12
|
+
# session must not block a question-answering turn. Edit evidence: Write/Edit
|
|
13
|
+
# tool calls (Claude transcript) or apply_patch calls (Codex rollout).
|
|
14
|
+
TRANSCRIPT=$(printf '%s' "$PAYLOAD" | sed -n 's/.*"transcript_path"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -n 1)
|
|
15
|
+
[ -f "$TRANSCRIPT" ] || exit 0
|
|
16
|
+
grep -q '"name":"Write"\|"name":"Edit"\|"name":"MultiEdit"\|"name":"NotebookEdit"\|apply_patch' "$TRANSCRIPT" || exit 0
|
|
17
|
+
printf '{"decision":"block","reason":"web-ui stop gate: this turn changed source files. Run the project verification (verify:typecheck, verify:lint, and verify:format at minimum), fix what it reports, then finish. If it already ran after the last change, say so and finish."}\n'
|
|
18
|
+
exit 0
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# SubagentStart: subagents don't reliably inherit the parent session's SessionStart
|
|
3
|
+
# context, so they get the same router pointer. Text byte-identical to session-start.sh.
|
|
4
|
+
echo "This project depends on @imfusion/web-ui. Start at the imf-web-ui skill: it decides whether guidance is needed and routes to the right companion. Repo docs carry only what is unique to this repo."
|
|
5
|
+
exit 0
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# UserPromptSubmit: one-line per-prompt pointer to the companion skills. Fixed string —
|
|
3
|
+
# the hook-injection eval asserts on it verbatim.
|
|
4
|
+
echo "web-ui: check imf-web-ui-components before using a component API, imf-web-ui-conventions before writing code, styles or docs, and imf-web-ui-ux when shaping a screen or flow."
|
|
5
|
+
exit 0
|
package/src/llms/{skills/imf-web-ui-agent-setup/templates → install-templates}/settings.json
RENAMED
|
@@ -11,24 +11,32 @@
|
|
|
11
11
|
]
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"
|
|
14
|
+
"Stop": [
|
|
15
15
|
{
|
|
16
16
|
"hooks": [
|
|
17
17
|
{
|
|
18
18
|
"type": "command",
|
|
19
|
-
"command": "\"$CLAUDE_PROJECT_DIR/.agents/hooks/imf-web-ui/
|
|
19
|
+
"command": "\"$CLAUDE_PROJECT_DIR/.agents/hooks/imf-web-ui/stop.sh\""
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"SubagentStart": [
|
|
25
|
+
{
|
|
26
|
+
"hooks": [
|
|
27
|
+
{
|
|
28
|
+
"type": "command",
|
|
29
|
+
"command": "\"$CLAUDE_PROJECT_DIR/.agents/hooks/imf-web-ui/subagent-start.sh\""
|
|
20
30
|
}
|
|
21
31
|
]
|
|
22
32
|
}
|
|
23
33
|
],
|
|
24
|
-
"
|
|
34
|
+
"UserPromptSubmit": [
|
|
25
35
|
{
|
|
26
|
-
"matcher": "Edit|MultiEdit|Write",
|
|
27
36
|
"hooks": [
|
|
28
37
|
{
|
|
29
38
|
"type": "command",
|
|
30
|
-
"command": "\"$CLAUDE_PROJECT_DIR/.agents/hooks/imf-web-ui/
|
|
31
|
-
"statusMessage": "Verifying file"
|
|
39
|
+
"command": "\"$CLAUDE_PROJECT_DIR/.agents/hooks/imf-web-ui/user-prompt-submit.sh\""
|
|
32
40
|
}
|
|
33
41
|
]
|
|
34
42
|
}
|
|
@@ -24,14 +24,14 @@ Guidance skills exist to fill gaps, not to add ceremony to clear tasks.
|
|
|
24
24
|
|
|
25
25
|
## Routing
|
|
26
26
|
|
|
27
|
-
| The task at hand
|
|
28
|
-
|
|
|
29
|
-
| Using a specific component; checking props, sub-components, or defaults
|
|
30
|
-
| First-time setup, adding a library dependency, or components rendering unstyled/broken
|
|
31
|
-
| Building/reshaping a screen or flow; choosing between components; layout, density, hierarchy, states
|
|
32
|
-
| Writing wrappers or custom UI; styling beyond defaults; adding files; TypeScript, naming, testing
|
|
33
|
-
| Setting up or auditing an **ImFusion** repo's tooling: formatting, linting, hooks, scripts, structure
|
|
34
|
-
|
|
|
27
|
+
| The task at hand | Open |
|
|
28
|
+
| ----------------------------------------------------------------------------------------------------- | --------------------------------------- |
|
|
29
|
+
| Using a specific component; checking props, sub-components, or defaults | `imf-web-ui-components` |
|
|
30
|
+
| First-time setup, adding a library dependency, or components rendering unstyled/broken | `imf-web-ui-setup` (`library-setup`) |
|
|
31
|
+
| Building/reshaping a screen or flow; choosing between components; layout, density, hierarchy, states | `imf-web-ui-ux` |
|
|
32
|
+
| Writing wrappers or custom UI; styling beyond defaults; adding files; TypeScript, naming, testing | `imf-web-ui-conventions` |
|
|
33
|
+
| Setting up or auditing an **ImFusion** repo's tooling: formatting, linting, hooks, scripts, structure | `imf-web-ui-setup` / `imf-web-ui-audit` |
|
|
34
|
+
| Installing or checking agent tooling: vendored skills, lifecycle hooks, registrations, and staleness | `imf-web-ui-setup` / `imf-web-ui-audit` |
|
|
35
35
|
|
|
36
36
|
The two setup rows are narrow on purpose. They're for "what is this project missing?" — a question about the repo as a whole.
|
|
37
37
|
Being asked to add one config file is just that edit; make it, and don't open a skill to do so.
|
|
@@ -44,9 +44,6 @@ APIs. That's normal — open both, in that order.
|
|
|
44
44
|
TanStack is the recommended tooling library — routing, server state, forms, tables. When a task needs one of those and the
|
|
45
45
|
project has no incumbent, propose it, and read the library's own docs (`npx @tanstack/cli`) rather than working from memory.
|
|
46
46
|
|
|
47
|
-
Much of the suite also ships Agent Skills inside the package, reachable via TanStack Intent. Wiring that up is
|
|
48
|
-
`imf-web-ui-agent-setup`.
|
|
49
|
-
|
|
50
47
|
## When to interview the human
|
|
51
48
|
|
|
52
49
|
`imf-web-ui-ux` contains a short per-feature interview. Run it **only** when both hold:
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: imf-web-ui-audit
|
|
3
|
+
description:
|
|
4
|
+
"Read-only health check for an ImFusion frontend against the conventions baseline. Audit the full project or any topic,
|
|
5
|
+
including library-setup, tooling, git, npm-project, authentication, project-structure, docs-structure, data, testing,
|
|
6
|
+
React, TypeScript, class names, validation, components, styling, assets, library-boundary, and tokens. Reports broken
|
|
7
|
+
pieces, missing pieces, working deviations, present evidence, and unverified state in AUDIT_REPORT.md."
|
|
8
|
+
argument-hint: "[full|<topic>]"
|
|
9
|
+
allowed-tools: Read Glob Grep
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# imf-web-ui-audit
|
|
13
|
+
|
|
14
|
+
You are the frontend health-check auditor. Investigate the repository statically, record every supported conclusion in
|
|
15
|
+
`AUDIT_REPORT.md`, and return the report path and a short verdict. Follow the applicable `imf-web-ui-conventions` topics,
|
|
16
|
+
cite repository evidence, distinguish defects from working deviations, and never present the baseline as universal best
|
|
17
|
+
practice.
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. Resolve the argument. Bare means `full`; a topic selects one row below. If no topic matches, list every available topic
|
|
22
|
+
instead of guessing or widening the scope.
|
|
23
|
+
2. Read every applicable convention topic and inspect the repository with `Read`, `Glob`, and `Grep` only.
|
|
24
|
+
3. Work through the shared [convention audit checklist](../imf-web-ui-conventions/templates/AUDIT_CHECKLIST.md), checking
|
|
25
|
+
every row for a full audit and the requested row plus dependencies for a scoped audit.
|
|
26
|
+
4. Check the complete installed skill bundle, version markers, AGENTS fence, lifecycle hooks, registrations, and staleness
|
|
27
|
+
wiring when `agent-tooling` is in scope. Compare the declared version in `package.json`, the installed
|
|
28
|
+
`node_modules/@imfusion/web-ui/package.json`, and every `.imf-web-ui-skill-version.json` marker. Report drift and point at
|
|
29
|
+
`imf-web-ui-update`. The registry is unreachable from this audit, so a line saying that a newer version may exist is
|
|
30
|
+
unverified.
|
|
31
|
+
5. Write or refresh `AUDIT_REPORT.md` from the shared report contract at
|
|
32
|
+
[`../imf-web-ui-conventions/templates/REPORT.md`](../imf-web-ui-conventions/templates/REPORT.md), changing the mode label
|
|
33
|
+
to `audit`. The template is the report contract. Preserve everything under `## Reviewer notes` verbatim.
|
|
34
|
+
|
|
35
|
+
## Checklist
|
|
36
|
+
|
|
37
|
+
Use the shared [convention audit checklist](../imf-web-ui-conventions/templates/AUDIT_CHECKLIST.md) as the working checklist.
|
|
38
|
+
The report is not complete until the applicable rows have been inspected and their evidence is reflected in the report. The
|
|
39
|
+
checklist itself is not edited during an audit.
|
|
40
|
+
|
|
41
|
+
## Safety
|
|
42
|
+
|
|
43
|
+
Use only static inspection: Read, Glob, Grep, and equivalent non-executing search tools. Do not use a shell or invoke Node,
|
|
44
|
+
npm, npx, package scripts, hooks, config imports, linters, tests, builds, Git commands, or project binaries. Read config as
|
|
45
|
+
text and report runtime or machine-local state that cannot be established statically as unverified.
|
|
46
|
+
|
|
47
|
+
Only `AUDIT_REPORT.md` may be written. Write is intentionally not pre-approved in `allowed-tools`; the report follows the
|
|
48
|
+
host's ordinary write approval. Host-managed hooks may run after that write; the skill neither invokes nor suppresses them,
|
|
49
|
+
but it does report broken or unexpected hook behavior found during static inspection.
|
|
50
|
+
|
|
51
|
+
## Topics
|
|
52
|
+
|
|
53
|
+
| Topic | Assess |
|
|
54
|
+
| ------------------- | ------------------------------------------------------------------------------ |
|
|
55
|
+
| `library-setup` | styles import, `WebUIProvider`, and library package wiring |
|
|
56
|
+
| `library-boundary` | imports, wrappers, type derivation, and peer boundaries |
|
|
57
|
+
| `react` | component roles, state ownership, and effects discipline |
|
|
58
|
+
| `components` | component folders, anatomy, and colocation |
|
|
59
|
+
| `typescript` | functional style, types, and naming |
|
|
60
|
+
| `styling` | CSS Modules, tokens, and prohibited styling systems |
|
|
61
|
+
| `tokens` | names, authored default values, and families from the shipped token index |
|
|
62
|
+
| `class-names` | CVA variants, `cx`, and incoming `className` handling |
|
|
63
|
+
| `validation` | runtime schemas, boundary parsing, and derived types |
|
|
64
|
+
| `data` | transport, schemas, query/mutation options, keys, and invalidation |
|
|
65
|
+
| `authentication` | current-user query, public/app guards, login, and logout |
|
|
66
|
+
| `project-structure` | source tree, route groups, optional app shell, naming, and imports |
|
|
67
|
+
| `testing` | test boundaries and verification coverage |
|
|
68
|
+
| `npm-project` | package metadata, scripts, pins, npm, and Node configuration |
|
|
69
|
+
| `tooling` | dependency selection, devtools, Prettier, ESLint, TypeScript, and verification |
|
|
70
|
+
| `git` | tracked hooks, verification scopes, and staleness wiring |
|
|
71
|
+
| `assets` | image formats and static asset handling |
|
|
72
|
+
| `docs-structure` | README, AGENTS, docs index, and content boundaries |
|
|
73
|
+
| `agent-tooling` | installed skills, AGENTS fence, lifecycle hooks, registrations, staleness |
|
|
74
|
+
|
|
75
|
+
Report everything within the selected topic: defects and working deviations alike, with no severity-based filtering.
|
|
76
|
+
|
|
77
|
+
## Agent-tooling assessment reference
|
|
78
|
+
|
|
79
|
+
The baseline is the conventions [agent-tooling topic](../imf-web-ui-conventions/topics/agent-tooling.md): the complete bundle
|
|
80
|
+
with matching version markers, the AGENTS fence, and the lifecycle hooks installed and registered for both hosts
|
|
81
|
+
(`.claude/settings.json` and `.codex/hooks.json`) or consciously adapted. Hooks or registrations beyond the shipped set — the
|
|
82
|
+
three injection hooks, the stop gate, plus `baseline-staleness.sh` — are drift, and the tracked pre-commit path calls
|
|
83
|
+
`baseline-staleness.sh`. Read files and settings as text—do not run installers, hooks, or local config queries during
|
|
84
|
+
assessment.
|
|
85
|
+
|
|
86
|
+
Use the shared report template as the report contract. It defines the headings, ordering, empty-section marker, evidence
|
|
87
|
+
format, and reviewer-note preservation rules; do not duplicate that contract here.
|
|
@@ -3,7 +3,7 @@ name: imf-web-ui-components
|
|
|
3
3
|
description:
|
|
4
4
|
"Look up @imfusion/web-ui component APIs without reading their source: the two-hop lookup (identity index -> prop data),
|
|
5
5
|
compound components, and integrations. Load when you need the props, sub-components, or defaults of a specific component —
|
|
6
|
-
not for choosing between components (imf-web-ui-ux) or first-time setup (imf-web-ui-library-setup)."
|
|
6
|
+
not for choosing between components (imf-web-ui-ux) or first-time setup (imf-web-ui-setup library-setup)."
|
|
7
7
|
allowed-tools: Bash
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: imf-web-ui-conventions
|
|
3
|
+
description:
|
|
4
|
+
"The ImFusion frontend conventions baseline — in-house conventions, valid in every ImFusion frontend and usable by anyone
|
|
5
|
+
who likes them. A router over topic references: library setup, library boundary, React, components, TypeScript, styling,
|
|
6
|
+
tokens, validation, data layer, authentication, project structure, testing, tooling, npm project, git, agent tooling,
|
|
7
|
+
assets, and docs structure. Load when writing wrapper components, custom UI, styling beyond the defaults, validating
|
|
8
|
+
external data, adding new files to a consumer app, writing repo docs, touching tool config, choosing any dependency, or
|
|
9
|
+
installing the vendored skills and lifecycle hooks."
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# imf-web-ui-conventions
|
|
13
|
+
|
|
14
|
+
The ImFusion frontend baseline. In-house conventions, not industry claims — they encode how ImFusion frontends are built, and
|
|
15
|
+
anyone else is welcome to them.
|
|
16
|
+
|
|
17
|
+
**The project wins.** These defaults fill vacuums: if the host project already has a convention — a styling system, a state
|
|
18
|
+
library, a folder shape — that stands. They are not a license to refactor a consumer codebase toward this document.
|
|
19
|
+
|
|
20
|
+
When a project has an established convention, it wins. The audit skill records a working difference as a deviation; the setup
|
|
21
|
+
skill proposes only the changes the project asks it to make.
|
|
22
|
+
|
|
23
|
+
## The topics
|
|
24
|
+
|
|
25
|
+
Each topic lives in one reference. Read the one whose moment you're in; starting a new feature usually wants several.
|
|
26
|
+
|
|
27
|
+
| Reference | Covers | Read when |
|
|
28
|
+
| --------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
29
|
+
| [library-setup.md](topics/library-setup.md) | styles import, `WebUIProvider`, and broken library wiring | installing or repairing library wiring |
|
|
30
|
+
| [library-boundary.md](topics/library-boundary.md) | staying behind `@imfusion/web-ui`, wrappers, type derivation, peers | touching anything that renders library components |
|
|
31
|
+
| [authentication.md](topics/authentication.md) | current-user source, public/app guards, login and logout | setting up or reviewing route protection |
|
|
32
|
+
| [react.md](topics/react.md) | component roles, state kinds and owners, effects discipline | writing new screens, components, or wrappers |
|
|
33
|
+
| [components.md](topics/components.md) | component anatomy on disk: grouping, folders, colocation | adding a component file |
|
|
34
|
+
| [typescript.md](topics/typescript.md) | functional style, types, naming | writing any code |
|
|
35
|
+
| [styling.md](topics/styling.md) | native CSS Modules, tokens, the override contract | writing CSS or styling beyond the defaults |
|
|
36
|
+
| [tokens.md](topics/tokens.md) | shipped CSS-variable names grouped by family | choosing a design token |
|
|
37
|
+
| [class-names.md](topics/class-names.md) | CVA variants, `cx`, merging the incoming `className` | writing a component with variants or a `className` prop |
|
|
38
|
+
| [validation.md](topics/validation.md) | runtime schemas, boundary parsing, schema-derived types | accepting data the frontend does not own |
|
|
39
|
+
| [data.md](topics/data.md) | `api/`+`http/` shape, query/mutation patterns and invalidation | adding an API topic, a fetch, or a mutation |
|
|
40
|
+
| [project-structure.md](topics/project-structure.md) | the `src/` tree, route groups, file naming, imports | adding files rather than editing existing ones |
|
|
41
|
+
| [testing.md](topics/testing.md) | what's worth testing and what isn't | writing or reviewing tests |
|
|
42
|
+
| [tooling.md](topics/tooling.md) | the topic→tool map, tool configuration, and verification | choosing a dependency or touching tool config |
|
|
43
|
+
| [npm-project.md](topics/npm-project.md) | `package.json`, the `verify:*` script set, dependency pinning | running or adding a script, adding a dependency |
|
|
44
|
+
| [git.md](topics/git.md) | `git:config`, verify scopes, staleness at commit time | wiring hooks or the commit path |
|
|
45
|
+
| [agent-tooling.md](topics/agent-tooling.md) | vendored skills, lifecycle hooks, registrations, Codex trust | installing or reviewing the shipped agent tooling |
|
|
46
|
+
| [assets.md](topics/assets.md) | image formats, the WebP recipe | adding images or other static assets |
|
|
47
|
+
| [docs-structure.md](topics/docs-structure.md) | what a repo documents, where, how it's written | writing or restructuring repo docs |
|
|
48
|
+
|
|
49
|
+
## Topic format
|
|
50
|
+
|
|
51
|
+
Topics are manifests, not essays: `##` sections group rule bullets, and each section is one auditable unit. A rule is one
|
|
52
|
+
imperative bullet; only a pushback-prone rule carries a one-line why. Snippets illustrate rules, prose never replaces them.
|
|
53
|
+
Each topic's `##` sections map 1:1 to its block in [templates/AUDIT_CHECKLIST.md](templates/AUDIT_CHECKLIST.md) — add,
|
|
54
|
+
remove, or rename a section and the checklist follows in the same change.
|
|
55
|
+
|
|
56
|
+
`imf-web-ui-setup` proposes approved bootstrap changes, while `imf-web-ui-audit` reports the current state against this
|
|
57
|
+
baseline.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Convention audit checklist
|
|
2
|
+
|
|
3
|
+
One block per topic, one box per topic section. Check a box only after checking that section's rules against the repo. A full
|
|
4
|
+
audit checks every box; a scoped audit names its topics first and checks only their blocks. Blocks mirror each topic's `##`
|
|
5
|
+
sections one to one — change a topic's sections and this file follows in the same commit.
|
|
6
|
+
|
|
7
|
+
## Library setup — `library-setup`
|
|
8
|
+
|
|
9
|
+
- [ ] Entry-point wiring
|
|
10
|
+
- [ ] Symptoms of broken setup
|
|
11
|
+
|
|
12
|
+
## Library boundary — `library-boundary`
|
|
13
|
+
|
|
14
|
+
- [ ] Stay behind the library
|
|
15
|
+
- [ ] Wrap primitives when the app has a reason to
|
|
16
|
+
- [ ] Derive types, don't import them
|
|
17
|
+
- [ ] Integrations own their peers
|
|
18
|
+
- [ ] Styling crosses the boundary through seams
|
|
19
|
+
|
|
20
|
+
## Authentication — `authentication`
|
|
21
|
+
|
|
22
|
+
- [ ] Starter shape
|
|
23
|
+
- [ ] One current-user query
|
|
24
|
+
- [ ] The two route groups
|
|
25
|
+
- [ ] Login and logout
|
|
26
|
+
- [ ] App shell
|
|
27
|
+
|
|
28
|
+
## Project structure — `project-structure`
|
|
29
|
+
|
|
30
|
+
- [ ] Layout
|
|
31
|
+
- [ ] Application boundary
|
|
32
|
+
- [ ] Imports
|
|
33
|
+
|
|
34
|
+
## React — `react`
|
|
35
|
+
|
|
36
|
+
- [ ] Composition: pages (smart containers), partials, dumb components
|
|
37
|
+
- [ ] Compose, don't configure
|
|
38
|
+
- [ ] Put state where its truth lives
|
|
39
|
+
- [ ] Effects: last resort, and named
|
|
40
|
+
- [ ] Reading list
|
|
41
|
+
|
|
42
|
+
## Components — `components`
|
|
43
|
+
|
|
44
|
+
- [ ] As dumb as possible
|
|
45
|
+
- [ ] Grouping
|
|
46
|
+
- [ ] One file or a folder
|
|
47
|
+
- [ ] Colocation
|
|
48
|
+
|
|
49
|
+
## TypeScript & code style — `typescript`
|
|
50
|
+
|
|
51
|
+
- [ ] Types
|
|
52
|
+
- [ ] Immutability & expressions
|
|
53
|
+
- [ ] Naming
|
|
54
|
+
|
|
55
|
+
## Styling — `styling`
|
|
56
|
+
|
|
57
|
+
- [ ] CSS authoring
|
|
58
|
+
- [ ] Build custom UI from tokens
|
|
59
|
+
- [ ] Override through the sanctioned seams
|
|
60
|
+
- [ ] The color system
|
|
61
|
+
- [ ] Responsive styling
|
|
62
|
+
|
|
63
|
+
## Tokens — `tokens`
|
|
64
|
+
|
|
65
|
+
- [ ] Token index
|
|
66
|
+
|
|
67
|
+
## Class names in components — `class-names`
|
|
68
|
+
|
|
69
|
+
- [ ] CVA is the only tool
|
|
70
|
+
- [ ] Merging `className`
|
|
71
|
+
- [ ] Shared CVA modules
|
|
72
|
+
|
|
73
|
+
## Validation — `validation`
|
|
74
|
+
|
|
75
|
+
- [ ] Boundaries
|
|
76
|
+
- [ ] Schema first, type derived
|
|
77
|
+
- [ ] TanStack Router search params
|
|
78
|
+
- [ ] Failure handling
|
|
79
|
+
|
|
80
|
+
## Data — `data`
|
|
81
|
+
|
|
82
|
+
- [ ] The shape
|
|
83
|
+
- [ ] The network boundary validates
|
|
84
|
+
- [ ] Errors are values
|
|
85
|
+
- [ ] Topic registry and key factory
|
|
86
|
+
- [ ] Options factories and naming
|
|
87
|
+
- [ ] Router context access
|
|
88
|
+
- [ ] Automatic invalidation
|
|
89
|
+
- [ ] Testing the data layer
|
|
90
|
+
|
|
91
|
+
## Testing — `testing`
|
|
92
|
+
|
|
93
|
+
- [ ] Naming
|
|
94
|
+
- [ ] What gets a test
|
|
95
|
+
- [ ] Layer-specific recipes
|
|
96
|
+
|
|
97
|
+
## Tooling — `tooling`
|
|
98
|
+
|
|
99
|
+
- [ ] Topic-to-tool map
|
|
100
|
+
- [ ] When a library owns a layer
|
|
101
|
+
- [ ] Devtools
|
|
102
|
+
- [ ] Docs over memory
|
|
103
|
+
- [ ] Prettier
|
|
104
|
+
- [ ] ESLint
|
|
105
|
+
- [ ] tsconfig
|
|
106
|
+
- [ ] Staged files
|
|
107
|
+
- [ ] CSS class names
|
|
108
|
+
|
|
109
|
+
## npm project — `npm-project`
|
|
110
|
+
|
|
111
|
+
- [ ] package.json
|
|
112
|
+
- [ ] Scripts
|
|
113
|
+
- [ ] Dependencies
|
|
114
|
+
|
|
115
|
+
## Git — `git`
|
|
116
|
+
|
|
117
|
+
- [ ] git:config
|
|
118
|
+
- [ ] Verify scopes
|
|
119
|
+
- [ ] Staleness at commit time
|
|
120
|
+
|
|
121
|
+
## Assets — `assets`
|
|
122
|
+
|
|
123
|
+
- [ ] Importing
|
|
124
|
+
- [ ] Photographs — WebP
|
|
125
|
+
- [ ] Other formats
|
|
126
|
+
- [ ] Scope
|
|
127
|
+
|
|
128
|
+
## Documentation structure — `docs-structure`
|
|
129
|
+
|
|
130
|
+
- [ ] The shape
|
|
131
|
+
- [ ] Repo docs hold only what is unique to the repo
|
|
132
|
+
- [ ] How docs are written
|
|
133
|
+
- [ ] Staleness at commit time
|
|
134
|
+
|
|
135
|
+
## Agent tooling — `agent-tooling`
|
|
136
|
+
|
|
137
|
+
- [ ] The skill bundle
|
|
138
|
+
- [ ] The hooks
|
|
139
|
+
- [ ] Codex trust
|
|
140
|
+
- [ ] Dependency-shipped skills
|
|
141
|
+
- [ ] Hook docs
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Frontend
|
|
1
|
+
# Frontend Report
|
|
2
2
|
|
|
3
|
-
Mode: `<
|
|
3
|
+
Mode: `<setup|audit>` Scope: `<all applicable topics or the resolved topic>`
|
|
4
4
|
|
|
5
5
|
<!--
|
|
6
6
|
This template is the report contract. Keep every H2 below once and in this order.
|
|
@@ -12,8 +12,8 @@ Broken, Missing, Deviations, and Unverified entries use:
|
|
|
12
12
|
- Impact: concrete consequence
|
|
13
13
|
- Next action: smallest selectable follow-up
|
|
14
14
|
|
|
15
|
-
Present entries name the
|
|
16
|
-
|
|
15
|
+
Present entries name the topic and evidence path. Deviations are selectable follow-up work, not defects. Optional tools are not
|
|
16
|
+
missing findings.
|
|
17
17
|
-->
|
|
18
18
|
|
|
19
19
|
## Verdict
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Agent tooling
|
|
2
|
+
|
|
3
|
+
How a consumer repo carries the `@imfusion/web-ui` agent tooling; `npx web-ui-install` does the mechanics, this topic carries
|
|
4
|
+
the judgment.
|
|
5
|
+
|
|
6
|
+
## The skill bundle
|
|
7
|
+
|
|
8
|
+
- `npx web-ui-install` installs or refreshes the vendored `imf-web-ui-*` skills, refreshes the
|
|
9
|
+
`<!-- imf-web-ui:begin/end -->` fence in an existing `AGENTS.md`, and removes skills dropped from the bundle.
|
|
10
|
+
- Target: remembered first-run choice — `.claude/skills/`, vendor-neutral `.agents/skills/`, or both (`.agents/` real copy,
|
|
11
|
+
`.claude/` symlink); `--reconfigure` re-opens it, `--target claude|agents` selects non-interactively.
|
|
12
|
+
- Staleness: per-skill `.imf-web-ui-skill-version.json`; a marker older than the installed package means re-run the binary —
|
|
13
|
+
never hand-diff or hand-edit vendored skill contents.
|
|
14
|
+
|
|
15
|
+
## The hooks
|
|
16
|
+
|
|
17
|
+
- `npx web-ui-install --hooks` adds three injection hooks and a turn-end gate.
|
|
18
|
+
- Scripts in `.agents/hooks/imf-web-ui/` are installer-owned: refreshed wholesale each run, retired scripts pruned with their
|
|
19
|
+
registrations.
|
|
20
|
+
- Registrations merge idempotently into `.claude/settings.json` (Claude Code) and `.codex/hooks.json` (Codex), never touching
|
|
21
|
+
entries the installer didn't write.
|
|
22
|
+
|
|
23
|
+
- **SessionStart** — once per session: points the agent at the `imf-web-ui` skills router.
|
|
24
|
+
- **SubagentStart** — the same line, byte for byte, for each spawned subagent; subagents don't reliably inherit the parent
|
|
25
|
+
session's context.
|
|
26
|
+
- **UserPromptSubmit** — one line per prompt naming the companion skills to consult.
|
|
27
|
+
- **Stop** — the verify gate: when the turn edited source files, it blocks the agent from finishing once, with the
|
|
28
|
+
instruction to run the project's verification and fix what it reports. Re-entry is detected from the payload, so the gate
|
|
29
|
+
can never loop; a turn that edited nothing passes untouched.
|
|
30
|
+
|
|
31
|
+
```mermaid
|
|
32
|
+
flowchart LR
|
|
33
|
+
SS(["SessionStart<br/>once per session"]) --> ss["session-start.sh"]
|
|
34
|
+
SA(["SubagentStart<br/>per spawned subagent"]) --> sa["subagent-start.sh"]
|
|
35
|
+
UP(["UserPromptSubmit<br/>every prompt"]) --> up["user-prompt-submit.sh"]
|
|
36
|
+
ST(["Stop<br/>turn ends after edits"]) --> st["stop.sh"]
|
|
37
|
+
ss --> router["injects the router pointer:<br/>start at imf-web-ui"]
|
|
38
|
+
sa --> router
|
|
39
|
+
up --> hints["injects the per-task hints:<br/>components · conventions · ux"]
|
|
40
|
+
st --> gate["blocks once:<br/>run verification first"]
|
|
41
|
+
router --> agent["agent routes to the right<br/>companion skill"]
|
|
42
|
+
hints --> agent
|
|
43
|
+
gate --> agent2["agent verifies,<br/>then finishes"]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- Each injection hook echoes one fixed line and exits 0; the router does the task-sorting a shell script can't — why a hint
|
|
47
|
+
on every prompt isn't noise.
|
|
48
|
+
- `baseline-staleness.sh` ships alongside but is not an agent hook; the repo's pre-commit calls it ([git.md](./git.md),
|
|
49
|
+
staleness at commit time).
|
|
50
|
+
- Never edit an installed script — the next install overwrites it; adapt in the repo's own hooks.
|
|
51
|
+
- Registration entries are yours: the installer matches by script name and keeps edited commands across re-runs. Monorepo:
|
|
52
|
+
the Codex commands anchor at `$(git rev-parse --show-toplevel)` — adjust their paths once after installing when the
|
|
53
|
+
frontend isn't the git toplevel.
|
|
54
|
+
- **Read the registration files before installing**; per event: nothing registered → install as shipped; already covered by
|
|
55
|
+
the repo (its own session reminder, say) → don't stack a second hook — fold the missing line into the repo's script, or
|
|
56
|
+
adapt the shipped one and register that; surface it and let the human pick.
|
|
57
|
+
|
|
58
|
+
## Codex trust
|
|
59
|
+
|
|
60
|
+
- Codex runs a project's hooks only when two trust gates hold: the project itself is trusted, and each hook script has been
|
|
61
|
+
trusted via the `/hooks` review, which keys trust to the script's hash.
|
|
62
|
+
- Until then hooks are skipped, and skipped silently — from outside, a skipped hook and a hook that ran and said nothing look
|
|
63
|
+
identical.
|
|
64
|
+
- After installing or updating hooks, tell the user to trust the project and review `/hooks` in Codex, and again after any
|
|
65
|
+
hook script changes.
|
|
66
|
+
- When a hint doesn't show up, check trust before debugging the script.
|
|
67
|
+
- Claude Code has no trust gate for project hooks.
|
|
68
|
+
|
|
69
|
+
## Dependency-shipped skills
|
|
70
|
+
|
|
71
|
+
- npm packages can ship Agent Skills of their own; TanStack does — [tooling.md](./tooling.md) covers TanStack Intent and its
|
|
72
|
+
allowlist.
|
|
73
|
+
|
|
74
|
+
## Hook docs
|
|
75
|
+
|
|
76
|
+
Both hosts move fast; read the current references before adapting or adding a hook — payloads and stdout rules differ per
|
|
77
|
+
host and per event.
|
|
78
|
+
|
|
79
|
+
- [Claude Code: hooks reference](https://code.claude.com/docs/en/hooks) — event list, JSON input and output, exit codes,
|
|
80
|
+
`disableAllHooks`
|
|
81
|
+
- [Codex: hooks](https://learn.chatgpt.com/docs/hooks) — events, the `hooks.json` schema, trust, `/hooks`
|
|
82
|
+
- [Codex: config reference](https://learn.chatgpt.com/docs/config-file/config-reference) — `[features]` and `[hooks.state]`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Assets
|
|
2
|
+
|
|
3
|
+
## Importing
|
|
4
|
+
|
|
5
|
+
- Import everything from `src/assets/` so the bundler fingerprints and bundles it. Never reference an image by public-path
|
|
6
|
+
string.
|
|
7
|
+
|
|
8
|
+
## Photographs — WebP
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
magick source.png -resize 2000x -quality 80 -define webp:method=6 src/assets/name.webp
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
- Quality 80 — visually lossless on photos, routinely an order of magnitude smaller.
|
|
15
|
+
- `method=6` — densest encoding; a one-off cost at conversion time, so take the smaller file.
|
|
16
|
+
- Long edge ≤ 2000px — nothing on the market resolves more in a content image.
|
|
17
|
+
- No `<picture>` fallback — WebP is supported everywhere since 2020.
|
|
18
|
+
|
|
19
|
+
## Other formats
|
|
20
|
+
|
|
21
|
+
- Alpha, or pixels that must stay exact → PNG, optimized with `oxipng` or `pngquant`.
|
|
22
|
+
- Icons, logos, line art → inline SVG component, so it inherits `currentColor` and follows the theme.
|
|
23
|
+
|
|
24
|
+
## Scope
|
|
25
|
+
|
|
26
|
+
- Rules apply to assets as they're added or touched. Existing assets in another format are not findings to sweep — convert
|
|
27
|
+
opportunistically.
|