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

65 lines
3.1 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { loadPlatformConfig, renderSkillFile } from '../../src/utils/template.js';
const cases = [
['claude', '.claude/skills/ui-ux-pro-max/scripts/search.py'],
['codex', '.agents/skills/ui-ux-pro-max/scripts/search.py'],
['kiro', '.kiro/steering/ui-ux-pro-max/scripts/search.py'],
['droid', '.factory/skills/ui-ux-pro-max/scripts/search.py'],
['zcode', '.zcode/skills/ui-ux-pro-max/scripts/search.py'],
['kimi', '.kimi-code/skills/ui-ux-pro-max/scripts/search.py'],
['amazonq', '.amazonq/skills/ui-ux-pro-max/scripts/search.py'],
['openclaw', '.agents/skills/ui-ux-pro-max/scripts/search.py'],
] as const;
const SEARCH_COMMAND_COUNT = 17;
function extractSearchScriptPaths(content: string): string[] {
return [...content.matchAll(/^python3\s+(\S*search\.py)\b/gm)].map(match => match[1]);
}
for (const [platform, localPath] of cases) {
test(`${platform} renders project-root and global script paths`, async () => {
const config = await loadPlatformConfig(platform);
const localContent = await renderSkillFile(config);
const localPaths = extractSearchScriptPaths(localContent);
expect(localPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(localPaths)).toEqual(new Set([localPath]));
expect(localContent).not.toContain('{{SCRIPT_PATH}}');
const globalContent = await renderSkillFile(config, true);
const globalPaths = extractSearchScriptPaths(globalContent);
expect(globalPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(globalPaths)).toEqual(new Set([`~/${localPath}`]));
expect(globalContent).not.toContain('{{SCRIPT_PATH}}');
});
}
test('autoclaw renders workspace skills locally and ~/.openclaw-autoclaw/skills globally', async () => {
const config = await loadPlatformConfig('autoclaw');
const localPaths = extractSearchScriptPaths(await renderSkillFile(config));
expect(localPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(localPaths)).toEqual(new Set(['skills/ui-ux-pro-max/scripts/search.py']));
expect(await renderSkillFile(config)).not.toContain('{{SCRIPT_PATH}}');
const globalPaths = extractSearchScriptPaths(await renderSkillFile(config, true));
expect(globalPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(globalPaths)).toEqual(
new Set(['~/.openclaw-autoclaw/skills/ui-ux-pro-max/scripts/search.py'])
);
expect(await renderSkillFile(config, true)).not.toContain('{{SCRIPT_PATH}}');
});
test('copilot renders .github/skills paths locally and ~/.copilot/skills globally', async () => {
const config = await loadPlatformConfig('copilot');
const localPaths = extractSearchScriptPaths(await renderSkillFile(config));
expect(localPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(localPaths)).toEqual(new Set(['.github/skills/ui-ux-pro-max/scripts/search.py']));
const globalPaths = extractSearchScriptPaths(await renderSkillFile(config, true));
expect(globalPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(globalPaths)).toEqual(new Set(['~/.copilot/skills/ui-ux-pro-max/scripts/search.py']));
});