ui-ux-pro-max-skill/cli/tests/e2e/detect.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

50 lines
2.0 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { mkdir, mkdtemp, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { detectAIType, getAITypeDescription } from '../../src/utils/detect.js';
test('a sole .agents directory detects every consumer and still suggests codex', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-detect-agents-'));
await mkdir(join(scratch, '.agents'));
const { detected, suggested } = detectAIType(scratch);
// All four .agents consumers are detected, OpenClaw included.
expect(detected).toEqual(['antigravity', 'codex', 'universal', 'openclaw']);
// The shared folder must not degrade the suggestion to "all" now that a
// fourth consumer exists — it stays on the .agents-family default.
expect(suggested).toBe('codex');
});
test('openclaw has a platform description', async () => {
expect(getAITypeDescription('openclaw')).toBe('OpenClaw (.agents/skills/)');
});
test('a sole .autoclaw directory detects and suggests autoclaw', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-detect-autoclaw-'));
await mkdir(join(scratch, '.autoclaw'));
const { detected, suggested } = detectAIType(scratch);
expect(detected).toEqual(['autoclaw']);
expect(suggested).toBe('autoclaw');
});
test('autoclaw has a platform description', async () => {
expect(getAITypeDescription('autoclaw')).toBe(
'AutoClaw (skills/ locally, ~/.openclaw-autoclaw/skills/ globally)'
);
});
test('an installed skills/ui-ux-pro-max directory detects autoclaw', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-detect-autoclaw-skills-'));
await mkdir(join(scratch, 'skills', 'ui-ux-pro-max'), { recursive: true });
await writeFile(join(scratch, 'skills', 'ui-ux-pro-max', 'SKILL.md'), '---\nname: ui-ux-pro-max\n---\n');
const { detected, suggested } = detectAIType(scratch);
expect(detected).toEqual(['autoclaw']);
expect(suggested).toBe('autoclaw');
});