ui-ux-pro-max-skill/cli/tests/e2e/detect.spec.ts
XiaOldMan 7246805992
feat: add OpenClaw platform support (#527)
* feat: add OpenClaw platform support

Add OpenClaw as an install target so the skill can be installed with
`uipro init --ai openclaw` and removed via `uipro uninstall`.

OpenClaw discovers AgentSkills-format skills from `.agents/skills` in the
agent workspace and from `~/.agents/skills` (personal library on the default
state dir), so the platform config reuses the `.agents` layout already used
by the universal/codex targets with its own display name, detection entry,
and docs.

- new platform config src/ui-ux-pro-max/templates/platforms/openclaw.json
  (synced to cli/assets via sync:assets)
- register 'openclaw' in AIType, AI_TYPES, AI_FOLDERS, AI_TO_PLATFORM
- detect the shared .agents workspace directory and describe the platform
- keep the .agents-family suggestion on codex when all four .agents
  consumers are detected (length 2-3 -> 2-4)
- cover openclaw in the dry-run, template-script-paths, and
  agent-query-contract e2e specs
- document OpenClaw in README and cli/README

* chore: bump version to 2.15.0 in skill metadata files

Aligns skill.json, marketplace.json, and plugin.json with the latest
v2.15.0 release; main was still at 2.13.0. CLI package version stays on
its own npm release track.

* fix: cover OpenClaw in offline validator and detection regression

- bump scripts/validate-agent-guide.py PLATFORM_COUNT 21 -> 23 (main
  already had 22 configs with a stale count of 21; OpenClaw widens the
  gap to 23, so update the gate and keep it meaningful)
- add e2e regression: a sole .agents directory detects all four
  consumers (antigravity, codex, universal, openclaw) and still
  suggests codex rather than all
2026-10-12 18:08:03 +07:00

23 lines
989 B
TypeScript

import { expect, test } from '@playwright/test';
import { mkdir, mkdtemp } 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/)');
});