@1agh/maude 0.19.0 → 0.20.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.
- package/package.json +9 -9
- package/plugins/design/dev-server/annotations-context-toolbar.tsx +126 -44
- package/plugins/design/dev-server/annotations-layer.tsx +343 -112
- package/plugins/design/dev-server/api.ts +70 -17
- package/plugins/design/dev-server/artboard-marquee.tsx +174 -0
- package/plugins/design/dev-server/bin/asset-sweep.sh +180 -0
- package/plugins/design/dev-server/bin/visual-sanity.sh +221 -0
- package/plugins/design/dev-server/canvas-lib.tsx +691 -119
- package/plugins/design/dev-server/canvas-shell.tsx +818 -42
- package/plugins/design/dev-server/client/app.jsx +173 -52
- package/plugins/design/dev-server/client/hmr.mjs +28 -0
- package/plugins/design/dev-server/client/styles/1-tokens.css +15 -8
- package/plugins/design/dev-server/client/styles/4-components.css +32 -2
- package/plugins/design/dev-server/commands/annotation-strokes-command.ts +127 -0
- package/plugins/design/dev-server/commands/equal-spacing-command.ts +28 -0
- package/plugins/design/dev-server/commands/move-artboards-command.ts +158 -0
- package/plugins/design/dev-server/comments-overlay.tsx +12 -4
- package/plugins/design/dev-server/config.schema.json +31 -5
- package/plugins/design/dev-server/context-menu.tsx +3 -3
- package/plugins/design/dev-server/context.ts +37 -3
- package/plugins/design/dev-server/contextual-toolbar.tsx +241 -0
- package/plugins/design/dev-server/dist/client.bundle.js +212 -103
- package/plugins/design/dev-server/dist/runtime/motion.js +165 -0
- package/plugins/design/dev-server/dist/runtime/motion_react.js +409 -0
- package/plugins/design/dev-server/dist/styles.css +38 -2
- package/plugins/design/dev-server/equal-spacing-detector.ts +98 -0
- package/plugins/design/dev-server/equal-spacing-handles.tsx +289 -0
- package/plugins/design/dev-server/export-dialog.tsx +3 -3
- package/plugins/design/dev-server/handoff.ts +24 -0
- package/plugins/design/dev-server/http.ts +41 -2
- package/plugins/design/dev-server/input-router.tsx +74 -10
- package/plugins/design/dev-server/marquee-overlay.tsx +282 -0
- package/plugins/design/dev-server/runtime-bundle.ts +7 -0
- package/plugins/design/dev-server/server.mjs +84 -18
- package/plugins/design/dev-server/test/annotation-strokes-command.test.ts +149 -0
- package/plugins/design/dev-server/test/annotations-layer.test.ts +44 -0
- package/plugins/design/dev-server/test/canvas-lib-motion.test.ts +131 -0
- package/plugins/design/dev-server/test/context-resolve-tokens.test.ts +97 -0
- package/plugins/design/dev-server/test/equal-spacing-detector.test.ts +93 -0
- package/plugins/design/dev-server/test/input-router.test.ts +87 -1
- package/plugins/design/dev-server/test/marquee-overlay.test.ts +94 -0
- package/plugins/design/dev-server/test/move-artboards-command.test.ts +108 -0
- package/plugins/design/dev-server/test/snap-distance-pill.test.ts +68 -0
- package/plugins/design/dev-server/test/system-endpoint.test.ts +144 -0
- package/plugins/design/dev-server/test/undo-stack.test.ts +211 -0
- package/plugins/design/dev-server/test/use-cursor-modifiers.test.ts +59 -0
- package/plugins/design/dev-server/test/use-keyboard-discipline.test.ts +27 -0
- package/plugins/design/dev-server/test/use-undo-stack.test.tsx +193 -0
- package/plugins/design/dev-server/tool-palette.tsx +71 -15
- package/plugins/design/dev-server/undo-hud.tsx +95 -0
- package/plugins/design/dev-server/undo-stack.ts +240 -0
- package/plugins/design/dev-server/use-annotation-resize.tsx +295 -0
- package/plugins/design/dev-server/use-artboard-drag.tsx +6 -3
- package/plugins/design/dev-server/use-cursor-modifiers.tsx +122 -0
- package/plugins/design/dev-server/use-keyboard-discipline.tsx +125 -0
- package/plugins/design/dev-server/use-snap-guides.tsx +25 -1
- package/plugins/design/dev-server/use-tool-mode.tsx +31 -2
- package/plugins/design/dev-server/use-undo-stack.tsx +355 -0
- package/plugins/design/templates/_shell.html +17 -6
- package/plugins/design/templates/design-system-inspiration/SUB-AGENT-PROMPTS.md +245 -0
- package/plugins/design/templates/design-system-inspiration/_MAPPING.md +2 -2
- package/plugins/design/templates/design-system-inspiration/core/preview/_components.css.tpl +129 -0
- package/plugins/design/templates/design-system-inspiration/core/preview/_motion-readme.md.tpl +63 -0
- package/plugins/design/templates/design-system-inspiration/core/preview/motion.css.tpl +106 -0
- package/plugins/design/templates/design-system-inspiration/core/preview/motion.tsx.tpl +208 -0
- /package/plugins/design/templates/design-system-inspiration/core/preview/{motion.html → .archive/motion.html} +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# visual-sanity.sh — mandatory post-scaffold visual sanity gate for
|
|
3
|
+
# `/design:setup-ds`. Boots the dev-server (via server-up.sh), screenshots
|
|
4
|
+
# N specimens (via screenshot.sh) into `_history/_system/<ds>-visual-sanity-
|
|
5
|
+
# <ISO>/`, and exits non-zero on any failure so the caller can surface an
|
|
6
|
+
# `AskUserQuestion` ("dev-server boot failed: <reason> — skip visual sanity
|
|
7
|
+
# or fix and retry?"). Never silently elides the gate.
|
|
8
|
+
#
|
|
9
|
+
# Closes D-3 + D-4 in the imprint-bootstrap retro (sparkle overflow + broken
|
|
10
|
+
# relative-URL asset path — both would have been caught by one screenshot read).
|
|
11
|
+
# Spec: `.ai/plans/phase-3.7-setup-ds-hardening-and-motion-subsystem.md` Task 2.
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
# visual-sanity.sh --ds <ds-name>
|
|
15
|
+
# [--specimens "colors-accent,motion,logo"]
|
|
16
|
+
# [--root <repo>] [--out-dir <dir>]
|
|
17
|
+
# [--boot-timeout 15] [--shot-timeout 5]
|
|
18
|
+
# [--engine auto|agent-browser|playwright]
|
|
19
|
+
#
|
|
20
|
+
# Defaults:
|
|
21
|
+
# --root "$CLAUDE_PROJECT_DIR" → "$(git rev-parse --show-toplevel)" → cwd
|
|
22
|
+
# --specimens "colors-accent,motion,ui_kits-desktop-showcase"
|
|
23
|
+
# (signature trio — accent / motion / DS-in-use)
|
|
24
|
+
# caller may override with the roster-derived list of actually-
|
|
25
|
+
# written specimens to avoid screenshotting files that don't
|
|
26
|
+
# exist on the disk yet.
|
|
27
|
+
# --out-dir "<root>/.design/_history/_system/<ds>-visual-sanity-<ISO>"
|
|
28
|
+
# --boot-timeout 15 (server-up.sh polling window, in seconds)
|
|
29
|
+
# --shot-timeout 5 (screenshot.sh DC-mount poll window per specimen; bare
|
|
30
|
+
# DS-preview specimens have no [data-dc-screen] so the
|
|
31
|
+
# poll always exhausts — 5s is plenty for the page-load
|
|
32
|
+
# settle without burning 15s × N on every gate run)
|
|
33
|
+
#
|
|
34
|
+
# Output: one PNG path per line on stdout (composable in for-loops); the caller
|
|
35
|
+
# is expected to `Read` each PNG into context so the agent ACTUALLY SEES
|
|
36
|
+
# what shipped. JSON manifest written alongside as `_manifest.json`.
|
|
37
|
+
# Stderr: diagnostic, engine choice, timing, failure reasons.
|
|
38
|
+
# Exit:
|
|
39
|
+
# 0 success — all specimens screenshot successfully
|
|
40
|
+
# 1 dev-server boot failed (caller MUST surface AskUserQuestion)
|
|
41
|
+
# 2 bad args
|
|
42
|
+
# 3 one or more specimen screenshots failed
|
|
43
|
+
# 4 no specimens existed on disk (DS not scaffolded? typo?)
|
|
44
|
+
|
|
45
|
+
DS=""
|
|
46
|
+
SPECIMENS=""
|
|
47
|
+
ROOT=""
|
|
48
|
+
OUT_DIR=""
|
|
49
|
+
BOOT_TIMEOUT=15
|
|
50
|
+
SHOT_TIMEOUT=5
|
|
51
|
+
ENGINE="auto"
|
|
52
|
+
|
|
53
|
+
while [ $# -gt 0 ]; do
|
|
54
|
+
case "$1" in
|
|
55
|
+
--ds) DS="$2"; shift 2 ;;
|
|
56
|
+
--specimens) SPECIMENS="$2"; shift 2 ;;
|
|
57
|
+
--root) ROOT="$2"; shift 2 ;;
|
|
58
|
+
--out-dir) OUT_DIR="$2"; shift 2 ;;
|
|
59
|
+
--boot-timeout) BOOT_TIMEOUT="$2"; shift 2 ;;
|
|
60
|
+
--shot-timeout) SHOT_TIMEOUT="$2"; shift 2 ;;
|
|
61
|
+
--timeout) BOOT_TIMEOUT="$2"; SHOT_TIMEOUT="$2"; shift 2 ;; # legacy
|
|
62
|
+
--engine) ENGINE="$2"; shift 2 ;;
|
|
63
|
+
--help|-h)
|
|
64
|
+
sed -n '2,33p' "$0" | sed 's/^# \?//'
|
|
65
|
+
exit 0
|
|
66
|
+
;;
|
|
67
|
+
*)
|
|
68
|
+
echo "visual-sanity.sh: unknown arg '$1' (try --help)" >&2
|
|
69
|
+
exit 2
|
|
70
|
+
;;
|
|
71
|
+
esac
|
|
72
|
+
done
|
|
73
|
+
|
|
74
|
+
if [ -z "$DS" ]; then
|
|
75
|
+
echo "visual-sanity.sh: --ds <ds-name> required" >&2
|
|
76
|
+
exit 2
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Resolve repo root.
|
|
80
|
+
if [ -z "$ROOT" ]; then
|
|
81
|
+
ROOT="${CLAUDE_PROJECT_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
|
82
|
+
fi
|
|
83
|
+
if [ ! -d "$ROOT" ]; then
|
|
84
|
+
echo "visual-sanity.sh: --root '$ROOT' is not a directory" >&2
|
|
85
|
+
exit 2
|
|
86
|
+
fi
|
|
87
|
+
ROOT_ABS=$(cd "$ROOT" && pwd)
|
|
88
|
+
|
|
89
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
90
|
+
|
|
91
|
+
DESIGN_ROOT="$ROOT_ABS/.design"
|
|
92
|
+
DS_PREVIEW="$DESIGN_ROOT/system/$DS/preview"
|
|
93
|
+
if [ ! -d "$DS_PREVIEW" ]; then
|
|
94
|
+
echo "visual-sanity.sh: preview directory not found at $DS_PREVIEW" >&2
|
|
95
|
+
echo " (is the DS scaffolded? did you mean a different --ds value?)" >&2
|
|
96
|
+
exit 4
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
# Default specimen list: the signature trio (accent, motion, DS-in-use).
|
|
100
|
+
# Caller can pass a roster-derived list to override.
|
|
101
|
+
if [ -z "$SPECIMENS" ]; then
|
|
102
|
+
SPECIMENS="colors-accent,motion,ui_kits-desktop-showcase"
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
# Filter specimens to those that actually exist on disk — the trio is a
|
|
106
|
+
# default that not every DS will have written (e.g. an early scaffold may
|
|
107
|
+
# not have ui_kits-* yet). Silently skipping a non-existent specimen is OK;
|
|
108
|
+
# the caller logs which ones we attempted vs. captured.
|
|
109
|
+
declare -a EXISTING=()
|
|
110
|
+
declare -a MISSING=()
|
|
111
|
+
IFS=',' read -r -a SPEC_ARR <<< "$SPECIMENS"
|
|
112
|
+
for s in "${SPEC_ARR[@]}"; do
|
|
113
|
+
s_trim=$(echo "$s" | tr -d '[:space:]')
|
|
114
|
+
[ -z "$s_trim" ] && continue
|
|
115
|
+
if [ -f "$DS_PREVIEW/${s_trim}.tsx" ]; then
|
|
116
|
+
EXISTING+=("$s_trim")
|
|
117
|
+
else
|
|
118
|
+
MISSING+=("$s_trim")
|
|
119
|
+
fi
|
|
120
|
+
done
|
|
121
|
+
if [ ${#EXISTING[@]} -eq 0 ]; then
|
|
122
|
+
echo "visual-sanity.sh: none of the requested specimens exist on disk under $DS_PREVIEW" >&2
|
|
123
|
+
printf ' missing: %s\n' "${MISSING[@]}" >&2
|
|
124
|
+
exit 4
|
|
125
|
+
fi
|
|
126
|
+
if [ ${#MISSING[@]} -gt 0 ]; then
|
|
127
|
+
echo "visual-sanity.sh: skipping ${#MISSING[@]} non-existent specimen(s): ${MISSING[*]}" >&2
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
# ISO-like timestamp safe for filenames (no colons / spaces).
|
|
131
|
+
TS=$(date -u +"%Y%m%dT%H%M%SZ")
|
|
132
|
+
|
|
133
|
+
if [ -z "$OUT_DIR" ]; then
|
|
134
|
+
OUT_DIR="$DESIGN_ROOT/_history/_system/${DS}-visual-sanity-${TS}"
|
|
135
|
+
fi
|
|
136
|
+
mkdir -p "$OUT_DIR"
|
|
137
|
+
|
|
138
|
+
# Step 1 — boot the dev-server. Failure here is fatal: the caller MUST surface
|
|
139
|
+
# AskUserQuestion ("dev-server boot failed: <reason>; skip visual sanity or
|
|
140
|
+
# fix and retry?") rather than silently skipping the gate.
|
|
141
|
+
echo "→ booting dev-server (timeout ${BOOT_TIMEOUT}s)" >&2
|
|
142
|
+
PORT=$(bash "$SCRIPT_DIR/server-up.sh" --root "$ROOT_ABS" --timeout "$BOOT_TIMEOUT")
|
|
143
|
+
SERVER_RC=$?
|
|
144
|
+
if [ $SERVER_RC -ne 0 ] || [ -z "$PORT" ]; then
|
|
145
|
+
echo "✗ dev-server boot failed (server-up.sh exit $SERVER_RC); see $DESIGN_ROOT/_server.log" >&2
|
|
146
|
+
cat > "$OUT_DIR/_manifest.json" <<EOF
|
|
147
|
+
{
|
|
148
|
+
"ds": "$DS",
|
|
149
|
+
"ts": "$TS",
|
|
150
|
+
"status": "server-boot-failed",
|
|
151
|
+
"server_up_rc": $SERVER_RC,
|
|
152
|
+
"specimens_requested": $(printf '%s\n' "${SPEC_ARR[@]}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | sed '/^$/d' | sed 's/.*/"&"/' | paste -sd, -),
|
|
153
|
+
"specimens_captured": []
|
|
154
|
+
}
|
|
155
|
+
EOF
|
|
156
|
+
exit 1
|
|
157
|
+
fi
|
|
158
|
+
echo "✓ dev-server on port $PORT" >&2
|
|
159
|
+
|
|
160
|
+
# Step 2 — screenshot each existing specimen. Track captures vs failures.
|
|
161
|
+
declare -a CAPTURED=()
|
|
162
|
+
declare -a FAILED=()
|
|
163
|
+
for s in "${EXISTING[@]}"; do
|
|
164
|
+
REL="system/$DS/preview/${s}.tsx"
|
|
165
|
+
REL_ENC=$(printf '%s' "$REL" | sed 's/ /%20/g')
|
|
166
|
+
URL="http://localhost:${PORT}/_canvas-shell.html?canvas=${REL_ENC}"
|
|
167
|
+
OUT_PNG="$OUT_DIR/${s}.png"
|
|
168
|
+
echo "→ screenshot: $s" >&2
|
|
169
|
+
if bash "$SCRIPT_DIR/screenshot.sh" \
|
|
170
|
+
--url "$URL" \
|
|
171
|
+
--full \
|
|
172
|
+
--out "$OUT_PNG" \
|
|
173
|
+
--engine "$ENGINE" \
|
|
174
|
+
--timeout "$SHOT_TIMEOUT" >&2; then
|
|
175
|
+
echo "$OUT_PNG"
|
|
176
|
+
CAPTURED+=("$s")
|
|
177
|
+
else
|
|
178
|
+
echo "✗ screenshot failed: $s" >&2
|
|
179
|
+
FAILED+=("$s")
|
|
180
|
+
fi
|
|
181
|
+
done
|
|
182
|
+
|
|
183
|
+
# Step 3 — write manifest. Caller can parse this to know what was captured
|
|
184
|
+
# without re-listing the directory.
|
|
185
|
+
json_arr() {
|
|
186
|
+
# Print a JSON array literal from positional args. Empty → "[]".
|
|
187
|
+
if [ $# -eq 0 ]; then printf '[]'; return; fi
|
|
188
|
+
printf '['
|
|
189
|
+
i=0
|
|
190
|
+
for a in "$@"; do
|
|
191
|
+
if [ $i -gt 0 ]; then printf ', '; fi
|
|
192
|
+
printf '"%s"' "$a"
|
|
193
|
+
i=$((i + 1))
|
|
194
|
+
done
|
|
195
|
+
printf ']'
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
STATUS="ok"
|
|
199
|
+
[ ${#FAILED[@]} -gt 0 ] && STATUS="partial-failure"
|
|
200
|
+
|
|
201
|
+
{
|
|
202
|
+
printf '{\n'
|
|
203
|
+
printf ' "ds": "%s",\n' "$DS"
|
|
204
|
+
printf ' "ts": "%s",\n' "$TS"
|
|
205
|
+
printf ' "status": "%s",\n' "$STATUS"
|
|
206
|
+
printf ' "port": %s,\n' "$PORT"
|
|
207
|
+
printf ' "out_dir": "%s",\n' "$OUT_DIR"
|
|
208
|
+
printf ' "specimens_requested": %s,\n' "$(json_arr "${SPEC_ARR[@]}")"
|
|
209
|
+
printf ' "specimens_captured": %s,\n' "$(json_arr "${CAPTURED[@]}")"
|
|
210
|
+
printf ' "specimens_missing": %s,\n' "$(json_arr "${MISSING[@]}")"
|
|
211
|
+
printf ' "specimens_failed": %s\n' "$(json_arr "${FAILED[@]}")"
|
|
212
|
+
printf '}\n'
|
|
213
|
+
} > "$OUT_DIR/_manifest.json"
|
|
214
|
+
|
|
215
|
+
echo "→ manifest: $OUT_DIR/_manifest.json" >&2
|
|
216
|
+
|
|
217
|
+
if [ ${#FAILED[@]} -gt 0 ]; then
|
|
218
|
+
echo "✗ ${#FAILED[@]}/${#EXISTING[@]} specimen(s) failed to capture: ${FAILED[*]}" >&2
|
|
219
|
+
exit 3
|
|
220
|
+
fi
|
|
221
|
+
exit 0
|