Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

test(onboarding): pin the WorkBuddy start-page contract and switcher boundary

Tearimid34d6ffa18ee
diff --git a/archify/test/cursor-onboarding.test.mjs b/archify/test/cursor-onboarding.test.mjs
index 734b57d2..7b1bacae 100644
--- a/archify/test/cursor-onboarding.test.mjs
+++ b/archify/test/cursor-onboarding.test.mjs
@@ -39,6 +39,79 @@ test('Cursor onboarding stays explicit, bilingual, and backed by the same Skill'
assert.doesNotMatch(start, /vendor-specific (?:renderer|schema|skill)/i);
});
+const switcherAgents = ['cursor', 'codex', 'claude-code', 'opencode'];
+
+test('WorkBuddy is documented on the Start surface but stays outside the agent switcher', () => {
+ const english = fs.readFileSync(path.join(repoRoot, 'README.md'), 'utf8');
+ const chinese = fs.readFileSync(path.join(repoRoot, 'README_ZH.md'), 'utf8');
+ const landing = fs.readFileSync(path.join(repoRoot, 'docs', 'index.html'), 'utf8');
+ const template = fs.readFileSync(path.join(repoRoot, 'scripts', 'start-template.html'), 'utf8');
+ const start = fs.readFileSync(path.join(repoRoot, 'docs', 'start.html'), 'utf8');
+
+ // The canonical template and the checked-in generated page must agree: both carry
+ // the bilingual WorkBuddy manual-install instruction and its exact destination.
+ for (const [surface, label] of [
+ [template, 'scripts/start-template.html'],
+ [start, 'docs/start.html'],
+ ]) {
+ assert.match(
+ surface,
+ /data-en="WorkBuddy is supported by copying the skill into your WorkBuddy skills directory/,
+ `${label}: English WorkBuddy instruction must stay on the Start surface`,
+ );
+ assert.match(
+ surface,
+ /data-zh="WorkBuddy 采用手动复制到技能目录的方式安装/,
+ `${label}: Chinese WorkBuddy instruction must stay on the Start surface`,
+ );
+
+ // Exact documented destination: once in the English copy, once in the Chinese
+ // copy, and once as the visible text a reader can select.
+ const destinations = surface.match(/~\/\.workbuddy\/skills\/archify/g) ?? [];
+ assert.equal(
+ destinations.length,
+ 3,
+ `${label}: ~/.workbuddy/skills/archify must appear in the English copy, the Chinese copy, and the visible text`,
+ );
+
+ // Switcher boundary: WorkBuddy is documented, never a generated tab.
+ assert.doesNotMatch(
+ surface,
+ /data-agent="workbuddy"/,
+ `${label}: WorkBuddy must not become an agent-switcher tab`,
+ );
+ const tabs = [...surface.matchAll(/data-agent="([a-z-]+)">/g)].map((match) => match[1]);
+ assert.deepEqual(tabs, switcherAgents, `${label}: the switcher must stay exactly four agents`);
+
+ const knownAgents = /var KNOWN_AGENTS = new Set\(\[([^\]]*)\]\)/.exec(surface);
+ assert.ok(knownAgents, `${label}: KNOWN_AGENTS must stay readable`);
+ const parsed = knownAgents[1]
+ .split(',')
+ .map((entry) => entry.trim().replace(/^'|'$/g, ''))
+ .filter(Boolean);
+ assert.deepEqual(
+ parsed,
+ switcherAgents,
+ `${label}: KNOWN_AGENTS must stay exactly four agents`,
+ );
+ }
+
+ // Listing a platform must not imply a generated switcher command exists for it.
+ for (const [surface, label] of [
+ [english, 'README.md'],
+ [chinese, 'README_ZH.md'],
+ [template, 'scripts/start-template.html'],
+ [start, 'docs/start.html'],
+ [landing, 'docs/index.html'],
+ ]) {
+ assert.doesNotMatch(
+ surface,
+ /--agent workbuddy/,
+ `${label}: no generated agent-switcher command may be claimed for WorkBuddy`,
+ );
+ }
+});
+
test('the zero-dependency archive works from the canonical Cursor-visible agent path', () => {
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-cursor-package-'));
const agentSkills = path.join(tmp, '.agents', 'skills');