ui-ux-pro-max-skill/cli/tests/e2e/agent-query-contract.spec.ts
Walid Khalafi 9a3f14f742
feat: add AutoClaw compatibility (#545)
* feat: add AutoClaw compatibility

- Add root SKILL.md following the open SKILL.md standard
- Add 'autoclaw' to skill.json#platforms
- Add AutoClaw install instructions to README
- Add docs/autoclaw-install.md with detailed install guide

AutoClaw is Z.ai's official general-purpose AI agent (https://autoclaw.z.ai),
part of the GLM Coding Plan family alongside ZCode and OpenClaw. This PR
adds first-class AutoClaw support without changing any existing platform
install paths.

Verified SKILL.md compliance with AutoClaw/ZCode spec:
- name and description in frontmatter (required)
- description < 1024 chars
- body < 100KB
- explicit trigger phrases in description

* text feat(cli): add AutoClaw platform support

- Register 'autoclaw' in AIType, AI_TYPES, and AI_FOLDERS configuration.
- Update SKILL.md to fix broken search script paths and incorrect folder layout documentation.
- Synchronize CLI assets to ensure platform configuration and script paths are correctly bundled.

* fix(cli): install AutoClaw skills where AutoClaw actually loads them

AutoClaw does not scan `.autoclaw`; it reads workspace `skills/` plus the
shared `~/.openclaw-autoclaw/skills` directory. Point the platform config at
those roots so `uipro init --ai autoclaw` produces a skill that AutoClaw
discovers without extra configuration.

- register `autoclaw` in AI_TO_PLATFORM and add templates/platforms/autoclaw.json
  with root `skills` and globalRoot `.openclaw-autoclaw/skills`
- detect AutoClaw from `.autoclaw` or an installed `skills/ui-ux-pro-max/SKILL.md`
  and add its CLI description
- sync cli/assets, including the packaged autoclaw.json
- restore the `## Using the Search Script (CLI)` section in the canonical skill
  template, keep the explanatory paragraph as body text, and remove the
  source-repo path from generated content
- make search.py add its own directory to sys.path so sibling imports work on
  embedded Python builds whose `._pth` omits the script directory (AutoClaw's
  bundled runtime)
- remove the hand-maintained root SKILL.md; templates/base/skill-content.md is
  the single source of truth
- rewrite docs/INSTALL.md around the verified local and global CLI workflows
- update e2e coverage for the new platform count, detection, and script paths

Validated with npm run check:assets, npm run typecheck, 49 Playwright tests,
164 Python tests, and local/global installs whose generated search script runs
successfully from the installed skill directory.

* Update search.py
2026-10-31 02:08:33 +07:00

83 lines
5.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { expect, test } from '@playwright/test';
import { loadAllPlatformConfigs, renderSkillFile } from '../../src/utils/template.js';
const DESCRIPTION =
'UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks.';
test('all platform metadata uses one accurate activation description', async () => {
const configs = await loadAllPlatformConfigs();
expect(configs.size).toBe(25);
for (const [platform, config] of configs) {
expect(config.description, platform).toBe(DESCRIPTION);
if (config.frontmatter?.description) {
expect(config.frontmatter.description, platform).toBe(DESCRIPTION);
}
}
});
test('rendered guides expose the deterministic query contract', async () => {
const configs = await loadAllPlatformConfigs();
for (const [platform, config] of configs) {
const content = await renderSkillFile(config);
expect(content, platform).toContain('## Query Contract');
expect(content, platform).toContain('one dominant intent');
expect(content, platform).toContain('2–5 meaningful terms');
expect(content, platform).toContain('Retry once');
expect(content, platform).toContain('Do not persist unverified output');
expect(content, platform).toContain('explicit accessibility outcome terms');
expect(content, platform).toContain('semantic UX outcome first, then the detected stack');
expect(content, platform).toContain('orphan heading line balance' + '" --domain ux');
expect(content, platform).toContain('badge chip label wraps' + '" --domain ux');
expect(content, platform).toContain('live badge count screen reader' + '" --domain ux');
expect(content, platform).toContain('rapid chip animation interrupted' + '" --domain ux');
expect(content, platform).toContain('chip badge overflow nowrap' + '" --stack html-tailwind');
expect(content, platform).toContain('React/Next.js performance');
expect(content, platform).toContain('Native/app interface guidance');
expect(content, platform).not.toContain('React Native perf | `react`');
expect(content, platform).not.toContain('Searches domains in parallel');
expect(content, platform).not.toContain('Always start with `--design-system`');
}
});
test('rendered examples encode mode, retry, and persistence boundaries', async () => {
const config = await loadAllPlatformConfigs().then(configs => configs.get('codex'));
expect(config).toBeDefined();
const content = await renderSkillFile(config!);
expect(content).toContain('keyboard focus modal' + '" --domain ux');
expect(content).toContain('rerender memo list' + '" --domain react');
expect(content).toContain('virtualized list' + '" --stack react-native');
expect(content).toContain('--output-dir "<project-root>"');
expect(content).toContain('Read an existing `MASTER.md` before deciding whether `--force` is justified');
});
test('quick-reference copy matches whether the section is inlined', async () => {
const configs = await loadAllPlatformConfigs();
const danglingTag = /\{\{#(NO)?QR\}\}|\{\{\/(NO)?QR\}\}/;
for (const [platform, config] of configs) {
const content = await renderSkillFile(config);
expect(content, platform).not.toMatch(danglingTag);
if (config.sections.quickReference) {
expect(content, platform).toContain('## Quick Reference');
expect(content, platform).toContain('rely on the Quick Reference sections above');
expect(content, platform).toContain('Quick Reference checklist above');
expect(content, platform).toContain('Quick Reference → relevant section');
expect(content, platform).toContain('Quick Reference §6:');
expect(content, platform).toContain('apply the relevant Quick Reference sections and focused searches');
expect(content, platform).toContain('Run through Quick Reference **§1–§3**');
expect(content, platform).not.toContain('use the Search Reference, Common Rules, and Pre-Delivery Checklist in this skill');
} else {
expect(content, platform).not.toContain('## Quick Reference');
expect(content, platform).not.toContain('Quick Reference sections above');
expect(content, platform).not.toContain('Quick Reference checklist above');
expect(content, platform).not.toContain('Quick Reference →');
expect(content, platform).not.toContain('Quick Reference §');
expect(content, platform).toContain('use the Search Reference, Common Rules, and Pre-Delivery Checklist in this skill');
expect(content, platform).toContain('Step 3 (`ux` domain) + Common Rules');
expect(content, platform).toContain('`"color-dark-mode color-accessible-pairs" --domain ux`');
expect(content, platform).toContain('apply focused domain searches and the Common Rules below');
}
}
});