feat(design-gate): the gate reads profile.sh current --plain; remedy is set web / enable design + reload, or a relaunch under --settings
This commit is contained in:
1 parent
ddd2cdb3ac
commit
350e658b60
7 files changed
+174
-430
No files matched your search
@@ -164,7 +164,7 @@ When the plugin-advisor detects a `simple` or `hotfix` signal, suggest the appro
|
|||||||
|
|
||||||
**Escalation path:** `/hotfix` → `/bugfix` → `/ship-feature` (bugs), `/feat` → `/ship-feature` (features). Each skill documents when to escalate to the next level.
|
**Escalation path:** `/hotfix` → `/bugfix` → `/ship-feature` (bugs), `/feat` → `/ship-feature` (features). Each skill documents when to escalate to the next level.
|
||||||
|
|
||||||
**Design gate:** `/feat`, `/hotfix`, and `/bugfix` include a lightweight design gate (`lib/design-gate.md`) that auto-detects UI/style signals and, if the design toolchain is incomplete, points the user at `/profile design`. This covers the gap where lightweight skills previously had no plugin awareness for design tasks.
|
**Design gate:** `/feat`, `/hotfix`, and `/bugfix` include a lightweight design gate (`lib/design-gate.md`) that auto-detects UI/style signals and, if the design toolchain is incomplete, points the user at the remedy line it printed. This covers the gap where lightweight skills previously had no plugin awareness for design tasks.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
+52
-62
@@ -25,9 +25,10 @@ Check BOTH the task description AND the filesystem:
|
|||||||
|
|
||||||
## DECISION
|
## DECISION
|
||||||
|
|
||||||
Source of truth for activation is the **profile system** — never an atomic
|
Source of truth is `profile.sh current --plain` (packs and managed plugins of
|
||||||
per-tool toggle. The gate's whole job: confirm the design toolchain is active,
|
THIS project and conversation) — never an atomic per-tool toggle. The gate's
|
||||||
and if not, point at ONE command — `/profile design`.
|
whole job: confirm the design toolchain is active, and if not, print ONE
|
||||||
|
remedy line (see §3).
|
||||||
|
|
||||||
### 1. Tier — does the gate even apply?
|
### 1. Tier — does the gate even apply?
|
||||||
|
|
||||||
@@ -37,52 +38,46 @@ and if not, point at ONE command — `/profile design`.
|
|||||||
- In doubt (trivial tweak vs real UI change) → do NOT silently skip: ask the
|
- In doubt (trivial tweak vs real UI change) → do NOT silently skip: ask the
|
||||||
user, or default to the Build tier.
|
user, or default to the Build tier.
|
||||||
|
|
||||||
Tier does NOT change WHAT gets checked. Every non-trivial design tier draws from
|
Tier does NOT change WHAT gets checked. Every non-trivial design tier needs
|
||||||
the one `design` profile — so the gate checks that profile's **design-core
|
the same required set, declared as `NEEDED=` in `lib/design-tool-gate.sh`:
|
||||||
tools** (the `# GATE-BLOCK:` allowlist in `design.profile`: impeccable,
|
packs `design` and `gstack-design`, the `ui-ux-pro-max` plugin, and the `21st`
|
||||||
ui-ux-pro-max, emil-design-eng, design-motion-principles, design-html,
|
CLI signed in. Other packs and browser/plan tooling never trip the gate.
|
||||||
design-review, design-consultation, the `21st` CLI and `21st-ui-build` — the
|
Motion and static-HTML skills ride inside those packs; the Design work section
|
||||||
canary for the whole 21st skill pack). The profile also bundles
|
(`rules/web-building.md`) names them, not a separate activation step.
|
||||||
browser/plan/shotgun tooling and graphify for convenience; those never trip the
|
|
||||||
gate. Motion (`design-motion-principles`) and static-HTML (`design-html`) are
|
|
||||||
already in the core set — checked regardless; the Design work section
|
|
||||||
(`rules/web-building.md`) names them as the motion and static tools, not a
|
|
||||||
separate activation step.
|
|
||||||
`site-motion` (personal skill, site-level scroll/page choreography) rides the
|
`site-motion` (personal skill, site-level scroll/page choreography) rides the
|
||||||
same Build chain but isn't on the GATE-BLOCK list: it ships with the repo,
|
same Build chain but isn't required: it ships with the repo, nothing to
|
||||||
nothing to install or verify.
|
install or verify.
|
||||||
|
|
||||||
### 2. State — run the deterministic check
|
### 2. State — run the deterministic check
|
||||||
|
|
||||||
bash "$HOME/.claude/lib/design-tool-gate.sh"
|
bash "$HOME/.claude/lib/design-tool-gate.sh"
|
||||||
|
|
||||||
It reads the design-core tools (`# GATE-BLOCK:` in `design.profile`) plus their
|
It runs `profile.sh current --plain` and checks the `NEEDED=` entries of the
|
||||||
types (`profile.sh show design --plain`) and checks each on its own channel —
|
script (the single source of the required set), then `command -v 21st` and
|
||||||
skill symlink, `claude plugin list`, `claude mcp list`, `command -v`. It never
|
`21st whoami`. It makes no `claude` call.
|
||||||
reads `disabledMcpServers` (unreliable for bi-modal servers like context7).
|
|
||||||
The core set lives in `design.profile`, not in the script or here — single source.
|
|
||||||
|
|
||||||
Exit codes: `0` = ready · `11` = ready-but-unverified (proceed, but surface it) · `10` = incomplete (gate trips) · `12` = sign-in required (21st installed, signed out) · `2` = error.
|
Exit codes: `0` = ready · `11` = ready-but-unverified (proceed, but surface it) · `10` = incomplete (gate trips) · `12` = sign-in required (21st installed, signed out) · `2` = error.
|
||||||
|
|
||||||
### 3. Branch on the result
|
### 3. Branch on the result
|
||||||
|
|
||||||
- **0 / `READY`** → proceed silently. Toolchain is active.
|
- **0 / `READY`** → proceed silently. Toolchain is active.
|
||||||
- **10 / `INCOMPLETE`** → STOP. The script reports up to three groups; relay
|
- **10 / `INCOMPLETE`** → STOP. The script names what is off and prints the
|
||||||
them and the remedy to the user:
|
remedy; relay both to the user:
|
||||||
|
|
||||||
🎨 DESIGN DETECTED — the design toolchain isn't fully active.
|
design toolchain: INCOMPLETE
|
||||||
activate with /profile design: <skills / ui-ux-pro-max>
|
off: pack-design plugin:ui-ux-pro-max@ui-ux-pro-max-skill
|
||||||
required + manual step: <e.g. 21st — needs the CLI>
|
→ run: bash ~/.claude/lib/profile.sh set web (or: enable design)
|
||||||
→ run /profile design to activate it, then continue.
|
then /reload-plugins
|
||||||
|
|
||||||
- **activate with /profile design** → skills + the plugin; `/profile design`
|
- **source=local or default** → `profile.sh set web` (or `enable design`),
|
||||||
turns them on directly.
|
then `/reload-plugins`.
|
||||||
- **required + manual step** → required tools the profile can't flip silently.
|
- **source=flag** (the conversation runs under `claude --settings`, frozen)
|
||||||
**the `21st` CLI lands here: it TRIPS the gate** (it's required for Build),
|
→ relaunch it with a design profile: `cc <name> web`.
|
||||||
it is NOT a silent "optional". `/profile design` symlinks the 21st skills,
|
- **the `21st` CLI TRIPS the gate** when absent (required for Build), it is
|
||||||
but the CLI they shell out to is a global npm install: tell the user to run
|
NOT a silent "optional". It is a global npm install the profile cannot
|
||||||
`npm i -g @21st-dev/cli` then `21st login` (no API key, no MCP).
|
do: tell the user to run `npm i -g @21st-dev/cli` then `21st login`
|
||||||
- Do NOT hand-activate individual tools. The profile is the unit of activation.
|
(no API key, no MCP).
|
||||||
|
- Do NOT hand-activate individual tools. Packs are the unit of activation.
|
||||||
- **12 / `SIGN-IN REQUIRED`** → STOP. The 21st CLI is installed but `21st
|
- **12 / `SIGN-IN REQUIRED`** → STOP. The 21st CLI is installed but `21st
|
||||||
whoami` reports signed out. Relay the script's block, then ask the user to
|
whoami` reports signed out. Relay the script's block, then ask the user to
|
||||||
run `! 21st login` (the `!` prefix runs it in this session, browser flow,
|
run `! 21st login` (the `!` prefix runs it in this session, browser flow,
|
||||||
@@ -100,22 +95,20 @@ Exit codes: `0` = ready · `11` = ready-but-unverified (proceed, but surface it)
|
|||||||
and needs the human. `TWENTYFIRST_TOKEN` is a shell-profile setting
|
and needs the human. `TWENTYFIRST_TOKEN` is a shell-profile setting
|
||||||
followed by a session restart, never an in-session `export` (tool calls
|
followed by a session restart, never an in-session `export` (tool calls
|
||||||
don't share a shell, and a secret doesn't belong in the transcript).
|
don't share a shell, and a secret doesn't belong in the transcript).
|
||||||
- **11 / `READY BUT UNVERIFIED`** → `claude` was unreachable, so the design
|
- **11 / `READY BUT UNVERIFIED`** → `21st whoami` could not answer (a
|
||||||
plugin (ui-ux-pro-max) could NOT be checked. Do NOT report a plain "ready":
|
runtime/PATH problem, e.g. node under nvm). Do NOT report a plain "ready":
|
||||||
proceed only after telling the user that N tool(s) went unverified and having
|
proceed only after telling the user, relaying the diagnostic the script
|
||||||
them confirm with `claude plugin list`. Fail-visible, not fail-silent. A
|
prints (`whoami: rc=… …`). Never a sign-in prompt. Fail-visible, not
|
||||||
`21st (whoami: rc=… …)` entry in this block means the CLI itself could not
|
fail-silent.
|
||||||
answer (a runtime/PATH problem, e.g. node under nvm) — the remedy is the
|
|
||||||
diagnostic the script prints, never a sign-in prompt; relay its own line.
|
|
||||||
|
|
||||||
### 4. Animation library — suggest-only (fires only on a real motion signal)
|
### 4. Animation library — suggest-only (fires only on a real motion signal)
|
||||||
|
|
||||||
Orthogonal to the toolchain check above: §2-3 are about Claude's design TOOLS;
|
Orthogonal to the toolchain check above: §2-3 are about Claude's design TOOLS;
|
||||||
this is about the PROJECT's runtime dep. Evaluate it only once the toolchain is
|
this is about the PROJECT's runtime dep. Evaluate it only once the toolchain is
|
||||||
resolved and you're actually proceeding with the build (READY, after the user
|
resolved and you're actually proceeding with the build (READY, after the user
|
||||||
ran `/profile design`, or after the sign-in re-run returns READY). Never on
|
applied the remedy, or after the sign-in re-run returns READY). Never on
|
||||||
the INCOMPLETE stop path — that path has one action only (`/profile
|
the INCOMPLETE stop path — that path has one action only (the remedy
|
||||||
design`); don't stack an optional note on it.
|
line); don't stack an optional note on it.
|
||||||
|
|
||||||
**Fires only when ALL THREE hold** — drop any one → no suggestion, stay silent:
|
**Fires only when ALL THREE hold** — drop any one → no suggestion, stay silent:
|
||||||
|
|
||||||
@@ -160,7 +153,7 @@ count:
|
|||||||
10 libs incl gsap / react-spring / lottie) kills it the instant any anim lib
|
10 libs incl gsap / react-spring / lottie) kills it the instant any anim lib
|
||||||
lands, so only "eligible + pure-CSS + actively declined" ever sees it twice.
|
lands, so only "eligible + pure-CSS + actively declined" ever sees it twice.
|
||||||
- **Two "motion"s (agent-facing).** The lib `motion` (npm dep, this step) ≠ the
|
- **Two "motion"s (agent-facing).** The lib `motion` (npm dep, this step) ≠ the
|
||||||
skill `design-motion-principles` (`# GATE-BLOCK:` core set, §2-3). The
|
skill `design-motion-principles` (inside the design packs, §2-3). The
|
||||||
toolchain check handles the skill; this step handles the lib. Don't conflate
|
toolchain check handles the skill; this step handles the lib. Don't conflate
|
||||||
them when talking to the user.
|
them when talking to the user.
|
||||||
|
|
||||||
@@ -173,7 +166,7 @@ context, which is worse than not running it — and nothing else in the process
|
|||||||
says so, because init has to happen in the agent chat, not in an installer.
|
says so, because init has to happen in the agent chat, not in an installer.
|
||||||
|
|
||||||
**Fires when** the project has no `PRODUCT.md` at its root, else stay
|
**Fires when** the project has no `PRODUCT.md` at its root, else stay
|
||||||
silent. impeccable itself is on the `# GATE-BLOCK:` list, so §3 has already
|
silent. impeccable ships in the required design packs, so §3 has already
|
||||||
guaranteed it is installed by the time this runs.
|
guaranteed it is installed by the time this runs.
|
||||||
|
|
||||||
Evaluate it on the same path as §4: after the toolchain resolves, never on the
|
Evaluate it on the same path as §4: after the toolchain resolves, never on the
|
||||||
@@ -192,25 +185,22 @@ INCOMPLETE stop path. One line, non-blocking:
|
|||||||
|
|
||||||
### Other toolchains
|
### Other toolchains
|
||||||
|
|
||||||
The script defaults to the `design` profile. A task needing another profile's
|
The script takes no argument: it checks the one design set (`NEEDED=`). A
|
||||||
toolchain passes it: `design-tool-gate.sh <profile>`. Scope comes from that
|
task needing another toolchain adds its own gate; the remedy stays a pack
|
||||||
profile's `# GATE-BLOCK:` line (absent → every skill/plugin/mcp entry). The
|
or profile, never a lone tool.
|
||||||
remedy is always `/profile <that>` — a profile, never a lone tool.
|
|
||||||
|
|
||||||
## IMPORTANT
|
## IMPORTANT
|
||||||
|
|
||||||
- Remedy is ALWAYS a profile (`/profile design`), never an atomic tool toggle —
|
- Remedy is ALWAYS the printed line (`profile.sh set web` / `enable design`
|
||||||
the profile system is the single source of truth for what's active.
|
+ `/reload-plugins`, or `cc <name> web` under a flag), never an atomic
|
||||||
- the `21st` CLI is REQUIRED (it trips the gate) and `/profile design` cannot
|
tool toggle — `current --plain` is the single source of what's active.
|
||||||
|
- the `21st` CLI is REQUIRED (it trips the gate) and no profile can
|
||||||
install it — the gate names the two commands; surface them to the user.
|
install it — the gate names the two commands; surface them to the user.
|
||||||
Signed out → exit 12: ask `! 21st login`, wait, re-run; explicit opt-out
|
Signed out → exit 12: ask `! 21st login`, wait, re-run; explicit opt-out
|
||||||
only, never a silent skip.
|
only, never a silent skip.
|
||||||
- The design-core set (what trips the gate) is declared in `design.profile` on
|
- The required set (what trips the gate) is `NEEDED=` in
|
||||||
the `# GATE-BLOCK:` line(s) — edit there to add/remove a blocking design tool,
|
`design-tool-gate.sh` — edit there to add/remove a blocking pack or plugin.
|
||||||
not in the script.
|
- The gate makes no `claude` call; it runs `profile.sh current --plain` and
|
||||||
- The state check shells out to `claude` (plugin/mcp list): a few seconds.
|
`21st whoami`. Trivial / non-design tasks skip it entirely.
|
||||||
Trivial / non-design tasks skip it entirely (no signal, or trivial tier).
|
- The 21st sign-in state is gate-only: `profile.sh` has no counterpart.
|
||||||
- `design-tool-gate.sh`'s per-type state checks MIRROR
|
|
||||||
`profile.sh:skill_status()` — change one, sync the other, except the 21st
|
|
||||||
auth state: gate-only, no skill_status counterpart.
|
|
||||||
- Do NOT run this gate on pure backend/API/CLI tasks (no signals = no gate).
|
- Do NOT run this gate on pure backend/API/CLI tasks (no signals = no gate).
|
||||||
+69
-227
@@ -1,95 +1,35 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# lib/design-tool-gate.sh — Deterministic design-toolchain state check.
|
# lib/design-tool-gate.sh — deterministic design-toolchain state check.
|
||||||
#
|
#
|
||||||
# Answers ONE question for the design gate (design-gate.md §DECISION):
|
# Answers one question for lib/design-gate.md § DECISION: "is the design
|
||||||
# "Is the design toolchain active enough to proceed?"
|
# toolchain active enough to proceed?" Source of truth = `profile.sh
|
||||||
|
# current --plain` (packs + managed plugins of THIS project and
|
||||||
|
# conversation). Required: pack-design, pack-gstack-design and the
|
||||||
|
# ui-ux-pro-max plugin, plus the `21st` CLI signed in (gate-only state:
|
||||||
|
# in / out / unknown, from `21st whoami`).
|
||||||
#
|
#
|
||||||
# Source of truth = the profile system. The gate never activates a single
|
# Exit: 0 ready · 10 incomplete (a pack or plugin off, or no 21st CLI) ·
|
||||||
# tool atomically; it checks whether a profile's DESIGN-CORE tools (default
|
# 11 ready-but-unverified (21st could not answer) · 12 sign-in
|
||||||
# profile: `design`) are active and, if not, points at `/profile <name>`.
|
# required · 2 error (profile.sh failed or gave no pack lines).
|
||||||
#
|
# Remedy on 10: source=flag → relaunch `cc <name> web` (a --settings
|
||||||
# Two inputs from the profile, both claude-free:
|
# conversation is frozen); else `profile.sh set web` (or `enable design`)
|
||||||
# - structure: profile.sh show <profile> --plain -> "<type>\t<name>"
|
# then /reload-plugins. The CLI is a global npm install either way.
|
||||||
# - gate scope: the "# GATE-BLOCK:" line(s) in <profile>.profile — the
|
# Usage: design-tool-gate.sh (no argument; env DESIGN_GATE_PROFILE_SH)
|
||||||
# allowlist of tools the gate trips on. A comment, so
|
|
||||||
# read_profile strips it and --plain never shows it. Absent
|
|
||||||
# -> fall back to every skill/plugin/mcp entry (coarse).
|
|
||||||
#
|
|
||||||
# State (active or not) is checked per channel, by type. These per-type
|
|
||||||
# checks MIRROR profile.sh:skill_status() — change one, sync the other,
|
|
||||||
# except the 21st auth state: gate-only, no skill_status counterpart.
|
|
||||||
#
|
|
||||||
# type channel class
|
|
||||||
# gstack|external|personal skill symlink in skills/ blocking
|
|
||||||
# plugin `claude plugin list` -> enabled blocking
|
|
||||||
# mcp | cli `claude mcp list` / command -v required-manual
|
|
||||||
#
|
|
||||||
# Class:
|
|
||||||
# blocking required + `/profile design` activates it directly.
|
|
||||||
# required-manual required but the profile can't flip it silently (API
|
|
||||||
# key / external install) — the gate STILL trips, names
|
|
||||||
# it, and the remedy is `/profile design` + a manual step.
|
|
||||||
# This is where the `21st` CLI lands: required, never
|
|
||||||
# silent (npm i -g @21st-dev/cli, then 21st login).
|
|
||||||
# 21st's sign-in state is three-valued: in (active),
|
|
||||||
# out (exit 12, ask to sign in), unknown (exit 11).
|
|
||||||
# Both classes trip the gate. Tools NOT on the GATE-BLOCK allowlist are
|
|
||||||
# ignored entirely (browser/plan/shotgun tooling, graphify).
|
|
||||||
#
|
|
||||||
# disabledMcpServers is NEVER read — unreliable for bi-modal servers
|
|
||||||
# (context7 can appear there yet be active via another channel).
|
|
||||||
#
|
|
||||||
# Exit: 0 = ready · 11 = ready-but-unverified (proceed, say so) ·
|
|
||||||
# 10 = incomplete (trips) · 12 = sign-in required (21st) · 2 = error.
|
|
||||||
# Usage: design-tool-gate.sh [profile] (default profile: design)
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
REPO="${DESIGN_GATE_REPO_OVERRIDE:-$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
|
REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
PROFILE_SH="${DESIGN_GATE_PROFILE_SH:-$REPO/lib/profile.sh}"
|
PROFILE_SH="${DESIGN_GATE_PROFILE_SH:-$REPO/lib/profile.sh}"
|
||||||
CLAUDE_BIN="${CLAUDE_BIN:-claude}"
|
NEEDED=(pack-design pack-gstack-design
|
||||||
PROFILES_DIR="$REPO/lib/profiles"
|
"plugin:ui-ux-pro-max@ui-ux-pro-max-skill")
|
||||||
SKILLS_DIR="$REPO/skills"
|
|
||||||
PROFILE="${1:-design}"
|
|
||||||
PROFILE_FILE="$PROFILES_DIR/$PROFILE.profile"
|
|
||||||
|
|
||||||
[ -x "$PROFILE_SH" ] || { echo "design-gate: profile.sh not executable at $PROFILE_SH" >&2; exit 2; }
|
# ---- 21st CLI on PATH + sign-in state (kept from the previous version) ----
|
||||||
[ -f "$PROFILE_FILE" ] || { echo "design-gate: profile '$PROFILE' not found" >&2; exit 2; }
|
# Same sanitized-PATH problem for `21st` (an npm global bin): a PATH repair
|
||||||
|
# for the 21st CLI only (claude is no longer called here). The npm global
|
||||||
# Ensure the claude CLI + its node runtime are reachable even when a skill/hook
|
# bin dir is often missing from a hook's PATH. Probe for the binary directly
|
||||||
# shells this script out with a sanitized PATH. The interactive alias
|
# and prepend the dir that has it, otherwise a perfectly installed CLI reads
|
||||||
# claude->dtach_claude never reaches a non-interactive subshell; the real binary
|
# as "missing" and trips the gate.
|
||||||
# AND its node bin dir are what matter (claude's shebang needs node, same dir).
|
|
||||||
# If `command -v claude` already resolves, do nothing; else probe known install
|
|
||||||
# dirs and prepend. nvm keeps old node versions after an upgrade, so pick the
|
|
||||||
# newest that actually ships claude (sort -V), not the first glob match.
|
|
||||||
ensure_claude_on_path() {
|
|
||||||
command -v "$CLAUDE_BIN" >/dev/null 2>&1 && return
|
|
||||||
local cand
|
|
||||||
for cand in \
|
|
||||||
"$HOME/.claude/local/claude" \
|
|
||||||
"$HOME/.local/bin/claude" \
|
|
||||||
/opt/homebrew/bin/claude \
|
|
||||||
/usr/local/bin/claude; do
|
|
||||||
[ -x "$cand" ] && { PATH="$(dirname "$cand"):$PATH"; return; }
|
|
||||||
done
|
|
||||||
local m newest matches=()
|
|
||||||
for m in "$HOME"/.nvm/versions/node/*/bin/claude; do
|
|
||||||
[ -x "$m" ] && matches+=("$m")
|
|
||||||
done
|
|
||||||
if [ "${#matches[@]}" -gt 0 ]; then
|
|
||||||
newest="$(printf '%s\n' "${matches[@]}" | sort -V | tail -1)"
|
|
||||||
PATH="$(dirname "$newest"):$PATH"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
ensure_claude_on_path
|
|
||||||
|
|
||||||
# Same sanitized-PATH problem for `21st` (an npm global bin), with a twist:
|
|
||||||
# the repair above only fires when claude ITSELF is unresolvable, and claude
|
|
||||||
# often lives in ~/.local/bin while the npm global bin dir is missing from a
|
|
||||||
# hook's PATH. Probe for the binary directly and prepend the dir that has it,
|
|
||||||
# otherwise a perfectly installed CLI reads as "missing" and trips the gate.
|
|
||||||
ensure_21st_on_path() {
|
ensure_21st_on_path() {
|
||||||
command -v 21st >/dev/null 2>&1 && return
|
command -v 21st >/dev/null 2>&1 && return
|
||||||
local cand
|
local cand
|
||||||
@@ -142,154 +82,56 @@ twentyfirst_auth_state() {
|
|||||||
echo "unknown:whoami: rc=$rc ${line:0:60}"
|
echo "unknown:whoami: rc=$rc ${line:0:60}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Gate scope: the "# GATE-BLOCK:" allowlist (one or more lines, concatenated).
|
# ---- packs and plugin from profile.sh ---------------------------------------
|
||||||
# Empty => fall back to "every gate-relevant entry is in scope" (coarse).
|
plain="$(bash "$PROFILE_SH" -C "$PWD" current --plain 2>/dev/null)" \
|
||||||
core_set="$(grep '^# GATE-BLOCK:' "$PROFILE_FILE" 2>/dev/null \
|
|| { echo "design-gate: profile.sh current --plain failed" >&2; exit 2; }
|
||||||
| sed 's/^# GATE-BLOCK:[[:space:]]*//' | tr '\n' ' ' || true)"
|
grep -q '^pack-design=' <<<"$plain" || {
|
||||||
|
echo "design-gate: profile.sh current --plain gave no pack-design line" >&2
|
||||||
# Membership in the allowlist. Empty allowlist = everything in scope.
|
exit 2; }
|
||||||
in_scope() {
|
plain_get() { sed -n "s/^$1=//p" <<<"$plain" | head -1; }
|
||||||
[ -z "$core_set" ] && return 0
|
missing=()
|
||||||
case " $core_set " in *" $1 "*) return 0 ;; *) return 1 ;; esac
|
for k in "${NEEDED[@]}"; do
|
||||||
}
|
[ "$(plain_get "$k")" = on ] || missing+=("$k")
|
||||||
|
|
||||||
# State of one tool, by type. Mirrors profile.sh:skill_status() — keep in
|
|
||||||
# sync, except the 21st auth state (gate-only, no skill_status counterpart).
|
|
||||||
# Echoes: active | inactive | unknown (can't verify, claude absent) |
|
|
||||||
# signedout | unknown:<diagnostic> (last two: 21st CLI only)
|
|
||||||
tool_active() {
|
|
||||||
local name="$1" type="$2"
|
|
||||||
case "$type" in
|
|
||||||
gstack|external|personal)
|
|
||||||
if [ -e "$SKILLS_DIR/$name" ]; then echo active; else echo inactive; fi
|
|
||||||
;;
|
|
||||||
plugin)
|
|
||||||
if ! command -v "$CLAUDE_BIN" >/dev/null 2>&1; then echo unknown; return; fi
|
|
||||||
# capture first, then match: an early-exit awk/grep -q in a pipe
|
|
||||||
# SIGPIPEs the producer (rc 141 under pipefail on macOS)
|
|
||||||
local plist
|
|
||||||
plist="$("$CLAUDE_BIN" plugin list 2>/dev/null)" || true
|
|
||||||
if grep -q "✔ enabled" < <(awk -v p="^[[:space:]]*❯ ${name}@" \
|
|
||||||
'$0 ~ p {f=1; next} f && /Status:/ {print; exit}' <<<"$plist")
|
|
||||||
then echo active; else echo inactive; fi
|
|
||||||
;;
|
|
||||||
mcp)
|
|
||||||
if ! command -v "$CLAUDE_BIN" >/dev/null 2>&1; then echo unknown; return; fi
|
|
||||||
if grep -q "^${name}" \
|
|
||||||
<<<"$("$CLAUDE_BIN" mcp list 2>/dev/null)"; then
|
|
||||||
echo active
|
|
||||||
else
|
|
||||||
echo inactive
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
cli)
|
|
||||||
command -v "$name" >/dev/null 2>&1 || { echo inactive; return; }
|
|
||||||
[ "$name" = "21st" ] || { echo active; return; }
|
|
||||||
local auth
|
|
||||||
auth="$(twentyfirst_auth_state)"
|
|
||||||
case "$auth" in
|
|
||||||
in) echo active ;;
|
|
||||||
out) echo signedout ;;
|
|
||||||
unknown:*) echo "$auth" ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
*) echo inactive ;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
# Structure via the parse contract (claude-free). Fail loud on a bad profile —
|
|
||||||
# an empty read must NOT silently report "ready".
|
|
||||||
plain="$("$PROFILE_SH" show "$PROFILE" --plain 2>/dev/null)" \
|
|
||||||
|| { echo "design-gate: 'profile.sh show $PROFILE --plain' failed" >&2; exit 2; }
|
|
||||||
[ -n "$plain" ] || { echo "design-gate: profile '$PROFILE' is empty or unreadable" >&2; exit 2; }
|
|
||||||
|
|
||||||
blocking=() # inactive, /profile design activates it (skill/plugin)
|
|
||||||
manual=() # inactive, required but needs a manual step (mcp key / cli install)
|
|
||||||
unverified=() # can't check (claude CLI absent)
|
|
||||||
signedout=() # 21st CLI installed, not signed in
|
|
||||||
unverified_cli=() # 21st CLI: whoami answered something unexpected
|
|
||||||
while IFS=$'\t' read -r type name; do
|
|
||||||
[ -n "$type" ] || continue
|
|
||||||
in_scope "$name" || continue # ignore non-core tooling (browser, plan-*, graphify)
|
|
||||||
state="$(tool_active "$name" "$type")"
|
|
||||||
case "$state" in
|
|
||||||
active) ;;
|
|
||||||
signedout) signedout+=("$name") ;;
|
|
||||||
unknown) unverified+=("$name") ;;
|
|
||||||
unknown:*) unverified_cli+=("$name (${state#unknown:})") ;;
|
|
||||||
*)
|
|
||||||
case "$type" in
|
|
||||||
gstack|external|personal|plugin) blocking+=("$name") ;;
|
|
||||||
*) manual+=("$name") ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done <<< "$plain"
|
|
||||||
|
|
||||||
# print_unverified — the "also unverified" lines shared by the 10, 11 and 12
|
|
||||||
# blocks: a claude-unreachable tool keeps its existing remedy; a 21st CLI
|
|
||||||
# that answered whoami with something unexpected gets its own — the two are
|
|
||||||
# never merged, so no block blames 21st for a claude problem or vice versa.
|
|
||||||
print_unverified() {
|
|
||||||
if [ "${#unverified[@]}" -gt 0 ]; then
|
|
||||||
echo " also unverified (claude CLI unreachable): ${unverified[*]}"
|
|
||||||
fi
|
|
||||||
local entry name diag
|
|
||||||
# bash 3.2 (macOS /bin/bash) errors on an empty array under set -u
|
|
||||||
for entry in ${unverified_cli[@]+"${unverified_cli[@]}"}; do
|
|
||||||
name="${entry%% (*}"
|
|
||||||
diag="${entry#*\(}"; diag="${diag%\)}"
|
|
||||||
echo " $name could not answer: $diag —" \
|
|
||||||
"a CLI runtime/PATH problem (node under nvm?)," \
|
|
||||||
"not a sign-in problem; fix it, then re-run"
|
|
||||||
done
|
done
|
||||||
}
|
source="$(plain_get source)"; profile="$(plain_get profile)"
|
||||||
|
|
||||||
# Verdict — four outcomes, checked in order:
|
# ---- 21st: CLI present, then signed in ---------------------------------------
|
||||||
# blocking/manual non-empty -> INCOMPLETE (exit 10): the gate trips.
|
cli_hint=""; auth=in
|
||||||
# else signedout non-empty -> SIGN-IN REQUIRED (exit 12): ask the user to
|
if ! command -v 21st >/dev/null 2>&1; then
|
||||||
# run `21st login`, end the turn, wait, re-run — never a silent skip.
|
cli_hint=" 21st needs the CLI: npm i -g @21st-dev/cli then 21st login"
|
||||||
# else unverified/unverified_cli non-empty -> READY BUT UNVERIFIED (exit
|
else
|
||||||
# 11): fail-VISIBLE. claude unreachable and/or 21st couldn't answer
|
auth="$(twentyfirst_auth_state)"
|
||||||
# whoami — never pass either as a silent READY.
|
fi
|
||||||
# nothing pending -> READY (exit 0).
|
|
||||||
if [ "${#blocking[@]}" -gt 0 ] || [ "${#manual[@]}" -gt 0 ]; then
|
# ---- verdict -----------------------------------------------------------------
|
||||||
|
if [ "${#missing[@]}" -gt 0 ] || [ -n "$cli_hint" ]; then
|
||||||
echo "design toolchain: INCOMPLETE"
|
echo "design toolchain: INCOMPLETE"
|
||||||
if [ "${#blocking[@]}" -gt 0 ]; then
|
[ "${#missing[@]}" -gt 0 ] && echo " off: ${missing[*]}"
|
||||||
echo " activate with /profile $PROFILE: ${blocking[*]}"
|
[ -n "$cli_hint" ] && echo "$cli_hint"
|
||||||
|
if [ "$source" = flag ]; then
|
||||||
|
echo " → relaunch this conversation with a design profile:" \
|
||||||
|
" cc <name> web"
|
||||||
|
else
|
||||||
|
echo " → run: bash ~/.claude/lib/profile.sh set web" \
|
||||||
|
" (or: enable design)"
|
||||||
|
echo " then /reload-plugins"
|
||||||
fi
|
fi
|
||||||
if [ "${#manual[@]}" -gt 0 ]; then
|
|
||||||
echo " required + manual step (external install / sign-in): ${manual[*]}"
|
|
||||||
case " ${manual[*]} " in
|
|
||||||
*" 21st "*) echo " 21st needs the CLI: npm i -g @21st-dev/cli then 21st login" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
print_unverified
|
|
||||||
echo " → run: /profile $PROFILE"
|
|
||||||
exit 10
|
exit 10
|
||||||
fi
|
fi
|
||||||
|
case "$auth" in
|
||||||
if [ "${#signedout[@]}" -gt 0 ]; then
|
out)
|
||||||
echo "design toolchain: SIGN-IN REQUIRED — 21st CLI installed, not signed in"
|
echo "design toolchain: SIGN-IN REQUIRED —" \
|
||||||
echo " ask the user to run in this session:" \
|
"21st CLI installed, not signed in"
|
||||||
" ! 21st login" \
|
echo " ask the user to run in this session: ! 21st login (browser flow)"
|
||||||
" (browser flow, saves a local token)"
|
echo " then re-run this gate before any 21st step —" \
|
||||||
echo " then re-run this gate before any 21st step — never skip 21st silently"
|
"never skip 21st silently"
|
||||||
print_unverified
|
exit 12 ;;
|
||||||
exit 12
|
unknown:*)
|
||||||
fi
|
echo "design toolchain: READY BUT UNVERIFIED — 21st could not answer:" \
|
||||||
|
"${auth#unknown:}"
|
||||||
if [ "${#unverified[@]}" -gt 0 ] || [ "${#unverified_cli[@]}" -gt 0 ]; then
|
echo " a CLI runtime/PATH problem (node under nvm?), not a sign-in problem"
|
||||||
echo "design toolchain: READY BUT UNVERIFIED —" \
|
exit 11 ;;
|
||||||
"$(( ${#unverified[@]} + ${#unverified_cli[@]} )) tool(s) not checked"
|
esac
|
||||||
print_unverified
|
echo "design toolchain: READY —" \
|
||||||
if [ "${#unverified[@]}" -gt 0 ]; then
|
"packs design + gstack-design + ui-ux-pro-max on ($profile)"
|
||||||
echo " the gate could NOT confirm the design plugin (ui-ux-pro-max) is"
|
|
||||||
echo " active. Proceed only after checking manually:"
|
|
||||||
echo " claude plugin list"
|
|
||||||
fi
|
|
||||||
exit 11
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "design toolchain: READY — profile '$PROFILE' design tools active"
|
|
||||||
exit 0
|
exit 0
|
||||||
@@ -1,22 +1,16 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# lib/tests/design-tool-gate.test.sh — hermetic suite for the 21st sign-in
|
# lib/tests/design-tool-gate.test.sh — lib/design-tool-gate.sh reads
|
||||||
# state added to lib/design-tool-gate.sh (contract 2026-09-28-21st-signin-
|
# `profile.sh current --plain` (fake, $WORK/plain.txt) and the 21st sign-in
|
||||||
# gate-1215): a fake `21st` CLI on a fixture PATH drives every whoami answer
|
# state (fake `21st`, FAKE_21ST_MODE). READY (0); a pack off + source=local →
|
||||||
# (signed in / signed out / garbage / nonzero rc) through the real gate
|
# INCOMPLETE (10) with the profile.sh remedy; source=flag → relaunch remedy;
|
||||||
# script, with HOME and PATH redirected into the fixture so the machine's
|
# no 21st CLI → 10 with the npm hint; signed out → 12; whoami garbage → 11;
|
||||||
# real CLI is never reachable. A loud precondition proves that redirection
|
# a token → READY without whoami; bad --plain → 2.
|
||||||
# actually holds before any case runs.
|
|
||||||
set -u
|
set -u
|
||||||
|
unset CLAUDE_PROFILE CLAUDE_PROFILE_SETTINGS
|
||||||
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||||
GATE="$ROOT/lib/design-tool-gate.sh"
|
|
||||||
PASS=0; FAIL=0
|
PASS=0; FAIL=0
|
||||||
|
ok() { PASS=$((PASS+1)); echo "PASS $1"; }
|
||||||
ok() { echo "PASS $1"; PASS=$((PASS + 1)); }
|
bad() { FAIL=$((FAIL+1)); echo "FAIL $1 — $2"; }
|
||||||
bad() { echo "FAIL $1 — $2"; FAIL=$((FAIL + 1)); }
|
|
||||||
|
|
||||||
# Precondition, loud: the sanitized PATH below and ensure_21st_on_path()'s
|
|
||||||
# own probes must never resolve a REAL 21st — else CLI_ABSENT_10 (and every
|
|
||||||
# other case) would silently exercise this machine's CLI instead of the stub.
|
|
||||||
if PATH=/usr/bin:/bin command -v 21st >/dev/null 2>&1 \
|
if PATH=/usr/bin:/bin command -v 21st >/dev/null 2>&1 \
|
||||||
|| [ -e /usr/local/bin/21st ] || [ -e /opt/homebrew/bin/21st ]; then
|
|| [ -e /usr/local/bin/21st ] || [ -e /opt/homebrew/bin/21st ]; then
|
||||||
echo "FAIL precondition: system-wide 21st present," \
|
echo "FAIL precondition: system-wide 21st present," \
|
||||||
@@ -25,132 +19,50 @@ if PATH=/usr/bin:/bin command -v 21st >/dev/null 2>&1 \
|
|||||||
echo "PASS=$PASS FAIL=$FAIL"
|
echo "PASS=$PASS FAIL=$FAIL"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
|
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
|
||||||
mkdir -p "$WORK/repo/lib/profiles" "$WORK/repo/skills" "$WORK/bin" "$WORK/home"
|
mkdir -p "$WORK/bin" "$WORK/home"; export WORK
|
||||||
|
printf '#!/usr/bin/env bash\ncat "$WORK/plain.txt"\n' > "$WORK/bin/profile.sh"
|
||||||
# GATE-BLOCK allowlist: 21st (cli) always, ghost-skill (external) only used
|
|
||||||
# by INCOMPLETE_WINS to prove a blocking miss still trips the gate.
|
|
||||||
cat > "$WORK/repo/lib/profiles/design.profile" <<'EOF'
|
|
||||||
# GATE-BLOCK: 21st ghost-skill
|
|
||||||
21st cli
|
|
||||||
ghost-skill external
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# Fake profile.sh: `show design --plain` cats whatever the case wrote to
|
|
||||||
# plain.txt. $WORK is read from the environment at run time (exported
|
|
||||||
# below), never baked in here — the heredoc is quoted on purpose.
|
|
||||||
cat > "$WORK/repo/lib/profile.sh" <<'EOF'
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
[ "$1" = show ] && [ "$3" = --plain ] && { cat "$WORK/plain.txt"; exit 0; }
|
|
||||||
exit 1
|
|
||||||
EOF
|
|
||||||
chmod +x "$WORK/repo/lib/profile.sh"
|
|
||||||
export WORK
|
|
||||||
|
|
||||||
# Fake 21st CLI: `whoami` answers per $FAKE_21ST_MODE, the real CLI's exact
|
|
||||||
# sentences for in/out (proven by STUB_CONTROL below), a garbage line at
|
|
||||||
# rc 0, or the signed-out sentence at a nonzero rc (proves rc wins).
|
|
||||||
cat > "$WORK/bin/21st" <<'EOF'
|
cat > "$WORK/bin/21st" <<'EOF'
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
[ "${1:-}" = whoami ] || exit 1
|
|
||||||
signedout='Not logged in. Run `21st login`, or set TWENTYFIRST_TOKEN.'
|
|
||||||
case "${FAKE_21ST_MODE:-in}" in
|
case "${FAKE_21ST_MODE:-in}" in
|
||||||
in) echo "Logged in as tester (saved locally)."; exit 0 ;;
|
in) echo "Logged in as fake@example.com" ;; out) echo "Not logged in" ;;
|
||||||
out) echo "$signedout"; exit 0 ;;
|
garbage) echo "boom"; exit 3 ;;
|
||||||
garbage) echo "Something unexpected"; exit 0 ;;
|
|
||||||
fail) echo "$signedout"; exit 3 ;;
|
|
||||||
esac
|
esac
|
||||||
EOF
|
EOF
|
||||||
chmod +x "$WORK/bin/21st"
|
chmod +x "$WORK/bin/"*
|
||||||
|
plain() { # design gstack-design ui source profile
|
||||||
# gate_run <FAKE_21ST_MODE> <plain, \t and \n escapes> [PATH override]
|
printf 'profile=%s\nsource=%s\nflag=-\npack-design=%s\npack-gstack-design=%s\nplugin:ui-ux-pro-max@ui-ux-pro-max-skill=%s\nmodel=-\n' \
|
||||||
# -> sets $GATE_OUT / $GATE_RC. TWENTYFIRST_TOKEN and API_KEY_21ST are
|
"$5" "$4" "$1" "$2" "$3" > "$WORK/plain.txt"
|
||||||
# always unset here; TOKEN_READY below sets them explicitly instead.
|
|
||||||
gate_run() {
|
|
||||||
local mode="$1" plain="$2" gate_path="${3:-$WORK/bin:/usr/bin:/bin}"
|
|
||||||
printf '%b\n' "$plain" > "$WORK/plain.txt"
|
|
||||||
GATE_OUT="$(env -u TWENTYFIRST_TOKEN -u API_KEY_21ST \
|
|
||||||
HOME="$WORK/home" PATH="$gate_path" \
|
|
||||||
DESIGN_GATE_REPO_OVERRIDE="$WORK/repo" \
|
|
||||||
DESIGN_GATE_PROFILE_SH="$WORK/repo/lib/profile.sh" \
|
|
||||||
FAKE_21ST_MODE="$mode" bash "$GATE" 2>&1)"
|
|
||||||
GATE_RC=$?
|
|
||||||
}
|
}
|
||||||
|
gate_run() { # $1 mode, $2 PATH prefix ("" = no 21st)
|
||||||
# ── stub positive control ────────────────────────────────────────────────
|
local p="$2"; [ -n "$p" ] && p="$p:"
|
||||||
if FAKE_21ST_MODE=in "$WORK/bin/21st" whoami | grep -q '^Logged in as ' \
|
env -u TWENTYFIRST_TOKEN -u API_KEY_21ST HOME="$WORK/home" PATH="${p}/usr/bin:/bin" \
|
||||||
&& FAKE_21ST_MODE=out "$WORK/bin/21st" whoami | grep -q '^Not logged in'
|
FAKE_21ST_MODE="$1" WORK="$WORK" DESIGN_GATE_PROFILE_SH="$WORK/bin/profile.sh" \
|
||||||
then ok STUB_CONTROL; else bad STUB_CONTROL "stub sentences wrong"; fi
|
bash "$ROOT/lib/design-tool-gate.sh"
|
||||||
|
}
|
||||||
# ── SIGNED_IN_READY: whoami says logged in -> exit 0, READY ────────────────
|
expect() { # name rc-want substring
|
||||||
gate_run in 'cli\t21st'
|
if [ "$rc" = "$2" ] && case "$out" in *"$3"*) true;; *) false;; esac
|
||||||
if [ "$GATE_RC" -eq 0 ] && echo "$GATE_OUT" | grep -q 'toolchain: READY'; then
|
then ok "$1"; else bad "$1" "rc=$rc out=[$out]"; fi
|
||||||
ok SIGNED_IN_READY
|
}
|
||||||
else
|
plain on on on local web; out="$(gate_run in "$WORK/bin")"; rc=$?
|
||||||
bad SIGNED_IN_READY "rc=$GATE_RC out=$GATE_OUT"
|
expect T1-ready 0 "READY — packs design + gstack-design + ui-ux-pro-max on (web)"
|
||||||
fi
|
plain off on on local dev; out="$(gate_run in "$WORK/bin")"; rc=$?
|
||||||
|
expect T2-incomplete 10 "INCOMPLETE"; expect T2-remedy-local 10 "bash ~/.claude/lib/profile.sh set web"
|
||||||
# ── SIGNED_OUT_12: whoami says not logged in -> exit 12, ask to sign in ────
|
expect T2-names 10 "off: pack-design"
|
||||||
gate_run out 'cli\t21st'
|
plain on off off flag dev; out="$(gate_run in "$WORK/bin")"; rc=$?
|
||||||
if [ "$GATE_RC" -eq 12 ] && echo "$GATE_OUT" | grep -q 'SIGN-IN REQUIRED' \
|
expect T3-remedy-flag 10 "relaunch this conversation with a design profile: cc <name> web"
|
||||||
&& echo "$GATE_OUT" | grep -q '21st login' \
|
expect T3-names 10 "off: pack-gstack-design plugin:ui-ux-pro-max@ui-ux-pro-max-skill"
|
||||||
&& ! echo "$GATE_OUT" | grep -q 'INCOMPLETE'; then
|
plain on on on local web; out="$(gate_run in "")"; rc=$?
|
||||||
ok SIGNED_OUT_12
|
expect T4-no-cli 10 "21st needs the CLI: npm i -g @21st-dev/cli then 21st login"
|
||||||
else
|
out="$(gate_run out "$WORK/bin")"; rc=$?
|
||||||
bad SIGNED_OUT_12 "rc=$GATE_RC out=$GATE_OUT"
|
expect T5-signed-out 12 "SIGN-IN REQUIRED"; expect T5-ask 12 "! 21st login"
|
||||||
fi
|
out="$(gate_run garbage "$WORK/bin")"; rc=$?
|
||||||
|
expect T6-unverified 11 "READY BUT UNVERIFIED — 21st could not answer: whoami: rc=3 boom"
|
||||||
# ── TOKEN_READY: a token env wins even while whoami reports signed out ─────
|
out="$(TWENTYFIRST_TOKEN=x FAKE_21ST_MODE=out HOME="$WORK/home" PATH="$WORK/bin:/usr/bin:/bin" WORK="$WORK" \
|
||||||
printf 'cli\t21st\n' > "$WORK/plain.txt"
|
DESIGN_GATE_PROFILE_SH="$WORK/bin/profile.sh" bash "$ROOT/lib/design-tool-gate.sh")"; rc=$?
|
||||||
out_t="$(env HOME="$WORK/home" PATH="$WORK/bin:/usr/bin:/bin" \
|
expect T7-token 0 "READY"
|
||||||
DESIGN_GATE_REPO_OVERRIDE="$WORK/repo" \
|
printf 'nonsense\n' > "$WORK/plain.txt"; out="$(gate_run in "$WORK/bin" 2>&1)"; rc=$?
|
||||||
DESIGN_GATE_PROFILE_SH="$WORK/repo/lib/profile.sh" \
|
expect T8-bad-plain 2 "design-gate: profile.sh current --plain gave no pack-design line"
|
||||||
FAKE_21ST_MODE=out TWENTYFIRST_TOKEN=x bash "$GATE" 2>&1)"; rc_t=$?
|
if shellcheck "$ROOT/lib/design-tool-gate.sh" >/dev/null 2>&1; then ok T9-shellcheck; else bad T9-shellcheck findings; fi
|
||||||
out_k="$(env HOME="$WORK/home" PATH="$WORK/bin:/usr/bin:/bin" \
|
if [ "$(LC_ALL=C awk 'length($0) > 80' "$ROOT/lib/design-tool-gate.sh" | wc -l | tr -d ' ')" = 0 ]; then ok T9-width; else bad T9-width "lines over 80"; fi
|
||||||
DESIGN_GATE_REPO_OVERRIDE="$WORK/repo" \
|
echo "PASS=$PASS FAIL=$FAIL"; [ "$FAIL" -eq 0 ]
|
||||||
DESIGN_GATE_PROFILE_SH="$WORK/repo/lib/profile.sh" \
|
|
||||||
FAKE_21ST_MODE=out API_KEY_21ST=x bash "$GATE" 2>&1)"; rc_k=$?
|
|
||||||
if [ "$rc_t" -eq 0 ] && [ "$rc_k" -eq 0 ]; then
|
|
||||||
ok TOKEN_READY
|
|
||||||
else
|
|
||||||
bad TOKEN_READY "TOKEN rc=$rc_t ($out_t) | API_KEY rc=$rc_k ($out_k)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── CLI_ABSENT_10: 21st off PATH -> exit 10, INCOMPLETE (not sign-in) ──────
|
|
||||||
gate_run in 'cli\t21st' /usr/bin:/bin
|
|
||||||
if [ "$GATE_RC" -eq 10 ] && echo "$GATE_OUT" | grep -q 'INCOMPLETE'; then
|
|
||||||
ok CLI_ABSENT_10
|
|
||||||
else
|
|
||||||
bad CLI_ABSENT_10 "rc=$GATE_RC out=$GATE_OUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── INCOMPLETE_WINS: a blocking miss outranks a signed-out 21st ────────────
|
|
||||||
gate_run out 'cli\t21st\nexternal\tghost-skill'
|
|
||||||
if [ "$GATE_RC" -eq 10 ] && echo "$GATE_OUT" | grep -q 'INCOMPLETE' \
|
|
||||||
&& ! echo "$GATE_OUT" | grep -q 'SIGN-IN REQUIRED'; then
|
|
||||||
ok INCOMPLETE_WINS
|
|
||||||
else
|
|
||||||
bad INCOMPLETE_WINS "rc=$GATE_RC out=$GATE_OUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── UNKNOWN_11: whoami answers something else -> surfaced, never guessed ───
|
|
||||||
gate_run garbage 'cli\t21st'
|
|
||||||
if [ "$GATE_RC" -eq 11 ] && echo "$GATE_OUT" | grep -q 'whoami: rc=0' \
|
|
||||||
&& echo "$GATE_OUT" | grep -q 'Something unexpected' \
|
|
||||||
&& ! echo "$GATE_OUT" | grep -q '21st login' \
|
|
||||||
&& ! echo "$GATE_OUT" | grep -q 'claude CLI unreachable'; then
|
|
||||||
ok UNKNOWN_11
|
|
||||||
else
|
|
||||||
bad UNKNOWN_11 "garbage: rc=$GATE_RC out=$GATE_OUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
gate_run fail 'cli\t21st'
|
|
||||||
if [ "$GATE_RC" -eq 11 ] && echo "$GATE_OUT" | grep -q 'whoami: rc=3'; then
|
|
||||||
ok UNKNOWN_11
|
|
||||||
else
|
|
||||||
bad UNKNOWN_11 "fail: rc=$GATE_RC out=$GATE_OUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "PASS=$PASS FAIL=$FAIL"
|
|
||||||
[ "$FAIL" -eq 0 ]
|
|
||||||
@@ -58,7 +58,7 @@ git log --oneline -20 --all -- <suspected files>
|
|||||||
Follow `$HOME/.claude/lib/design-gate.md`:
|
Follow `$HOME/.claude/lib/design-gate.md`:
|
||||||
- Scan $ARGUMENTS and target files for design/UI/style signals (CSS, component, layout, animation).
|
- Scan $ARGUMENTS and target files for design/UI/style signals (CSS, component, layout, animation).
|
||||||
- If signals found → run `design-tool-gate.sh`; INCOMPLETE → tell the user
|
- If signals found → run `design-tool-gate.sh`; INCOMPLETE → tell the user
|
||||||
to run `/profile design`; SIGN-IN REQUIRED → design-gate.md §3 (ask
|
the remedy line it printed; SIGN-IN REQUIRED → design-gate.md §3 (ask
|
||||||
`! 21st login`, wait) before proceeding.
|
`! 21st login`, wait) before proceeding.
|
||||||
- If no signals → skip (zero overhead).
|
- If no signals → skip (zero overhead).
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ FEAT: <feature name> — rule <N>, ~<N> files, <brief approach>
|
|||||||
Follow `$HOME/.claude/lib/design-gate.md`:
|
Follow `$HOME/.claude/lib/design-gate.md`:
|
||||||
- Scan $ARGUMENTS and target files for design/UI/style signals.
|
- Scan $ARGUMENTS and target files for design/UI/style signals.
|
||||||
- If signals found → run `design-tool-gate.sh`; INCOMPLETE → tell the user
|
- If signals found → run `design-tool-gate.sh`; INCOMPLETE → tell the user
|
||||||
to run `/profile design`; SIGN-IN REQUIRED → design-gate.md §3 (ask
|
the remedy line it printed; SIGN-IN REQUIRED → design-gate.md §3 (ask
|
||||||
`! 21st login`, wait) before proceeding.
|
`! 21st login`, wait) before proceeding.
|
||||||
- If no signals → skip (zero overhead).
|
- If no signals → skip (zero overhead).
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[
|
[
|
||||||
{"id": 1, "prompt": "Add a /health endpoint to the API that returns 200 OK with version info", "expected": "Light planning, direct implementation in 1-3 files, no design brainstorm, no plugin check, run build/tests after"},
|
{"id": 1, "prompt": "Add a /health endpoint to the API that returns 200 OK with version info", "expected": "Light planning, direct implementation in 1-3 files, no design brainstorm, no plugin check, run build/tests after"},
|
||||||
{"id": 2, "prompt": "Add dark mode toggle to the settings page", "expected": "Detect UI signal → trigger design gate (run design-tool-gate.sh; if toolchain incomplete, point at /profile design), then implement small feature"},
|
{"id": 2, "prompt": "Add dark mode toggle to the settings page", "expected": "Detect UI signal → trigger design gate (run design-tool-gate.sh; if toolchain incomplete, point at the remedy line it printed), then implement small feature"},
|
||||||
{"id": 3, "prompt": "Petite feature : afficher un badge 'New' à côté des items créés cette semaine", "expected": "FR trigger, scope check (≤5 files), implement directly, no orchestrator overhead"}
|
{"id": 3, "prompt": "Petite feature : afficher un badge 'New' à côté des items créés cette semaine", "expected": "FR trigger, scope check (≤5 files), implement directly, no orchestrator overhead"}
|
||||||
]
|
]
|
||||||
Reference in new issue
Block a user