Repository navigation
Expand file tree
/
Copy pathcheck-codex-plugin.mjs
More file actions
69 lines (61 loc) · 2.83 KB
/
Copy pathcheck-codex-plugin.mjs
File metadata and controls
69 lines (61 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const readText = (relativePath) =>
fs.readFileSync(path.join(root, relativePath), 'utf8');
const readJson = (relativePath) =>
JSON.parse(readText(relativePath));
const packageJson = readJson('package.json');
const manifest = readJson('.codex-plugin/plugin.json');
const marketplace = readJson('.agents/plugins/marketplace.json');
const marketplacePlugin = marketplace.plugins?.[0];
const claudeManifest = readJson('.claude-plugin/plugin.json');
const claudeMarketplace = readJson('.claude-plugin/marketplace.json');
const claudeMarketplacePlugin = claudeMarketplace.plugins?.[0];
assert.equal(manifest.name, 'webcmd');
assert.equal(manifest.version, packageJson.version);
assert.equal(manifest.skills, './skills/');
assert.equal(manifest.author?.name, 'AgentRHQ');
assert.equal(manifest.interface?.developerName, 'AgentRHQ');
const expectedDefaultPrompts = [
'Research agentic browser automation on Hacker News and Reddit, then return a concise comparison with source links.',
'Compare MacBook Air M5 prices and availability on Amazon, Walmart, and Best Buy.',
'Find and rank today\u2019s most-discussed AI agent launches across Hacker News, Reddit, Product Hunt, and arXiv.',
];
assert.deepEqual(manifest.interface?.defaultPrompt, expectedDefaultPrompts);
assert.ok(expectedDefaultPrompts.every((prompt) => prompt.length <= 128));
assert.equal(marketplace.name, 'webcmd');
assert.equal(marketplace.plugins?.length, 1);
assert.equal(marketplacePlugin?.name, 'webcmd');
assert.deepEqual(marketplacePlugin?.source, {
source: 'url',
url: './',
});
assert.equal(claudeManifest.name, 'webcmd');
assert.equal(claudeManifest.version, packageJson.version);
assert.equal(claudeManifest.author?.name, 'AgentRHQ');
assert.equal(claudeMarketplace.name, 'webcmd');
assert.equal(claudeMarketplace.owner?.name, 'AgentRHQ');
assert.equal(claudeMarketplace.plugins?.length, 1);
assert.equal(claudeMarketplacePlugin?.name, 'webcmd');
assert.equal(claudeMarketplacePlugin?.source, './');
const expectedSkills = ['webcmd-browser'];
const actualSkills = fs
.readdirSync(path.join(root, 'skills'), { withFileTypes: true })
.filter(
(entry) =>
entry.isDirectory() &&
fs.existsSync(path.join(root, 'skills', entry.name, 'SKILL.md')),
)
.map((entry) => entry.name)
.sort();
assert.deepEqual(actualSkills, expectedSkills);
assert.equal(actualSkills.length, 1);
const browserSkill = readText('skills/webcmd-browser/SKILL.md');
assert.match(browserSkill, /webcmd-browser/);
assert.match(manifest.interface?.longDescription ?? '', /webcmd-browser|one skill/i);
console.log(
`Codex and Claude Code plugin metadata valid: ${actualSkills.length} skill`,
);